mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-14 05:29:43 +02:00
changes
This commit is contained in:
parent
9e038d1f93
commit
1bba542a55
1 changed files with 9 additions and 9 deletions
18
.github/workflows/delete-and-recreate-db.yaml
vendored
18
.github/workflows/delete-and-recreate-db.yaml
vendored
|
@ -41,7 +41,7 @@ jobs:
|
||||||
CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD
|
CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD
|
||||||
DESTINATION_ENVIRONMENT: ${{ github.event.inputs.environment}}
|
DESTINATION_ENVIRONMENT: ${{ github.event.inputs.environment}}
|
||||||
steps:
|
steps:
|
||||||
- name: Dekete and Recreate Database
|
- name: Delete and Recreate Database
|
||||||
env:
|
env:
|
||||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||||
|
@ -58,33 +58,33 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#unbind the service
|
# unbind the service
|
||||||
cf unbind-service getgov-$DESTINATION_ENVIRONMENT getgov-$DESTINATION_ENVIRONMENT-database
|
cf unbind-service getgov-$DESTINATION_ENVIRONMENT getgov-$DESTINATION_ENVIRONMENT-database
|
||||||
#delete the service key
|
#delete the service key
|
||||||
yes Y | cf delete-service-key getgov-$DESTINATION_ENVIRONMENT-database SERVICE_CONNECT
|
yes Y | cf delete-service-key getgov-$DESTINATION_ENVIRONMENT-database SERVICE_CONNECT
|
||||||
#delete the service
|
#delete the service
|
||||||
yes Y | cf delete-service getgov-$DESTINATION_ENVIRONMENT-database
|
yes Y | cf delete-service getgov-$DESTINATION_ENVIRONMENT-database
|
||||||
#create it again
|
# create it again
|
||||||
cf create-service aws-rds micro-psql getgov-$DESTINATION_ENVIRONMENT-database
|
cf create-service aws-rds micro-psql getgov-$DESTINATION_ENVIRONMENT-database
|
||||||
# wait for it be created (up to 5 mins)
|
# wait for it be created (up to 5 mins)
|
||||||
# this checks the creation cf service getgov-$DESTINATION_ENVIRONMENT-database
|
# this checks the creation cf service getgov-$DESTINATION_ENVIRONMENT-database
|
||||||
# the below command with check “status” line using cf service command mentioned above. if it says “create in progress” it will keep waiting otherwise the next steps fail
|
# the below command with check “status” line using cf service command mentioned above. if it says “create in progress” it will keep waiting otherwise the next steps fail
|
||||||
|
|
||||||
until cf service getgov-$DESTINATION_ENVIRONMENT-database | grep -q 'The service instance status is succeeded'
|
timeout 30 until cf service getgov-$DESTINATION_ENVIRONMENT-database | grep -q 'The service instance status is succeeded'
|
||||||
do
|
do
|
||||||
echo "Database not up yet, waiting..."
|
echo "Database not up yet, waiting..."
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
|
|
||||||
#rebind the service
|
# rebind the service
|
||||||
cf bind-service getgov-$DESTINATION_ENVIRONMENT getgov-$DESTINATION_ENVIRONMENT-database
|
cf bind-service getgov-$DESTINATION_ENVIRONMENT getgov-$DESTINATION_ENVIRONMENT-database
|
||||||
#restage the app or it will not connect to the database right for the next commands
|
#restage the app or it will not connect to the database right for the next commands
|
||||||
cf restage getgov-$DESTINATION_ENVIRONMENT
|
cf restage getgov-$DESTINATION_ENVIRONMENT
|
||||||
#wait for the above command to finish
|
# wait for the above command to finish
|
||||||
#if it is taking way to long and the annoying “instance starting” line that keeps repeating, then run following two commands in a separate window. This will interrupt the death loop where it keeps hitting an error with it failing health checks
|
# if it is taking way to long and the annoying “instance starting” line that keeps repeating, then run following two commands in a separate window. This will interrupt the death loop where it keeps hitting an error with it failing health checks
|
||||||
#create the cache table and run migrations
|
# create the cache table and run migrations
|
||||||
cf run-task getgov-$DESTINATION_ENVIRONMENT --command 'python manage.py createcachetable' --name createcachetable
|
cf run-task getgov-$DESTINATION_ENVIRONMENT --command 'python manage.py createcachetable' --name createcachetable
|
||||||
cf run-task getgov-$DESTINATION_ENVIRONMENT --wait --command 'python manage.py migrate' --name migrate
|
cf run-task getgov-$DESTINATION_ENVIRONMENT --wait --command 'python manage.py migrate' --name migrate
|
||||||
|
|
||||||
#load fixtures
|
# load fixtures
|
||||||
cf run-task getgov-$DESTINATION_ENVIRONMENT --wait --command 'python manage.py load' --name loaddata
|
cf run-task getgov-$DESTINATION_ENVIRONMENT --wait --command 'python manage.py load' --name loaddata
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue