mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Build db migration codedeploy artifact
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
if [ -e "/home/notify-app" ]
|
||||
then
|
||||
echo "Chown application to be owned by notify-app"
|
||||
cd /home/notify-app/;
|
||||
chown -R notify-app:govuk-notify-applications notifications-api
|
||||
else
|
||||
echo "Chown application to be owned by ubuntu"
|
||||
cd /home/ubuntu/;
|
||||
chown -R ubuntu:ubuntu notifications-api
|
||||
fi
|
||||
echo "Chown application to be owned by notify-app"
|
||||
|
||||
cd /home/notify-app/;
|
||||
chown -R notify-app:govuk-notify-applications notifications-api
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
echo "Install dependencies"
|
||||
|
||||
|
||||
if [ -e "/home/notify-app" ]
|
||||
then
|
||||
echo "Depenencies for notify-app"
|
||||
cd /home/notify-app/notifications-api;
|
||||
pip3 install -r /home/notify-app/notifications-api/requirements.txt
|
||||
python3 db.py db upgrade
|
||||
else
|
||||
echo "Depenencies for ubuntu"
|
||||
cd /home/ubuntu/notifications-api;
|
||||
pip3 install -r /home/ubuntu/notifications-api/requirements.txt
|
||||
python3 db.py db upgrade
|
||||
fi
|
||||
cd /home/notify-app/notifications-api;
|
||||
pip3 install -r /home/notify-app/notifications-api/requirements.txt
|
||||
|
||||
8
scripts/aws_run_db_migrations.sh
Executable file
8
scripts/aws_run_db_migrations.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
echo "Run database migrations"
|
||||
|
||||
cd /home/notify-app/notifications-api;
|
||||
python3 db.py db upgrade
|
||||
@@ -1,31 +1,19 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -e "/etc/init/notifications-api.conf" ]
|
||||
then
|
||||
echo "Starting api"
|
||||
sudo service notifications-api start
|
||||
fi
|
||||
set -eo pipefail
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker.conf" ]
|
||||
then
|
||||
echo "Starting celery worker"
|
||||
sudo service notifications-api-celery-worker start
|
||||
fi
|
||||
function start
|
||||
{
|
||||
service=$1
|
||||
if [ -e "/etc/init/${service}.conf" ]
|
||||
then
|
||||
echo "Starting ${service}"
|
||||
service ${service} start
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker-sender.conf" ]
|
||||
then
|
||||
echo "Starting celery worker"
|
||||
sudo service notifications-api-celery-worker-sender start
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker-db.conf" ]
|
||||
then
|
||||
echo "Starting celery worker"
|
||||
sudo service notifications-api-celery-worker-db start
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-beat.conf" ]
|
||||
then
|
||||
echo "Starting celery beat"
|
||||
sudo service notifications-api-celery-beat start
|
||||
fi
|
||||
start "notifications-api"
|
||||
start "notifications-api-celery-worker"
|
||||
start "notifications-api-celery-worker-sender"
|
||||
start "notifications-api-celery-worker-db"
|
||||
start "notifications-api-celery-beat"
|
||||
|
||||
@@ -1,53 +1,22 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
function error_exit
|
||||
function stop
|
||||
{
|
||||
echo "$1" 1>&2
|
||||
exit 0
|
||||
service=$1
|
||||
if [ -e "/etc/init/${service}.conf" ]; then
|
||||
echo "stopping ${service}"
|
||||
if service ${service} stop; then
|
||||
echo "${service} stopped"
|
||||
else
|
||||
>&2 echo "Could not stop ${service}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -e "/etc/init/notifications-api.conf" ]; then
|
||||
echo "stopping notifications-api"
|
||||
if sudo service notifications-api stop; then
|
||||
echo "notifications-api stopped"
|
||||
else
|
||||
error_exit "Could not stop notifications-api"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-beat.conf" ]; then
|
||||
echo "stopping notifications-api-celery-beat"
|
||||
if sudo service notifications-api-celery-beat stop; then
|
||||
echo "notifications-api beat stopped"
|
||||
else
|
||||
error_exit "Could not stop notifications-celery-beat"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker.conf" ]; then
|
||||
echo "stopping notifications-api-celery-worker"
|
||||
if sudo service notifications-api-celery-worker stop; then
|
||||
echo "notifications-api worker stopped"
|
||||
else
|
||||
error_exit "Could not stop notifications-celery-worker"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker-sender.conf" ]; then
|
||||
echo "stopping notifications-api-celery-worker-sender"
|
||||
if sudo service notifications-api-celery-worker-sender stop; then
|
||||
echo "notifications-api sender worker stopped"
|
||||
else
|
||||
error_exit "Could not stop notifications-celery-worker-sender"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init/notifications-api-celery-worker-db.conf" ]; then
|
||||
echo "stopping notifications-api-celery-worker-db"
|
||||
if sudo service notifications-api-celery-worker-db stop; then
|
||||
echo "notifications-api db worker stopped"
|
||||
else
|
||||
error_exit "Could not stop notifications-celery-worker-db"
|
||||
fi
|
||||
fi
|
||||
stop "notifications-api"
|
||||
stop "notifications-api-celery-beat"
|
||||
stop "notifications-api-celery-worker"
|
||||
stop "notifications-api-celery-worker-sender"
|
||||
stop "notifications-api-celery-worker-db"
|
||||
|
||||
Reference in New Issue
Block a user