Skip to content
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

Fix error of can not found SECRET_KEY_BASE on worker #122

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ RUN bundle exec rails assets:precompile SECRET_KEY_BASE=fake_secure_for_compile

RUN cp config/nginx/nginx.conf /etc/nginx/nginx.conf

ENTRYPOINT ["docker/entrypoint.sh"]

EXPOSE 3000

CMD ["docker/production_start.sh"]
11 changes: 11 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ -z ${SECRET_KEY_BASE+x} ]; then
echo "Generating SECRET_KEY_BASE environment variable."
echo "Please attention, all old sessions will become invalid."
echo "You can set SECRET_KEY_BASE environment variable on docker service,"
echo "to avoid generate SECRET_KEY_BASE every time when service start up."
export SECRET_KEY_BASE=$(rails secret)
fi

exec "$@"
8 changes: 0 additions & 8 deletions docker/production_start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/bin/sh

if [ -z ${var+x} ]; then
echo "Generating SECRET_KEY_BASE environment variable."
echo "Please attention, all old sessions will become invalid."
echo "You can set SECRET_KEY_BASE environment variable on docker service,"
echo "to avoid generate SECRET_KEY_BASE every time when service start up."
export SECRET_KEY_BASE=$(rails secret)
fi

# Prepare Database
rails db:prepare

Expand Down