Cardano re-sync on dev by @placek #11
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
name: Re-sync Cardano Node and Cardano DB Sync | |
run-name: Cardano re-sync on ${{ inputs.environment }} by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
type: choice | |
default: "dev" | |
options: | |
- "dev" | |
- "test" | |
- "staging" | |
- "beta" | |
env: | |
ENVIRONMENT: ${{ inputs.environment || 'dev' }} | |
CARDANO_NETWORK: "sanchonet" | |
jobs: | |
deploy: | |
name: Re-sync Cardano state | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./scripts/govtool | |
env: | |
DBSYNC_POSTGRES_DB: "cexplorer" | |
DBSYNC_POSTGRES_USER: "postgres" | |
DBSYNC_POSTGRES_PASSWORD: "pSa8JCpQOACMUdGb" | |
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }} | |
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }} | |
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }} | |
DEV_NGINX_BASIC_AUTH: ${{ secrets.DEV_NGINX_BASIC_AUTH }} | |
TEST_NGINX_BASIC_AUTH: ${{ secrets.TEST_NGINX_BASIC_AUTH }} | |
STAGING_NGINX_BASIC_AUTH: ${{ secrets.STAGING_NGINX_BASIC_AUTH }} | |
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }} | |
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com" | |
GTM_ID: ${{ secrets.GTM_ID }} | |
NPMRC_TOKEN: ${{ secrets.NPMRC_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }} | |
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }} | |
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.GHA_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GHA_AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Login to AWS ECR | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-west-1 | |
- name: Setup SSH agent | |
uses: webfactory/ssh-agent@v0.8.0 | |
with: | |
ssh-private-key: ${{ secrets.GHA_SSH_PRIVATE_KEY }} | |
- name: Set domain | |
run: | | |
if [[ "${{ inputs.environment }}" == "staging" ]]; then | |
echo "DOMAIN=staging.govtool.byron.network" >> $GITHUB_ENV | |
elif [[ "${{ inputs.environment }}" == "beta" ]]; then | |
echo "DOMAIN=sanchogov.tools" >> $GITHUB_ENV | |
else | |
echo "DOMAIN=${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}" >> $GITHUB_ENV | |
fi | |
- name: Destroy Cardano Node, DB sync and Postgres database | |
run: | | |
make --debug=b destroy-cardano-node-and-dbsync | |
- name: Deploy app | |
run: | | |
make --debug=b all |