-
-
Notifications
You must be signed in to change notification settings - Fork 95
New light Docker image for serverless deployment #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| FROM killbill/killbill:0.20.11 | ||
| MAINTAINER Kill Bill core team <killbilling-users@googlegroups.com> | ||
|
|
||
| # Install envsubst (see killbill.sh) | ||
| USER root | ||
| ENV DEBIAN_FRONTEND noninteractive | ||
| RUN apt-get update && \ | ||
| apt-get install -y \ | ||
| gettext-base && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
| ENV DEBIAN_FRONTEND teletype | ||
| USER tomcat | ||
|
|
||
| # Disable Ansible (requires /dev/shm) | ||
| ENV KPM_INSTALL_CMD /bin/true | ||
|
|
||
| # No JRuby plugin and no OSGI bundle, to keep memory usage low | ||
| RUN kpm uninstall kpm --destination=$KILLBILL_INSTALL_DIR/bundles | ||
| RUN rm -f $KILLBILL_INSTALL_DIR/bundles/platform/* | ||
|
|
||
| # Pre-expand the Kill Bill WAR | ||
| RUN cd $TOMCAT_HOME/webapps && \ | ||
| mkdir ROOT && \ | ||
| cd ROOT && \ | ||
| jar -xvf ../ROOT.war && \ | ||
| touch -r ../ROOT.war META-INF/war-tracker && \ | ||
| cd - && \ | ||
| rm -f ROOT.war && \ | ||
| cd - | ||
|
|
||
| # TODO | ||
| # * The SocketFactory jdbc driver doesn't seem to be working on Cloud Run | ||
| # * The Logback Stackdriver LoggingAppender isn't reliable | ||
| # | ||
| # Custom libraries | ||
| #COPY lib/*.jar $TOMCAT_HOME/webapps/ROOT/WEB-INF/lib/ | ||
| # Hack for now... | ||
| #RUN cd $TOMCAT_HOME/webapps/ROOT/WEB-INF/lib/ && \ | ||
| # rm -f animal-sniffer-annotations-1.14.jar annotations-3.0.1u2.jar asm-5.0.3.jar commons-codec-1.9.jar commons-lang3-3.2.1.jar error_prone_annotations-2.1.3.jar google-api-services-sqladmin-v1beta4-rev20190510-1.28.0.jar j2objc-annotations-1.1.jar jackson-core-2.9.6.jar && \ | ||
| # cd - | ||
|
|
||
| # Add Kaui | ||
| COPY webapps/kaui.war $TOMCAT_HOME/webapps/kaui.war | ||
|
|
||
| # Pre-expand the Kaui WAR | ||
| RUN cd $TOMCAT_HOME/webapps && \ | ||
| mkdir kaui && \ | ||
| cd kaui && \ | ||
| jar -xvf ../kaui.war && \ | ||
| touch -r ../kaui.war META-INF/war-tracker && \ | ||
| cd - && \ | ||
| rm -f kaui.war && \ | ||
| cd - | ||
|
|
||
| # TODO See above | ||
| # Custom libraries | ||
| #COPY lib/*.jar $TOMCAT_HOME/webapps/kaui/WEB-INF/lib/ | ||
| # Hack for now... | ||
| #RUN cd $TOMCAT_HOME/webapps/kaui/WEB-INF/lib/ && \ | ||
| # rm -f animal-sniffer-annotations-1.14.jar annotations-3.0.1u2.jar asm-5.0.3.jar commons-codec-1.9.jar commons-lang3-3.2.1.jar error_prone_annotations-2.1.3.jar google-api-services-sqladmin-v1beta4-rev20190510-1.28.0.jar j2objc-annotations-1.1.jar jackson-core-2.9.6.jar && \ | ||
| # cd - | ||
|
|
||
| # Note that classic configuration via environment variables won't work since Ansible isn't invoked | ||
| COPY webapp-context.xml $TOMCAT_HOME/webapps/ROOT/META-INF/context.xml | ||
| COPY webapp-context.xml $TOMCAT_HOME/webapps/kaui/META-INF/context.xml | ||
| COPY context.xml $TOMCAT_HOME/conf/context.xml | ||
| COPY server.xml $TOMCAT_HOME/conf/server.xml | ||
| COPY setenv.sh $TOMCAT_HOME/bin/setenv.sh | ||
| COPY logback.xml $KILLBILL_INSTALL_DIR/logback.xml | ||
| COPY killbill.properties.template $KILLBILL_INSTALL_DIR/killbill.properties.template | ||
| COPY killbill.sh $KILLBILL_INSTALL_DIR |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Kill Bill light | ||
|
|
||
| Kill Bill light is suitable for serverless deployments such as Google Cloud Run: | ||
|
|
||
| * Memory usage low | ||
| * No `/dev/shm` requirement |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Context unloadDelay="31000"> | ||
| </Context> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| org.killbill.security.shiroNbHashIterations=1 | ||
| org.killbill.jaxrs.threads.pool.nb=5 | ||
| org.killbill.payment.plugin.threads.nb=1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are going from one extreme to the next :-)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, for serverless deployments, the payment integration doesn't really work out of the box:
It's really a subscription-only profile which should be deployed :-) |
||
| org.killbill.billing.osgi.bundles.jruby.conf.dir=/var/lib/killbill/config | ||
| org.killbill.osgi.bundle.install.dir=/var/lib/killbill/bundles | ||
| org.killbill.server.baseUrl=http://localhost:8080 | ||
| org.killbill.billing.osgi.dao.user=$KILLBILL_DAO_USER | ||
| org.killbill.billing.osgi.dao.password=$KILLBILL_DAO_PASSWORD | ||
| org.killbill.billing.osgi.dao.url=$KILLBILL_DAO_URL | ||
| org.killbill.dao.user=$KILLBILL_DAO_USER | ||
| org.killbill.dao.password=$KILLBILL_DAO_PASSWORD | ||
| org.killbill.dao.url=$KILLBILL_DAO_URL | ||
| org.killbill.dao.maxActive=10 | ||
| org.killbill.billing.osgi.dao.maxActive=10 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| export KILLBILL_DAO_USER=${KILLBILL_DAO_USER:-killbill} | ||
| export KILLBILL_DAO_PASSWORD=${KILLBILL_DAO_PASSWORD:-killbill} | ||
| export KILLBILL_DAO_URL=${KILLBILL_DAO_URL:-jdbc:h2:mem:killbill} | ||
|
|
||
| envsubst < $KILLBILL_INSTALL_DIR/killbill.properties.template > $KILLBILL_INSTALL_DIR/killbill.properties | ||
|
|
||
| exec /usr/share/tomcat/bin/catalina.sh run |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mvn dependency:copy-dependencies -DoutputDirectory=. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>org.kill-bill.docker</groupId> | ||
| <artifactId>killbill-light</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.cloud.sql</groupId> | ||
| <artifactId>mysql-socket-factory-connector-j-8</artifactId> | ||
| <version>1.0.14</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-logging-logback</artifactId> | ||
| <version>0.106.0-alpha</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <configuration scan="false"> | ||
| <!-- <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender"> | ||
| <log>killbill.log</log> | ||
| <flushLevel>WARN</flushLevel> | ||
| </appender> --> | ||
| <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
| <encoder> | ||
| <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern> | ||
| </encoder> | ||
| </appender> | ||
|
|
||
| <!-- Silence verbose loggers --> | ||
| <logger name="com.dmurph" level="OFF"/> | ||
| <logger name="jdbc" level="OFF"/> | ||
| <logger name="org.jooq.Constants" level="OFF"/> | ||
| <logger name="org.eclipse" level="WARN"/> | ||
| <logger name="org.killbill.commons.jdbi.guice.DBIProvider" level="OFF"/> | ||
|
|
||
| <root level="INFO"> | ||
| <!-- <appender-ref ref="CLOUD" /> --> | ||
| <appender-ref ref="STDOUT" /> | ||
| </root> | ||
| </configuration> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <Server port="8005" shutdown="SHUTDOWN"> | ||
| <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> | ||
| <!-- APR library loader. Documentation at /docs/apr.html --> | ||
| <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> | ||
| <!-- Prevent memory leaks due to use of particular java/javax APIs--> | ||
| <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> | ||
| <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> | ||
| <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> | ||
|
|
||
| <Service name="Catalina"> | ||
| <Executor name="tomcatThreadPool" | ||
| namePrefix="catalina-exec-" | ||
| maxThreads="20" | ||
| maxIdleTime="30000" | ||
| minSpareThreads="4" | ||
| prestartminSpareThreads="true" /> | ||
|
|
||
| <Connector executor="tomcatThreadPool" | ||
| port="8080" | ||
| protocol="HTTP/1.1" | ||
| connectionTimeout="20000" /> | ||
|
|
||
| <Engine name="Catalina" defaultHost="localhost"> | ||
| <Host name="localhost" | ||
| appBase="webapps" | ||
| unpackWARs="true" | ||
| autoDeploy="false"> | ||
|
|
||
| <Valve className="org.apache.catalina.valves.RemoteIpValve" | ||
| protocolHeader="x-forwarded-proto" | ||
| portHeader="x-forwarded-port" /> | ||
| </Host> | ||
| </Engine> | ||
| </Service> | ||
| </Server> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| export JAVA_HOME=${JAVA_HOME-"/usr/lib/jvm/default-java"} | ||
|
|
||
| # JVM Options | ||
| CATALINA_OPTS="-server | ||
| -showversion | ||
| -XX:+PrintCommandLineFlags | ||
| -XX:+UseCodeCacheFlushing | ||
| -Xms512m | ||
| -Xmx1024m | ||
| -XX:+CMSClassUnloadingEnabled | ||
| -XX:-OmitStackTraceInFastThrow | ||
| -XX:+UseParNewGC | ||
| -XX:+UseConcMarkSweepGC | ||
| -XX:+CMSConcurrentMTEnabled | ||
| -XX:+ScavengeBeforeFullGC | ||
| -XX:+CMSScavengeBeforeRemark | ||
| -XX:+CMSParallelRemarkEnabled | ||
| -XX:+UseCMSInitiatingOccupancyOnly | ||
| -XX:CMSInitiatingOccupancyFraction=50 | ||
| -XX:NewSize=100m | ||
| -XX:MaxNewSize=256m | ||
| -XX:SurvivorRatio=10 | ||
| -XX:+DisableExplicitGC" | ||
|
|
||
| # Java Properties | ||
| export CATALINA_OPTS="$CATALINA_OPTS | ||
| -Dkaui.url=http://127.0.0.1:8080 | ||
| -Dkaui.db.url=$KILLBILL_DAO_URL | ||
| -Dkaui.db.password=$KILLBILL_DAO_PASSWORD | ||
| -Dkaui.db.username=$KILLBILL_DAO_USER | ||
| -Dlogback.configurationFile=/var/lib/killbill/logback.xml | ||
| -Dorg.killbill.server.properties=file:///var/lib/killbill/killbill.properties | ||
| -Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true | ||
| -Djava.rmi.server.hostname=$ENV_HOST_IP | ||
| -Djava.security.egd=file:/dev/./urandom | ||
| -Djruby.compile.invokedynamic=false | ||
| -Dlog4jdbc.sqltiming.error.threshold=1000" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <Context> | ||
| <JarScanner> | ||
| <JarScanFilter pluggabilitySkip="*" tldSkip="*" defaultTldScan="false" /> | ||
| </JarScanner> | ||
| </Context> |
Uh oh!
There was an error while loading. Please reload this page.