From fedc8d65ff7280fdbe12812b6fcc4ae245573ba0 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 19 Sep 2024 21:58:38 -0700 Subject: [PATCH] remove not needed entry points.. make sure credentials stay even after restarts --- VERSION | 2 +- config/credentials.yml.enc | 1 - entrypoint.sh | 13 +++++++++++-- rails-entrypoint.sh | 21 --------------------- sidekiq-entrypoint.sh | 15 --------------- 5 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 config/credentials.yml.enc delete mode 100755 rails-entrypoint.sh delete mode 100755 sidekiq-entrypoint.sh diff --git a/VERSION b/VERSION index ff04fbf..d367ada 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.19-alpha \ No newline at end of file +1.0.20-alpha \ No newline at end of file diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc deleted file mode 100644 index fbfdfc7..0000000 --- a/config/credentials.yml.enc +++ /dev/null @@ -1 +0,0 @@ -XPipw3icn3ImGvT+ngdEv55GUi/qsdvDKEFz2ZQsi81kBRowLs54twbRrH1CG6k7NxOr5UcY4yQ/5G/QR1ks35cVJsbWGQHpM04ZsXw8M5RRgl/e3LcCl1qXlVQicm3pEbtlSef0PJxNpxxbUjoDuUv6KjScrLcHZQGeDQabcFHqjsl0YthzeLDA3ojcXTWHLNYeRV8TBvaI2MKgPV2By6jXo5jGQW1kxpTBXzjIvKhDvHyNAzzazkPMBpbFEmF9SGrjvwyL0YcJh7sbRCjguk+ygG7SetazVYyE7Y+0hZ0OAxx0zXiAiZZ+aRXInWrZac9TF7Sq4HI5cN0H/2OPcB86XLt1ochMw9h93fmXlvyRrlbYaCv2P1sXCoX4liHNJwCovkl/Mg+Bgc+7GY3EgfXcwlut--nCVgf0LbKPzPE5Xf--O19Yd363azqX1CIkTmukhw== \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 8f3f629..22e3962 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,7 +7,17 @@ if [ -z "$SECRET_KEY_BASE" ]; then export SECRET_KEY_BASE=$(bin/rails secret) fi -echo "Running bundle exec rake assets:precompile" +if [ -f storage/credentials.yml.enc ]; then + if [ ! -f config/credentials.yml.enc ]; then + cp storage/credentials.yml.enc config/credentials.yml.enc + fi +else + EDITOR=sed rails credentials:edit --environment production + cp config/credentials.yml.enc storage/credentials.yml.enc +fi + + +echo "Remove PID" rm -f /app/tmp/pids/server.pid echo "Running bundle exec rake assets:precompile" bundle exec rake assets:precompile RAILS_ENV=production @@ -15,7 +25,6 @@ echo "Running bundle exec rails db:migrate RAILS_ENV=production" bundle exec rails db:migrate RAILS_ENV=production # Start Sidekiq worker in the background -./sidekiq-entrypoint.sh & bundle exec sidekiq & diff --git a/rails-entrypoint.sh b/rails-entrypoint.sh deleted file mode 100755 index 1d6b9ac..0000000 --- a/rails-entrypoint.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e -echo "Starting entrypoint.sh" -export REDIS_URL=redis://redis:6379/1 - -# Ensure SECRET_KEY_BASE is set -if [ -z "$SECRET_KEY_BASE" ]; then - export SECRET_KEY_BASE=$(bin/rails secret) -fi - -echo "Running bundle exec rake assets:precompile" -rm -f /app/tmp/pids/server.pid - -echo "Running bundle exec rake assets:precompile" -bundle exec rake assets:precompile RAILS_ENV=production - -echo "Running bundle exec rails db:migrate RAILS_ENV=production" -bundle exec rails db:migrate RAILS_ENV=production - -echo "Executing final command: $@" -exec "$@" diff --git a/sidekiq-entrypoint.sh b/sidekiq-entrypoint.sh deleted file mode 100755 index 1ad4212..0000000 --- a/sidekiq-entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -e - -# Ensure Redis URL is set correctly -export REDIS_URL=redis://redis:6379/1 - -# Ensure SECRET_KEY_BASE is set -if [ -z "$SECRET_KEY_BASE" ]; then - export SECRET_KEY_BASE=$(bin/rails secret) -fi - -# Migrate the database before starting Sidekiq -bundle exec rails db:migrate RAILS_ENV=production - -exec "$@"