diff --git a/.dockerignore b/.dockerignore index 5d407f80..c379c459 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,6 @@ # allow only what we need !commafeed-server/target/commafeed.jar +!commafeed-server/config.docker-warmup.yml !commafeed-server/config.yml.example + diff --git a/Dockerfile b/Dockerfile index c9a9357b..8e724634 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,15 @@ EXPOSE 8082 RUN mkdir -p /commafeed/data VOLUME /commafeed/data +RUN apt update && apt install -y wait-for-it && apt clean + ENV JAVA_TOOL_OPTIONS -Djava.net.preferIPv4Stack=true -Xtune:virtualized -Xminf0.05 -Xmaxf0.1 +COPY commafeed-server/config.docker-warmup.yml . COPY commafeed-server/config.yml.example config.yml COPY commafeed-server/target/commafeed.jar . # build openj9 shared classes cache to improve startup time -RUN java -Xshareclasses -jar commafeed.jar +RUN sh -c 'java -Xshareclasses -jar commafeed.jar server config.docker-warmup.yml &' ; wait-for-it -t 120 localhost:8088 -- pkill java ; rm -rf config.warmup.yml CMD ["java", "-Xshareclasses", "-jar", "commafeed.jar", "server", "config.yml"] diff --git a/commafeed-server/config.docker-warmup.yml b/commafeed-server/config.docker-warmup.yml new file mode 100644 index 00000000..8657c5eb --- /dev/null +++ b/commafeed-server/config.docker-warmup.yml @@ -0,0 +1,151 @@ +# CommaFeed settings +# ------------------ +app: + # url used to access commafeed + publicUrl: http://localhost:8088/ + + # whether to expose a robots.txt file that disallows web crawlers and search engine indexers + hideFromWebCrawlers: true + + # whether to allow user registrations + allowRegistrations: true + + # whether to enable strict password validation (1 uppercase char, 1 lowercase char, 1 digit, 1 special char) + strictPasswordPolicy: true + + # create a demo account the first time the app starts + createDemoAccount: true + + # put your google analytics tracking code here + googleAnalyticsTrackingCode: + + # put your google server key (used for youtube favicon fetching) + googleAuthKey: + + # number of http threads + backgroundThreads: 3 + + # number of database updating threads + databaseUpdateThreads: 1 + + # rows to delete per query while cleaning up old entries + databaseCleanupBatchSize: 100 + + # settings for sending emails (password recovery) + smtpHost: localhost + smtpPort: 25 + smtpTls: false + smtpUserName: user + smtpPassword: pass + smtpFromAddress: + + # Graphite Metric settings + # Allows those who use Graphite to have CommaFeed send metrics for graphing (time in seconds) + graphiteEnabled: false + graphitePrefix: "test.commafeed" + graphiteHost: "localhost" + graphitePort: 2003 + graphiteInterval: 60 + + # whether this commafeed instance has a lot of feeds to refresh + # leave this to false in almost all cases + heavyLoad: false + + # minimum amount of time commafeed will wait before refreshing the same feed + refreshIntervalMinutes: 5 + + # if enabled, images in feed entries will be proxied through the server instead of accessed directly by the browser + # useful if commafeed is usually accessed through a restricting proxy + imageProxyEnabled: true + + # database query timeout (in milliseconds), 0 to disable + queryTimeout: 0 + + # time to keep unread statuses (in days), 0 to disable + keepStatusDays: 0 + + # entries to keep per feed, old entries will be deleted, 0 to disable + maxFeedCapacity: 500 + + # entries older than this will be deleted, 0 to disable + maxEntriesAgeDays: 365 + + # limit the number of feeds a user can subscribe to, 0 to disable + maxFeedsPerUser: 0 + + # cache service to use, possible values are 'noop' and 'redis' + cache: noop + + # announcement string displayed on the main page + announcement: + + # user-agent string that will be used by the http client, leave empty for the default one + userAgent: + + # enable websocket connection so the server can notify the web client that there are new entries for your feeds + websocketEnabled: true + + # interval at which the client will send a ping message on the websocket to keep the connection alive + websocketPingInterval: 15m + + # if websocket is disabled or the connection is lost, the client will reload the feed tree at this interval + treeReloadInterval: 30s + +# Database connection +# ------------------- +# for MariaDB +# driverClass is org.mariadb.jdbc.Driver +# url is jdbc:mariadb://localhost/commafeed?autoReconnect=true&failOverReadOnly=false&maxReconnects=20&rewriteBatchedStatements=true&timezone=UTC +# +# for MySQL +# driverClass is com.mysql.cj.jdbc.Driver +# url is jdbc:mysql://localhost/commafeed?autoReconnect=true&failOverReadOnly=false&maxReconnects=20&rewriteBatchedStatements=true&timezone=UTC +# +# for PostgreSQL +# driverClass is org.postgresql.Driver +# url is jdbc:postgresql://localhost:5432/commafeed + +database: + driverClass: org.h2.Driver + url: jdbc:h2:mem:commafeed + user: sa + password: sa + properties: + charSet: UTF-8 + validationQuery: "/* CommaFeed Health Check */ SELECT 1" + +server: + applicationConnectors: + - type: http + port: 8088 + +logging: + level: INFO + loggers: + com.commafeed: DEBUG + liquibase: INFO + org.hibernate.SQL: INFO # or ALL for sql debugging + org.hibernate.engine.internal.StatisticalLoggingSessionEventListener: WARN + appenders: + - type: console + - type: file + currentLogFilename: log/commafeed.log + threshold: ALL + archive: true + archivedLogFilenamePattern: log/commafeed-%d.log + archivedFileCount: 5 + timeZone: UTC + +# Redis pool configuration +# (only used if app.cache is 'redis') +# ----------------------------------- +redis: + host: localhost + port: 6379 + # username is only required when using ACLs + username: + password: + timeout: 2000 + database: 0 + maxTotal: 500 + \ No newline at end of file