Skip to content

Commit

Permalink
add sidekiq to entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Sep 22, 2023
1 parent ffadb68 commit c5b733a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ services:
build:
context: .
dockerfile: Dockerfile
# env_file: .env
environment:
- RAILS_LOG_TO_STDOUT=1
- RAILS_SERVE_STATIC_FILES=1
Expand All @@ -23,16 +22,14 @@ services:
build:
context: .
dockerfile: Dockerfile
# env_file: .env
environment:
- RAILS_LOG_TO_STDOUT=1
- RACK_ENV=production
- RAILS_ENV=production
- REDIS_URL=redis://redis:6379
command: ""
- RUN_SIDEKIQ=true
volumes:
- ./docker-entrypoint.sh:/docker-entrypoint.sh
command: "bundle exec sidekiq -C config/sidekiq.yml"
depends_on:
- redis

Expand Down
11 changes: 9 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ else
echo "⚠️ Skipping migrations"
fi

echo "🚀 $@"
exec "$@"
# run the command if non-forced sidekiq execution
if [ -z "$RUN_SIDEKIQ" ]; then
echo "🚀 $@"
exec "$@"
else
echo "🚀 Starting Sidekiq"
bundle exec sidekiq -e ${RACK_ENV:-production} -C config/sidekiq.yml
fi

3 changes: 3 additions & 0 deletions docs/modules/develop/pages/manual/operations/deployment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ If you want to deploy a modified version of the Bulletin Board, we highly recomm

Note that there are is also `Dockerfile.release` in the repository. It is the same but without using and entrypoint and changing the default command to execute the db:migrate task. This is mostly intended for its use in heroku.

**Important**
You need to spin up two instances of the Bulletin Board, one for the server and one for the worker. The default entrypoint provided in the `Dockerfile` executes whatever command is defined (by default `rails server`), however you can use the ENV var `RUN_SIDEKIQ` to override the command and use the same Dockerfile as a worker without any other modification. See the `docker-compose.yml` file for an example.

== ActiveStorage

The Bulletin Board uses ActiveStorage.
Expand Down

0 comments on commit c5b733a

Please sign in to comment.