From 9e819b58f65e73bc6e416c8ed6d7fac2925cedf5 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 23 Sep 2021 10:43:48 -0700 Subject: [PATCH] Add config.sh to configure scaling --- Dockerfile | 2 +- start.sh | 3 +++ supervisor/sidekiq.conf | 4 ++-- supervisor/streaming.conf | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2204a3..8691aaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ RUN ln -sf /run/mastodon/supervisord.log /var/log/supervisor/supervisord.log RUN ln -fs /app/data/env.production /app/code/.env.production RUN ln -fs /app/data/system /app/code/public/system -COPY start.sh cleanup.sh env.template /app/pkg/ +COPY start.sh cleanup.sh config.sh env.template /app/pkg/ CMD [ "/app/pkg/start.sh" ] diff --git a/start.sh b/start.sh index 9153717..3d7cd9c 100755 --- a/start.sh +++ b/start.sh @@ -69,6 +69,9 @@ fi chown -R cloudron:cloudron /app/data /tmp/mastodon /run/mastodon +[[ ! -f /app/data/config.sh ]] && cp /app/pkg/config.sh /app/data/config.sh +source /app/data/config.sh + echo "==> Starting mastodon" exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Mastodon diff --git a/supervisor/sidekiq.conf b/supervisor/sidekiq.conf index 2b60959..6ff6e69 100644 --- a/supervisor/sidekiq.conf +++ b/supervisor/sidekiq.conf @@ -1,8 +1,8 @@ [program:sidekiq] priority=10 directory=/app/code -environment=HOME=/app/code,DB_POOL=25,RAILS_ENV=production,MALLOC_ARENA_MAX=2 -command=bundle exec sidekiq -c 2 -e production +environment=HOME=/app/code,RAILS_ENV=production,MALLOC_ARENA_MAX=2 +command=bundle exec sidekiq -c %(ENV_SIDEKIQ_THREADS)s -e production user=cloudron autostart=true autorestart=true diff --git a/supervisor/streaming.conf b/supervisor/streaming.conf index 2045ecb..b1cf2ca 100644 --- a/supervisor/streaming.conf +++ b/supervisor/streaming.conf @@ -1,7 +1,7 @@ [program:streaming] priority=10 directory=/app/code -environment=HOME=/app/code,NODE_ENV=production,PORT=4000,STREAMING_CLUSTER_NUM=1 +environment=HOME=/app/code,NODE_ENV=production,PORT=4000 command=node /app/code/streaming user=cloudron autostart=true