Skip to content

Commit

Permalink
avoid stopping services before migrations in after_install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen committed Jul 8, 2024
1 parent ecd1ebe commit 60a430a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions scripts/after_install_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ poetry run python manage.py showmigrations >> "$LOG_FILE" 2>&1 # Logging full o
PENDING_MIGRATIONS=$(poetry run python manage.py showmigrations | grep "\[ \]" | wc -l) # Count unapplied migrations

if [ "$PENDING_MIGRATIONS" -gt 0 ]; then
echo "Migrations found; stopping services..." >> "$LOG_FILE"
sudo systemctl stop gunicorn-dev celery-indexer-worker-dev celery-beat-worker-dev celery-beat-dev
# COMMENTING OUT FOR NOW AS I BELIEVE STOPPING SERVICES CREATES UNNECESSARY DOWNTIME
# echo "Migrations found; stopping services..." >> "$LOG_FILE"
# sudo systemctl stop gunicorn-dev celery-indexer-worker-dev celery-beat-worker-dev celery-beat-dev

echo 'Applying migrations...' >> "$LOG_FILE"
poetry run python manage.py migrate >> "$LOG_FILE" 2>&1
Expand Down
5 changes: 3 additions & 2 deletions scripts/after_install_testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ poetry run python manage.py showmigrations >> "$LOG_FILE" 2>&1 # Logging full o
PENDING_MIGRATIONS=$(poetry run python manage.py showmigrations | grep "\[ \]" | wc -l) # Count unapplied migrations

if [ "$PENDING_MIGRATIONS" -gt 0 ]; then
echo "Migrations found; stopping services..." >> "$LOG_FILE"
sudo systemctl stop gunicorn-testnet celery-indexer-worker-testnet celery-beat-worker-testnet celery-beat-testnet
# COMMENTING OUT FOR NOW AS I BELIEVE STOPPING SERVICES IS UNNECESSARY
# echo "Migrations found; stopping services..." >> "$LOG_FILE"
# sudo systemctl stop gunicorn-testnet celery-indexer-worker-testnet celery-beat-worker-testnet celery-beat-testnet

echo 'Applying migrations...' >> "$LOG_FILE"
poetry run python manage.py migrate >> "$LOG_FILE" 2>&1
Expand Down

0 comments on commit 60a430a

Please sign in to comment.