-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds grabbing sling into the mix
- Loading branch information
Showing
7 changed files
with
147 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,135 @@ | ||
--- | ||
name: Deploy application to cloud.gov | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
push-with-creds: | ||
name: Deploy to cloud.gov with updated credentials | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
env: | ||
space: ${{ inputs.environment }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore npm cache | ||
uses: actions/cache@v4 | ||
id: cache-npm | ||
with: | ||
path: ~/.npm | ||
key: fac-build-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
fac-build-npm- | ||
fac-build- | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Restore pip cache | ||
uses: actions/cache@v4 | ||
id: cache-pip | ||
with: | ||
path: | | ||
~/.cache/pip | ||
/opt/hostedtoolcache/Python/ | ||
key: fac-build-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev-requirements.txt') }} | ||
restore-keys: | | ||
fac-build-pip-${{ hashFiles('**/requirements.txt') }}- | ||
fac-build-pip- | ||
fac-build- | ||
- name: Install npm dependencies | ||
working-directory: ./backend | ||
run: npm ci --production | ||
|
||
- name: Compile JS/CSS assets | ||
working-directory: ./backend | ||
run: npm run build | ||
|
||
- name: Update service keys | ||
uses: cloud-gov/cg-cli-tools@main | ||
env: | ||
SAM_API_KEY: ${{ secrets.SAM_API_KEY }} | ||
DJANGO_SECRET_LOGIN_KEY: $${{ secrets.DJANGO_SECRET_LOGIN_KEY }} | ||
LOGIN_CLIENT_ID: $${{ secrets.LOGIN_CLIENT_ID }} | ||
SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_command: update-user-provided-service fac-key-service -p '"{\"SAM_API_KEY\":\"${{ secrets.SAM_API_KEY }}\", \"DJANGO_SECRET_LOGIN_KEY\":\"${{ secrets.DJANGO_SECRET_LOGIN_KEY }}\", \"LOGIN_CLIENT_ID\":\"${{ secrets.LOGIN_CLIENT_ID }}\", \"SECRET_KEY\":\"${{ secrets.SECRET_KEY}}\"}"' | ||
|
||
- name: Backup the database | ||
# if: startsWith(github.ref, 'refs/tags/v1.') | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf run-task gsa-fac -k 7G -m 3G --name deploy_backup --command "./fac-backup-util.sh v0.1.5 deploy_backup" | ||
|
||
- name: Deploy Preview to cloud.gov | ||
if: ${{ inputs.environment == 'preview' }} | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_manifest: backend/manifests/manifest-preview.yml | ||
cf_vars_file: backend/manifests/vars/vars-${{ env.space }}.yml | ||
command: bin/ops/deploy_preview.sh | ||
|
||
- name: Deploy fac to cloud.gov | ||
if: ${{ inputs.environment != 'preview' }} | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_manifest: backend/manifests/manifest-fac.yml | ||
cf_vars_file: backend/manifests/vars/vars-${{ env.space }}.yml | ||
command: bin/ops/deploy.sh | ||
|
||
- name: Load historical data | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf run-task gsa-fac -k 6G -m 1G --name load_data --command "./load_data.sh" | ||
|
||
# This has to happen after an application deployment because the manifest (currently) is responsible | ||
# for binding the "logdrain service" to the "gsa-fac application". This also needs to be done | ||
# based on the suspicion that fluentbit cannot register the incoming logs when it is initially | ||
# created, resulting in a 502. Restarting the application after everything is configured results | ||
# in a 201, or, the expected status when transmitting logs. | ||
- name: Restart the logshipper application | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf restart logshipper | ||
|
||
--- | ||
name: Deploy application to cloud.gov | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
push-with-creds: | ||
name: Deploy to cloud.gov with updated credentials | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
env: | ||
space: ${{ inputs.environment }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore npm cache | ||
uses: actions/cache@v4 | ||
id: cache-npm | ||
with: | ||
path: ~/.npm | ||
key: fac-build-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
fac-build-npm- | ||
fac-build- | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Restore pip cache | ||
uses: actions/cache@v4 | ||
id: cache-pip | ||
with: | ||
path: | | ||
~/.cache/pip | ||
/opt/hostedtoolcache/Python/ | ||
key: fac-build-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev-requirements.txt') }} | ||
restore-keys: | | ||
fac-build-pip-${{ hashFiles('**/requirements.txt') }}- | ||
fac-build-pip- | ||
fac-build- | ||
- name: Install npm dependencies | ||
working-directory: ./backend | ||
run: npm ci --production | ||
|
||
- name: Compile JS/CSS assets | ||
working-directory: ./backend | ||
run: npm run build | ||
|
||
- name: Grab sling for copying data from DB1 to DB2 | ||
working-directory: ./backend | ||
run: | | ||
curl -L -O https://github.com/slingdata-io/sling-cli/releases/download/v1.2.20/sling_linux_amd64.tar.gz | ||
tar xzf sling_linux_amd64.tar.gz | ||
chmod 755 sling | ||
- name: Update service keys | ||
uses: cloud-gov/cg-cli-tools@main | ||
env: | ||
SAM_API_KEY: ${{ secrets.SAM_API_KEY }} | ||
DJANGO_SECRET_LOGIN_KEY: $${{ secrets.DJANGO_SECRET_LOGIN_KEY }} | ||
LOGIN_CLIENT_ID: $${{ secrets.LOGIN_CLIENT_ID }} | ||
SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_command: update-user-provided-service fac-key-service -p '"{\"SAM_API_KEY\":\"${{ secrets.SAM_API_KEY }}\", \"DJANGO_SECRET_LOGIN_KEY\":\"${{ secrets.DJANGO_SECRET_LOGIN_KEY }}\", \"LOGIN_CLIENT_ID\":\"${{ secrets.LOGIN_CLIENT_ID }}\", \"SECRET_KEY\":\"${{ secrets.SECRET_KEY}}\"}"' | ||
|
||
- name: Backup the database | ||
# if: startsWith(github.ref, 'refs/tags/v1.') | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf run-task gsa-fac -k 7G -m 3G --name deploy_backup --command "./fac-backup-util.sh v0.1.5 deploy_backup" | ||
|
||
- name: Deploy Preview to cloud.gov | ||
if: ${{ inputs.environment == 'preview' }} | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_manifest: backend/manifests/manifest-preview.yml | ||
cf_vars_file: backend/manifests/vars/vars-${{ env.space }}.yml | ||
command: bin/ops/deploy_preview.sh | ||
|
||
- name: Deploy fac to cloud.gov | ||
if: ${{ inputs.environment != 'preview' }} | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
cf_manifest: backend/manifests/manifest-fac.yml | ||
cf_vars_file: backend/manifests/vars/vars-${{ env.space }}.yml | ||
command: bin/ops/deploy.sh | ||
|
||
- name: Load historical data | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf run-task gsa-fac -k 6G -m 1G --name load_data --command "./load_data.sh" | ||
|
||
# This has to happen after an application deployment because the manifest (currently) is responsible | ||
# for binding the "logdrain service" to the "gsa-fac application". This also needs to be done | ||
# based on the suspicion that fluentbit cannot register the incoming logs when it is initially | ||
# created, resulting in a 502. Restarting the application after everything is configured results | ||
# in a 201, or, the expected status when transmitting logs. | ||
- name: Restart the logshipper application | ||
uses: cloud-gov/cg-cli-tools@main | ||
with: | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: gsa-tts-oros-fac | ||
cf_space: ${{ env.space }} | ||
command: cf restart logshipper | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# run this once in each env | ||
# after we deploy the new API and everything | ||
# is happy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.