Skip to content

Commit

Permalink
[#82] adding EB post deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdash committed Nov 10, 2023
1 parent c81988a commit c91741e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .ebextensions/django.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: src.odm2cvs.odm2cvs.wsgi:application
aws:elasticbeanstalk:environment:proxy:staticfiles:
/static: src/odm2cvs/staticfiles
18 changes: 18 additions & 0 deletions .platform/hooks/postdeploy/01_migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

source "$PYTHONPATH/activate" && {

if [[ $EB_IS_COMMAND_LEADER == "true" ]];
then
cd /var/app/current/src/odm2cvs || exit 1;
echo "Listing migrations before running migrate command:";
python manage.py showmigrations;
echo "Running migrate command:";
python manage.py migrate --noinput;
echo "Listing migrations after running migrate command:";
python manage.py showmigrations;
else
echo "Skipping migrations on non-leader node.";
fi

}
14 changes: 14 additions & 0 deletions .platform/hooks/postdeploy/02_collectstatic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

source "$PYTHONPATH/activate" && {

if [[ $EB_IS_COMMAND_LEADER == "true" ]];
then
cd /var/app/current/src/odm2cvs || exit 1;
echo "Collecting static files:";
python manage.py collectstatic --noinput;
else
echo "Skipping static collection on non-leader node.";
fi

}

0 comments on commit c91741e

Please sign in to comment.