mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-09 14:45:00 -05:00
Workflows for enabling production space deploys
This commit is contained in:
87
.github/workflows/deploy-prod.yml
vendored
Normal file
87
.github/workflows/deploy-prod.yml
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
name: Deploy to production environment
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ production ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: production
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Check for changes to Terraform
|
||||||
|
id: changed-terraform-files
|
||||||
|
uses: tj-actions/changed-files@v1.1.2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
terraform/production
|
||||||
|
terraform/shared
|
||||||
|
.github/workflows/deploy-prod.yml
|
||||||
|
- name: Terraform init
|
||||||
|
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||||
|
working-directory: terraform/production
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||||
|
run: terraform init
|
||||||
|
- name: Terraform apply
|
||||||
|
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||||
|
working-directory: terraform/production
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||||
|
TF_VAR_cf_user: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||||
|
TF_VAR_cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
||||||
|
run: terraform apply -auto-approve -input=false
|
||||||
|
|
||||||
|
- uses: ./.github/actions/setup-project
|
||||||
|
|
||||||
|
- name: Create requirements.txt because Cloud Foundry does a weird pipenv thing
|
||||||
|
run: pipenv requirements > requirements.txt
|
||||||
|
|
||||||
|
- name: Deploy to cloud.gov
|
||||||
|
uses: 18f/cg-deploy-action@main
|
||||||
|
env:
|
||||||
|
DANGEROUS_SALT: ${{ secrets.DANGEROUS_SALT }}
|
||||||
|
SECRET_KEY: ${{ secrets.SECRET_KEY }}
|
||||||
|
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
|
||||||
|
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
|
||||||
|
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
|
||||||
|
NR_BROWSER_KEY: ${{ secrets.NR_BROWSER_KEY }}
|
||||||
|
with:
|
||||||
|
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||||
|
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
||||||
|
cf_org: gsa-tts-benefits-studio-prototyping
|
||||||
|
cf_space: notify-production
|
||||||
|
push_arguments: >-
|
||||||
|
--vars-file deploy-config/production.yml
|
||||||
|
--var DANGEROUS_SALT="$DANGEROUS_SALT"
|
||||||
|
--var SECRET_KEY="$SECRET_KEY"
|
||||||
|
--var ADMIN_CLIENT_USERNAME="notify-admin"
|
||||||
|
--var ADMIN_CLIENT_SECRET="$ADMIN_CLIENT_SECRET"
|
||||||
|
--var BASIC_AUTH_USERNAME="curiousabout"
|
||||||
|
--var BASIC_AUTH_PASSWORD="$BASIC_AUTH_PASSWORD"
|
||||||
|
--var NEW_RELIC_LICENSE_KEY="$NEW_RELIC_LICENSE_KEY"
|
||||||
|
--var NR_BROWSER_KEY="$NR_BROWSER_KEY"
|
||||||
|
|
||||||
|
- name: Check for changes to egress config
|
||||||
|
id: changed-egress-config
|
||||||
|
uses: tj-actions/changed-files@v34
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
deploy-config/egress_proxy/notify-admin-production.*.acl
|
||||||
|
.github/actions/deploy-proxy/action.yml
|
||||||
|
.github/workflows/deploy-prod.yml
|
||||||
|
- name: Deploy egress proxy
|
||||||
|
if: steps.changed-egress-config.outputs.any_changed == 'true'
|
||||||
|
uses: ./.github/actions/deploy-proxy
|
||||||
|
with:
|
||||||
|
cf_space: notify-production
|
||||||
|
app: notify-admin-production
|
||||||
36
.github/workflows/drift.yml
vendored
36
.github/workflows/drift.yml
vendored
@@ -45,22 +45,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: terraform/demo
|
path: terraform/demo
|
||||||
|
|
||||||
# check_prod_drift:
|
check_prod_drift:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# name: Check for drift of production terraform configuration
|
name: Check for drift of production terraform configuration
|
||||||
# environment: production
|
environment: production
|
||||||
# steps:
|
steps:
|
||||||
# - name: Checkout
|
- name: Checkout
|
||||||
# uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
# with:
|
with:
|
||||||
# ref: 'production'
|
ref: 'production'
|
||||||
|
|
||||||
# - name: Check for drift
|
- name: Check for drift
|
||||||
# uses: dflook/terraform-check@v1
|
uses: dflook/terraform-check@v1
|
||||||
# env:
|
env:
|
||||||
# AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||||
# TF_VAR_cf_user: ${{ secrets.CLOUDGOV_USERNAME }}
|
TF_VAR_cf_user: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||||
# TF_VAR_cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
TF_VAR_cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
|
||||||
# with:
|
with:
|
||||||
# path: terraform/production
|
path: terraform/production
|
||||||
|
|||||||
2
.github/workflows/terraform-production.yml
vendored
2
.github/workflows/terraform-production.yml
vendored
@@ -2,7 +2,7 @@ name: Run Terraform plan in production
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ production-disabled-for-now ]
|
branches: [ production ]
|
||||||
paths: [ 'terraform/**' ]
|
paths: [ 'terraform/**' ]
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
gov-collector.newrelic.com
|
||||||
|
egress-proxy-notify-admin-production.apps.internal
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Update this file to force a re-deploy of the egress proxy even when notify-admin-production.<allow|deny>.acl haven't changed
|
||||||
@@ -13,7 +13,7 @@ module "redis" {
|
|||||||
cf_space_name = local.cf_space_name
|
cf_space_name = local.cf_space_name
|
||||||
name = "${local.app_name}-redis-${local.env}"
|
name = "${local.app_name}-redis-${local.env}"
|
||||||
recursive_delete = local.recursive_delete
|
recursive_delete = local.recursive_delete
|
||||||
redis_plan_name = "TKTK-production-redis-plan"
|
redis_plan_name = "redis-3node-large"
|
||||||
}
|
}
|
||||||
|
|
||||||
module "logo_upload_bucket" {
|
module "logo_upload_bucket" {
|
||||||
@@ -45,7 +45,7 @@ module "logo_upload_bucket" {
|
|||||||
# It can be re-enabled after:
|
# It can be re-enabled after:
|
||||||
# 1) the app has first been deployed
|
# 1) the app has first been deployed
|
||||||
# 2) the route has been manually created by an OrgManager:
|
# 2) the route has been manually created by an OrgManager:
|
||||||
# `cf create-domain TKTK-org-name TKTK-production-domain-name`
|
# `cf create-domain gsa-tts-benefits-studio-prototyping beta.notify.gov`
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# module "domain" {
|
# module "domain" {
|
||||||
# source = "github.com/18f/terraform-cloudgov//domain?ref=v0.2.0"
|
# source = "github.com/18f/terraform-cloudgov//domain?ref=v0.2.0"
|
||||||
@@ -56,5 +56,5 @@ module "logo_upload_bucket" {
|
|||||||
# name = "${local.app_name}-domain-${local.env}"
|
# name = "${local.app_name}-domain-${local.env}"
|
||||||
# recursive_delete = local.recursive_delete
|
# recursive_delete = local.recursive_delete
|
||||||
# cdn_plan_name = "domain"
|
# cdn_plan_name = "domain"
|
||||||
# domain_name = "TKTK-production-domain-name"
|
# domain_name = "beta.notify.gov"
|
||||||
# }
|
# }
|
||||||
|
|||||||
Reference in New Issue
Block a user