generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP vnet work * Fixing names * Fixing names 2 * Move network stuff to net.tf * Try creating some subnets * The database should use the new database subnet * The app should use the new app subnet * Only do zone balancing in the higher environments where we have at least 3 containers * Use dev vnet range * Give the app subnet ability to use Azure internal routing * Assign the route table to the new subnets * Assign the security group to the new subnets * delegate the app subnet to serverFarms * Add HTTP and Postgres security rule * Remove extra security rule * separate out HTTPS and HTTP security rule * Update security rule priorities * Comment out db migration so deploy can continue * Updating network terraform to remove routes and security groups * Adding security group and rules * Formatting * Fixing name for security group * Fixing lists * Fixing tags * Testing re-adding flyway * Nope still broken * Adding app security group and rules * Fixing dupe name issue * Fixing outbound * Adding ip logging temp * Removing virtual network link as test * Removing admin * Specify IP restrictions for denying all external traffic * advanced tool site also uses main site stuff * Adding 1 admin * Removing admin * Adding Ad and 1 service_delegation action * Adding NSG * Adding NSG * Removing old public firewall rule * Adding 1 admin * Use a smaller NSG * Adding dependency for db * Add a route table to direct entra traffic to the Internet * Bring back api admin for db * link the DNS zone with the vnet * Reduce size of db NSG * Rename some of the db nsg rules * Rename and slim down the app nsg rules * Remove commented out blocks * Rename database route table * Rename the db route table again * Remove the NSG auth rule * Terraform fmt * Re-adding migrations * Re-adding migrations * Adding deployer * Try creating a VPN * Try VPNing into Azure to do database migrations * v2.0.2 of the OVPN github action * Put the configuration back on the VPN * Different path to the OVPN file * ping the database * debug dig * Install liquibase manually without GitHub action that ignores the VPN * change working directory to the top level * Clean-up and fail the GitHub action if VPN is not connected * Update DB rollback GitHub action * dig debug on rollback * debug in wrong location * Ue correct secrets * Rename secrets to be more uniform * Adding vpn subnets and dns resolver * Renaming cert * Giving ip to inbound endpoint * Setting dns resolver ip to dynamic * Adding subnets dynamically * Adding dev secrets * Specify VPN root certificate per environment * Fixing internal * Add empty VPN root certificate to the internal and pr environments * Use generic secret names that will be per-environment thanks to GitHub * Marking vpn as not required * Mark the VPN secrets as optional for the Terraform deploy * Do not do VPN with rollback of the internal environment * Updating terraform * Updating terraform to remove conditions * Updating terraform to remove conditions * Removing even more conditions * Don't do internal networking for app in internal and pr environments * Better dynamic site_config * Do not use a root certificate for the VPN if it is not specified * Up the dynamic store * Make the vnet resource when deploying to the PR environment * use a shared local variable for when the environment is in a CDC domain * Only do the VPN when not internal and not pr when deploying * Apply VPN secrets to the stg and prd environments deployment * Remove IP logging * Terraform format * Update terraform comment * Started writing documentation on interacting with the app service * Point to the VPN documentation * Have the security group associations wait for the VPN because these updates seem to be mutually exclusive * Terraform format * Change documentation for when a Flexion domain-hosted environment * Update link to VPN Notion documentation * Change the dependency of the VPN and subnet stuff --------- Co-authored-by: halprin <[email protected]>
- Loading branch information
1 parent
9f04eee
commit 2dbef42
Showing
20 changed files
with
632 additions
and
39 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
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 |
---|---|---|
|
@@ -64,11 +64,35 @@ jobs: | |
echo "DATABASE_HOSTNAME=$DATABASE_HOSTNAME" >> "$GITHUB_ENV" | ||
echo "DATABASE_PASSWORD=$DATABASE_PASSWORD" >> "$GITHUB_ENV" | ||
- name: Run Db Rollback | ||
uses: liquibase-github-actions/[email protected] | ||
- name: Connect to VPN | ||
uses: josiahsiegel/[email protected] | ||
id: connect_vpn | ||
if: github.event.inputs.environment != 'internal' | ||
with: | ||
changelogFile: ${{ github.event.inputs.rollbackFile }} | ||
count: ${{ github.event.inputs.rollbackCount }} | ||
url: "jdbc:postgresql://${{ env.DATABASE_HOSTNAME }}:5432/postgres" | ||
username: cdcti-github | ||
password: ${{ env.DATABASE_PASSWORD }} | ||
PING_URL: ${{ env.DATABASE_HOSTNAME }} | ||
FILE_OVPN: ./operations/vpn/${{ github.event.inputs.environment }}.ovpn | ||
TLS_KEY: ${{ secrets.VPN_TLS_KEY }} | ||
env: | ||
CA_CRT: ${{ secrets.VPN_CA_CERTIFICATE }} | ||
USER_CRT: ${{ secrets.VPN_GITHUB_CERTIFICATE }} | ||
USER_KEY: ${{ secrets.VPN_GITHUB_SECRET_KEY }} | ||
|
||
- name: Fail if VPN isn't Connected | ||
if: github.event.inputs.environment != 'internal' && steps.connect_vpn.outputs.STATUS != 'true' | ||
run: | | ||
echo 'VPN connected: ${{ steps.connect_vpn.outputs.STATUS }}' | ||
exit 1 | ||
- name: Install Liquibase | ||
run: | | ||
wget -O- https://repo.liquibase.com/liquibase.asc | gpg --dearmor > liquibase-keyring.gpg && \cat liquibase-keyring.gpg | sudo tee /usr/share/keyrings/liquibase-keyring.gpg > /dev/null && \echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/liquibase-keyring.gpg] https://repo.liquibase.com stable main' | sudo tee /etc/apt/sources.list.d/liquibase.list | ||
sudo apt-get update | ||
sudo apt-get install liquibase | ||
liquibase -v | ||
- name: Run Db migration | ||
run: liquibase rollback-count --changelog-file ${{ github.event.inputs.rollbackFile }} --count ${{ github.event.inputs.rollbackCount }} --url 'jdbc:postgresql://${{ env.DATABASE_HOSTNAME }}:5432/postgres' --username cdcti-github --password '${{ env.DATABASE_PASSWORD }}' | ||
|
||
- name: Disconnect VPN | ||
if: github.event.inputs.environment != 'internal' && always() | ||
run: sudo killall openvpn |
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 |
---|---|---|
|
@@ -24,6 +24,14 @@ on: | |
required: true | ||
AZURE_SUBSCRIPTION_ID: | ||
required: true | ||
VPN_TLS_KEY: | ||
required: false | ||
VPN_CA_CERTIFICATE: | ||
required: false | ||
VPN_GITHUB_CERTIFICATE: | ||
required: false | ||
VPN_GITHUB_SECRET_KEY: | ||
required: false | ||
outputs: | ||
REGISTRY: | ||
description: The container registry | ||
|
@@ -85,13 +93,39 @@ jobs: | |
echo "DATABASE_HOSTNAME=$DATABASE_HOSTNAME" >> "$GITHUB_ENV" | ||
echo "DATABASE_PASSWORD=$DATABASE_PASSWORD" >> "$GITHUB_ENV" | ||
- name: Run Db migration | ||
uses: liquibase-github-actions/[email protected] | ||
- name: Connect to VPN | ||
uses: josiahsiegel/[email protected] | ||
id: connect_vpn | ||
if: inputs.ENVIRONMENT != 'internal' && inputs.ENVIRONMENT != 'pr' | ||
with: | ||
changelogFile: ./etor/databaseMigrations/root.yml | ||
url: "jdbc:postgresql://${{ env.DATABASE_HOSTNAME }}:5432/postgres" | ||
username: cdcti-github | ||
password: ${{ env.DATABASE_PASSWORD }} | ||
PING_URL: ${{ env.DATABASE_HOSTNAME }} | ||
FILE_OVPN: ./operations/vpn/${{ inputs.ENVIRONMENT }}.ovpn | ||
TLS_KEY: ${{ secrets.VPN_TLS_KEY }} | ||
env: | ||
CA_CRT: ${{ secrets.VPN_CA_CERTIFICATE }} | ||
USER_CRT: ${{ secrets.VPN_GITHUB_CERTIFICATE }} | ||
USER_KEY: ${{ secrets.VPN_GITHUB_SECRET_KEY }} | ||
|
||
- name: Fail if VPN isn't Connected | ||
if: inputs.ENVIRONMENT != 'internal' && inputs.ENVIRONMENT != 'pr' && steps.connect_vpn.outputs.STATUS != 'true' | ||
run: | | ||
echo 'VPN connected: ${{ steps.connect_vpn.outputs.STATUS }}' | ||
exit 1 | ||
- name: Install Liquibase | ||
run: | | ||
wget -O- https://repo.liquibase.com/liquibase.asc | gpg --dearmor > liquibase-keyring.gpg && \cat liquibase-keyring.gpg | sudo tee /usr/share/keyrings/liquibase-keyring.gpg > /dev/null && \echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/liquibase-keyring.gpg] https://repo.liquibase.com stable main' | sudo tee /etc/apt/sources.list.d/liquibase.list | ||
sudo apt-get update | ||
sudo apt-get install liquibase | ||
liquibase -v | ||
- name: Run Db migration | ||
working-directory: ./ | ||
run: liquibase update --changelog-file ./etor/databaseMigrations/root.yml --url 'jdbc:postgresql://${{ env.DATABASE_HOSTNAME }}:5432/postgres' --username cdcti-github --password '${{ env.DATABASE_PASSWORD }}' | ||
|
||
- name: Disconnect VPN | ||
if: inputs.ENVIRONMENT != 'internal' && inputs.ENVIRONMENT != 'pr' && always() | ||
run: sudo killall openvpn | ||
|
||
- id: export-terraform-output | ||
name: Export Terraform Output | ||
|
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
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
Oops, something went wrong.