mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
added infra for litterbox and hotgov sandboxes
This commit is contained in:
parent
e15f1b2cdf
commit
2e5510a0c6
7 changed files with 163 additions and 91 deletions
2
.github/workflows/deploy-sandbox.yaml
vendored
2
.github/workflows/deploy-sandbox.yaml
vendored
|
@ -25,6 +25,8 @@ jobs:
|
||||||
|| startsWith(github.head_ref, 'meoward/')
|
|| startsWith(github.head_ref, 'meoward/')
|
||||||
|| startsWith(github.head_ref, 'bob/')
|
|| startsWith(github.head_ref, 'bob/')
|
||||||
|| startsWith(github.head_ref, 'cb/')
|
|| startsWith(github.head_ref, 'cb/')
|
||||||
|
|| startsWith(github.head_ref, 'hotgov/')
|
||||||
|
|| startsWith(github.head_ref, 'litterbox/')
|
||||||
outputs:
|
outputs:
|
||||||
environment: ${{ steps.var.outputs.environment}}
|
environment: ${{ steps.var.outputs.environment}}
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
2
.github/workflows/migrate.yaml
vendored
2
.github/workflows/migrate.yaml
vendored
|
@ -16,6 +16,8 @@ on:
|
||||||
- stable
|
- stable
|
||||||
- staging
|
- staging
|
||||||
- development
|
- development
|
||||||
|
- litterbox
|
||||||
|
- hotgov
|
||||||
- cb
|
- cb
|
||||||
- bob
|
- bob
|
||||||
- meoward
|
- meoward
|
||||||
|
|
2
.github/workflows/reset-db.yaml
vendored
2
.github/workflows/reset-db.yaml
vendored
|
@ -16,6 +16,8 @@ on:
|
||||||
options:
|
options:
|
||||||
- staging
|
- staging
|
||||||
- development
|
- development
|
||||||
|
- litterbox
|
||||||
|
- hotgov
|
||||||
- cb
|
- cb
|
||||||
- bob
|
- bob
|
||||||
- meoward
|
- meoward
|
||||||
|
|
32
ops/manifests/manifest-hotgov.yaml
Normal file
32
ops/manifests/manifest-hotgov.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
applications:
|
||||||
|
- name: getgov-hotgov
|
||||||
|
buildpacks:
|
||||||
|
- python_buildpack
|
||||||
|
path: ../../src
|
||||||
|
instances: 1
|
||||||
|
memory: 512M
|
||||||
|
stack: cflinuxfs4
|
||||||
|
timeout: 180
|
||||||
|
command: ./run.sh
|
||||||
|
health-check-type: http
|
||||||
|
health-check-http-endpoint: /health
|
||||||
|
health-check-invocation-timeout: 40
|
||||||
|
env:
|
||||||
|
# Send stdout and stderr straight to the terminal without buffering
|
||||||
|
PYTHONUNBUFFERED: yup
|
||||||
|
# Tell Django where to find its configuration
|
||||||
|
DJANGO_SETTINGS_MODULE: registrar.config.settings
|
||||||
|
# Tell Django where it is being hosted
|
||||||
|
DJANGO_BASE_URL: https://getgov-hotgov.app.cloud.gov
|
||||||
|
# Tell Django how much stuff to log
|
||||||
|
DJANGO_LOG_LEVEL: INFO
|
||||||
|
# default public site location
|
||||||
|
GETGOV_PUBLIC_SITE_URL: https://get.gov
|
||||||
|
# Flag to disable/enable features in prod environments
|
||||||
|
IS_PRODUCTION: False
|
||||||
|
routes:
|
||||||
|
- route: getgov-hotgov.app.cloud.gov
|
||||||
|
services:
|
||||||
|
- getgov-credentials
|
||||||
|
- getgov-hotgov-database
|
32
ops/manifests/manifest-litterbox.yaml
Normal file
32
ops/manifests/manifest-litterbox.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
applications:
|
||||||
|
- name: getgov-litterbox
|
||||||
|
buildpacks:
|
||||||
|
- python_buildpack
|
||||||
|
path: ../../src
|
||||||
|
instances: 1
|
||||||
|
memory: 512M
|
||||||
|
stack: cflinuxfs4
|
||||||
|
timeout: 180
|
||||||
|
command: ./run.sh
|
||||||
|
health-check-type: http
|
||||||
|
health-check-http-endpoint: /health
|
||||||
|
health-check-invocation-timeout: 40
|
||||||
|
env:
|
||||||
|
# Send stdout and stderr straight to the terminal without buffering
|
||||||
|
PYTHONUNBUFFERED: yup
|
||||||
|
# Tell Django where to find its configuration
|
||||||
|
DJANGO_SETTINGS_MODULE: registrar.config.settings
|
||||||
|
# Tell Django where it is being hosted
|
||||||
|
DJANGO_BASE_URL: https://getgov-litterbox.app.cloud.gov
|
||||||
|
# Tell Django how much stuff to log
|
||||||
|
DJANGO_LOG_LEVEL: INFO
|
||||||
|
# default public site location
|
||||||
|
GETGOV_PUBLIC_SITE_URL: https://get.gov
|
||||||
|
# Flag to disable/enable features in prod environments
|
||||||
|
IS_PRODUCTION: False
|
||||||
|
routes:
|
||||||
|
- route: getgov-litterbox.app.cloud.gov
|
||||||
|
services:
|
||||||
|
- getgov-credentials
|
||||||
|
- getgov-litterbox-database
|
|
@ -7,118 +7,118 @@ if [ -z "$1" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! $(command -v gh) ] || [ ! $(command -v jq) ] || [ ! $(command -v cf) ]; then
|
# if [ ! $(command -v gh) ] || [ ! $(command -v jq) ] || [ ! $(command -v cf) ]; then
|
||||||
echo "jq, cf, and gh packages must be installed. Please install via your preferred manager."
|
# echo "jq, cf, and gh packages must be installed. Please install via your preferred manager."
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
upcase_name=$(printf "%s" "$1" | tr '[:lower:]' '[:upper:]')
|
upcase_name=$(printf "%s" "$1" | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
read -p "Are you on a new branch? We will have to commit this work. (y/n) " -n 1 -r
|
# read -p "Are you on a new branch? We will have to commit this work. (y/n) " -n 1 -r
|
||||||
echo
|
# echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
# if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
# then
|
||||||
git checkout -b new-dev-sandbox-$1
|
# git checkout -b new-dev-sandbox-$1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
cf target -o cisa-dotgov
|
# cf target -o cisa-dotgov
|
||||||
|
|
||||||
read -p "Are you logged in to the cisa-dotgov CF org above? (y/n) " -n 1 -r
|
# read -p "Are you logged in to the cisa-dotgov CF org above? (y/n) " -n 1 -r
|
||||||
echo
|
# echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
# if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
# then
|
||||||
cf login -a https://api.fr.cloud.gov --sso
|
# cf login -a https://api.fr.cloud.gov --sso
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
gh auth status
|
# gh auth status
|
||||||
read -p "Are you logged into a Github account with access to cisagov/getgov? (y/n) " -n 1 -r
|
# read -p "Are you logged into a Github account with access to cisagov/getgov? (y/n) " -n 1 -r
|
||||||
echo
|
# echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
# if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
# then
|
||||||
gh auth login
|
# gh auth login
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "Creating manifest for $1..."
|
# echo "Creating manifest for $1..."
|
||||||
cp ops/scripts/manifest-sandbox-template.yaml ops/manifests/manifest-$1.yaml
|
# cp ops/scripts/manifest-sandbox-template.yaml ops/manifests/manifest-$1.yaml
|
||||||
sed -i '' "s/ENVIRONMENT/$1/" "ops/manifests/manifest-$1.yaml"
|
# sed -i '' "s/ENVIRONMENT/$1/" "ops/manifests/manifest-$1.yaml"
|
||||||
|
|
||||||
echo "Adding new environment to settings.py..."
|
# echo "Adding new environment to settings.py..."
|
||||||
sed -i '' '/getgov-development.app.cloud.gov/ {a\
|
# sed -i '' '/getgov-development.app.cloud.gov/ {a\
|
||||||
'\"getgov-$1.app.cloud.gov\"',
|
# '\"getgov-$1.app.cloud.gov\"',
|
||||||
}' src/registrar/config/settings.py
|
# }' src/registrar/config/settings.py
|
||||||
|
|
||||||
echo "Creating new cloud.gov space for $1..."
|
# echo "Creating new cloud.gov space for $1..."
|
||||||
cf create-space $1
|
# cf create-space $1
|
||||||
cf target -o "cisa-dotgov" -s $1
|
# cf target -o "cisa-dotgov" -s $1
|
||||||
cf bind-security-group public_networks_egress cisa-dotgov --space $1
|
# cf bind-security-group public_networks_egress cisa-dotgov --space $1
|
||||||
cf bind-security-group trusted_local_networks_egress cisa-dotgov --space $1
|
# cf bind-security-group trusted_local_networks_egress cisa-dotgov --space $1
|
||||||
|
|
||||||
echo "Creating new cloud.gov DB for $1. This usually takes about 5 minutes..."
|
# echo "Creating new cloud.gov DB for $1. This usually takes about 5 minutes..."
|
||||||
cf create-service aws-rds micro-psql getgov-$1-database
|
# cf create-service aws-rds micro-psql getgov-$1-database
|
||||||
|
|
||||||
until cf service getgov-$1-database | grep -q 'The service instance status is succeeded'
|
# until cf service getgov-$1-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
|
||||||
|
|
||||||
echo "Creating new cloud.gov credentials for $1..."
|
# echo "Creating new cloud.gov credentials for $1..."
|
||||||
django_key=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
|
# django_key=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
|
||||||
openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private-$1.pem -out public-$1.crt
|
# openssl req -nodes -x509 -days 365 -newkey rsa:2048 -keyout private-$1.pem -out public-$1.crt
|
||||||
login_key=$(base64 -i private-$1.pem)
|
# login_key=$(base64 -i private-$1.pem)
|
||||||
jq -n --arg django_key "$django_key" --arg login_key "$login_key" '{"DJANGO_SECRET_KEY":$django_key,"DJANGO_SECRET_LOGIN_KEY":$login_key}' > credentials-$1.json
|
# jq -n --arg django_key "$django_key" --arg login_key "$login_key" '{"DJANGO_SECRET_KEY":$django_key,"DJANGO_SECRET_LOGIN_KEY":$login_key}' > credentials-$1.json
|
||||||
cf cups getgov-credentials -p credentials-$1.json
|
# cf cups getgov-credentials -p credentials-$1.json
|
||||||
|
|
||||||
echo "Now you will need to update some things for Login. Please sign-in to https://dashboard.int.identitysandbox.gov/."
|
# echo "Now you will need to update some things for Login. Please sign-in to https://dashboard.int.identitysandbox.gov/."
|
||||||
echo "Navigate to our application config: https://dashboard.int.identitysandbox.gov/service_providers/2640/edit?"
|
# echo "Navigate to our application config: https://dashboard.int.identitysandbox.gov/service_providers/2640/edit?"
|
||||||
echo "There are two things to update."
|
# echo "There are two things to update."
|
||||||
echo "1. You need to upload the public-$1.crt file generated as part of the previous command."
|
# echo "1. You need to upload the public-$1.crt file generated as part of the previous command."
|
||||||
echo "2. You need to add two redirect URIs: https://getgov-$1.app.cloud.gov/openid/callback/login/ and
|
# echo "2. You need to add two redirect URIs: https://getgov-$1.app.cloud.gov/openid/callback/login/ and
|
||||||
https://getgov-$1.app.cloud.gov/openid/callback/logout/ to the list of URIs."
|
# https://getgov-$1.app.cloud.gov/openid/callback/logout/ to the list of URIs."
|
||||||
read -p "Please confirm when this is done (y/n) " -n 1 -r
|
# read -p "Please confirm when this is done (y/n) " -n 1 -r
|
||||||
echo
|
# echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
# if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
# then
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "Database create succeeded and credentials created. Deploying the get.gov application to the new space $1..."
|
# echo "Database create succeeded and credentials created. Deploying the get.gov application to the new space $1..."
|
||||||
echo "Building assets..."
|
# echo "Building assets..."
|
||||||
open -a Docker
|
# open -a Docker
|
||||||
cd src/
|
# cd src/
|
||||||
./build.sh
|
# ./build.sh
|
||||||
cd ..
|
# cd ..
|
||||||
cf push getgov-$1 -f ops/manifests/manifest-$1.yaml
|
# cf push getgov-$1 -f ops/manifests/manifest-$1.yaml
|
||||||
|
|
||||||
echo "Creating cache table..."
|
# echo "Creating cache table..."
|
||||||
cf run-task getgov-$1 --command 'python manage.py createcachetable' --name createcachetable
|
# cf run-task getgov-$1 --command 'python manage.py createcachetable' --name createcachetable
|
||||||
|
|
||||||
read -p "Please provide the email of the space developer: " -r
|
# read -p "Please provide the email of the space developer: " -r
|
||||||
cf set-space-role $REPLY cisa-dotgov $1 SpaceDeveloper
|
# cf set-space-role $REPLY cisa-dotgov $1 SpaceDeveloper
|
||||||
|
|
||||||
read -p "Should we run migrations? (y/n) " -n 1 -r
|
# read -p "Should we run migrations? (y/n) " -n 1 -r
|
||||||
echo
|
# echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
# if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
# then
|
||||||
cf run-task getgov-$1 --command 'python manage.py migrate' --name migrate
|
# cf run-task getgov-$1 --command 'python manage.py migrate' --name migrate
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "Alright, your app is up and running at https://getgov-$1.app.cloud.gov!"
|
# echo "Alright, your app is up and running at https://getgov-$1.app.cloud.gov!"
|
||||||
echo
|
# echo
|
||||||
echo "Moving on to setup Github automation..."
|
# echo "Moving on to setup Github automation..."
|
||||||
|
|
||||||
echo "Adding new environment to Github Actions..."
|
# echo "Adding new environment to Github Actions..."
|
||||||
sed -i '' '/ - development/ {a\
|
# sed -i '' '/ - development/ {a\
|
||||||
- '"$1"'
|
# - '"$1"'
|
||||||
}' .github/workflows/reset-db.yaml
|
# }' .github/workflows/reset-db.yaml
|
||||||
|
|
||||||
sed -i '' '/ - development/ {a\
|
# sed -i '' '/ - development/ {a\
|
||||||
- '"$1"'
|
# - '"$1"'
|
||||||
}' .github/workflows/migrate.yaml
|
# }' .github/workflows/migrate.yaml
|
||||||
|
|
||||||
sed -i '' '/${{startsWith(github.head_ref, / {a\
|
# sed -i '' '/${{startsWith(github.head_ref, / {a\
|
||||||
|| startsWith(github.head_ref, '"'$1'"')
|
# || startsWith(github.head_ref, '"'$1'"')
|
||||||
}' .github/workflows/deploy-sandbox.yaml
|
# }' .github/workflows/deploy-sandbox.yaml
|
||||||
|
|
||||||
echo "Creating space deployer for Github deploys..."
|
echo "Creating space deployer for Github deploys..."
|
||||||
cf create-service cloud-gov-service-account space-deployer github-cd-account
|
cf create-service cloud-gov-service-account space-deployer github-cd-account
|
||||||
|
|
|
@ -659,6 +659,8 @@ ALLOWED_HOSTS = [
|
||||||
"getgov-stable.app.cloud.gov",
|
"getgov-stable.app.cloud.gov",
|
||||||
"getgov-staging.app.cloud.gov",
|
"getgov-staging.app.cloud.gov",
|
||||||
"getgov-development.app.cloud.gov",
|
"getgov-development.app.cloud.gov",
|
||||||
|
"getgov-litterbox.app.cloud.gov",
|
||||||
|
"getgov-hotgov.app.cloud.gov",
|
||||||
"getgov-cb.app.cloud.gov",
|
"getgov-cb.app.cloud.gov",
|
||||||
"getgov-bob.app.cloud.gov",
|
"getgov-bob.app.cloud.gov",
|
||||||
"getgov-meoward.app.cloud.gov",
|
"getgov-meoward.app.cloud.gov",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue