Fix CRON (#24)

* Use docker-compose to run database setup
* Build sidekiq image in test script
* Fix db migration startup script
* Let Runit deal with services

Sidekiq was started by a blocking script in my_init. This lead to the init process not getting to run Runit, which is in charge of CRON among other things. To fix it, I moved Sidekiq to be run by Runit as well. I also moved the postfix start script, while I was at it.
This commit is contained in:
Helge Rausch
2022-11-23 15:09:34 +01:00
committed by GitHub
parent d399ca5fc2
commit 9b1ed05a5f
6 changed files with 13 additions and 12 deletions

View File

@@ -10,9 +10,9 @@ RUN apt-get install -qy libhiredis-dev postgresql-client postfix imagemagick tzd
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN postconf -e myhostname=opensnp.org
ADD start_postfix.sh /etc/my_init.d/91_start_postfix.sh
COPY postfix /etc/service/postfix/run
ADD nginx /etc/nginx
COPY nginx /etc/nginx
RUN sed -i "s/# gzip_types/gzip_types/" /etc/nginx/nginx.conf
RUN sed -i "s/# gzip_vary/gzip_vary/" /etc/nginx/nginx.conf
RUN sed -i "s/# gzip_proxied/gzip_proxied/" /etc/nginx/nginx.conf
@@ -38,8 +38,8 @@ RUN /usr/local/rvm/bin/rvm alias create default $(cat .ruby-version)
USER app
ADD irbrc /home/app/.irbrc
ADD database.yml config/database.yml
COPY irbrc /home/app/.irbrc
COPY database.yml config/database.yml
RUN bash -l -c 'gem install bundler'
RUN bash -l -c 'bundle install --jobs=4 --deployment --without test development'
RUN cp .env.development .env

View File

@@ -1,5 +1,5 @@
#!/bin/sh
cd /home/app/webapp
cd /home/app/snpr
exec 2>&1
exec bash -l -c 'chpst -u app bundle exec rake db:migrate'

4
postfix Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
exec /usr/lib/postfix/sbin/master

View File

@@ -3,7 +3,7 @@ FROM opensnp/rails
RUN mkdir /var/run/sidekiq
RUN chown app:app /var/run/sidekiq
RUN touch /etc/service/nginx/down
ADD sidekiq-run /etc/my_init.d/92_sidekiq.sh
COPY sidekiq-run /etc/service/sidekiq/run
RUN rm /etc/cron.d/renew_ssl_cert
USER app
RUN bash -l -c 'bundle exec whenever --update-crontab'

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env sh
service postfix start

View File

@@ -8,11 +8,11 @@ if [ -z "$snpr_rev" ]; then
fi
docker-compose kill
docker-compose rm rails
docker-compose build --build-arg SNPR_REV=$snpr_rev rails
docker-compose rm rails sidekiq
docker-compose build --build-arg SNPR_REV=$snpr_rev rails sidekiq
docker-compose up -d
docker exec -ti docker_rails_1 bash -l -c 'bundle exec rake db:reset'
docker-compose exec rails bash -l -c 'bundle exec rake db:reset'
wget -O - --retry-connrefused -T 60 http://${HOST:-localhost}:8080/
status=$?