diff --git a/.github/ansible/prod.ap-southeast-1.hosts.yaml b/.github/ansible/prod.ap-southeast-1.hosts.yaml new file mode 100644 index 0000000000..bb4af91f71 --- /dev/null +++ b/.github/ansible/prod.ap-southeast-1.hosts.yaml @@ -0,0 +1,35 @@ +storage: + vars: + bucket_name: neon-prod-storage-ap-southeast-1 + bucket_region: ap-southeast-1 + console_mgmt_base_url: http://console-release.local + etcd_endpoints: etcd-0.ap-southeast-1.aws.neon.tech:2379 + pageserver_config_stub: + pg_distrib_dir: /usr/local + remote_storage: + bucket_name: "{{ bucket_name }}" + bucket_region: "{{ bucket_region }}" + prefix_in_bucket: "pageserver/v1" + safekeeper_s3_prefix: safekeeper/v1/wal + hostname_suffix: "" + remote_user: ssm-user + ansible_aws_ssm_region: ap-southeast-1 + ansible_aws_ssm_bucket_name: neon-prod-storage-ap-southeast-1 + console_region_id: aws-ap-southeast-1 + + children: + pageservers: + hosts: + pageserver-0.ap-southeast-1.aws.neon.tech: + ansible_host: i-064de8ea28bdb495b + pageserver-1.ap-southeast-1.aws.neon.tech: + ansible_host: i-0b180defcaeeb6b93 + + safekeepers: + hosts: + safekeeper-0.ap-southeast-1.aws.neon.tech: + ansible_host: i-0d6f1dc5161eef894 + safekeeper-1.ap-southeast-1.aws.neon.tech: + ansible_host: i-0e338adda8eb2d19f + safekeeper-2.ap-southeast-1.aws.neon.tech: + ansible_host: i-04fb63634e4679eb9 diff --git a/.github/ansible/prod.eu-central-1.hosts.yaml b/.github/ansible/prod.eu-central-1.hosts.yaml new file mode 100644 index 0000000000..68b1579746 --- /dev/null +++ b/.github/ansible/prod.eu-central-1.hosts.yaml @@ -0,0 +1,35 @@ +storage: + vars: + bucket_name: neon-prod-storage-eu-central-1 + bucket_region: eu-central-1 + console_mgmt_base_url: http://console-release.local + etcd_endpoints: etcd-0.eu-central-1.aws.neon.tech:2379 + pageserver_config_stub: + pg_distrib_dir: /usr/local + remote_storage: + bucket_name: "{{ bucket_name }}" + bucket_region: "{{ bucket_region }}" + prefix_in_bucket: "pageserver/v1" + safekeeper_s3_prefix: safekeeper/v1/wal + hostname_suffix: "" + remote_user: ssm-user + ansible_aws_ssm_region: eu-central-1 + ansible_aws_ssm_bucket_name: neon-prod-storage-eu-central-1 + console_region_id: aws-eu-central-1 + + children: + pageservers: + hosts: + pageserver-0.eu-central-1.aws.neon.tech: + ansible_host: i-0cd8d316ecbb715be + pageserver-1.eu-central-1.aws.neon.tech: + ansible_host: i-090044ed3d383fef0 + + safekeepers: + hosts: + safekeeper-0.eu-central-1.aws.neon.tech: + ansible_host: i-0b238612d2318a050 + safekeeper-1.eu-central-1.aws.neon.tech: + ansible_host: i-07b9c45e5c2637cd4 + safekeeper-2.eu-central-1.aws.neon.tech: + ansible_host: i-020257302c3c93d88 diff --git a/.github/ansible/prod.us-east-2.hosts.yaml b/.github/ansible/prod.us-east-2.hosts.yaml new file mode 100644 index 0000000000..1d54e2ef0a --- /dev/null +++ b/.github/ansible/prod.us-east-2.hosts.yaml @@ -0,0 +1,36 @@ +storage: + vars: + bucket_name: neon-prod-storage-us-east-2 + bucket_region: us-east-2 + console_mgmt_base_url: http://console-release.local + etcd_endpoints: etcd-0.us-east-2.aws.neon.tech:2379 + pageserver_config_stub: + pg_distrib_dir: /usr/local + remote_storage: + bucket_name: "{{ bucket_name }}" + bucket_region: "{{ bucket_region }}" + prefix_in_bucket: "pageserver/v1" + safekeeper_s3_prefix: safekeeper/v1/wal + hostname_suffix: "" + remote_user: ssm-user + ansible_aws_ssm_region: us-east-2 + ansible_aws_ssm_bucket_name: neon-prod-storage-us-east-2 + console_region_id: aws-us-east-2 + + children: + pageservers: + hosts: + pageserver-0.us-east-2.aws.neon.tech: + ansible_host: i-062227ba7f119eb8c + pageserver-1.us-east-2.aws.neon.tech: + ansible_host: i-0b3ec0afab5968938 + + safekeepers: + hosts: + safekeeper-0.us-east-2.aws.neon.tech: + ansible_host: i-0e94224750c57d346 + safekeeper-1.us-east-2.aws.neon.tech: + ansible_host: i-06d113fb73bfddeb0 + safekeeper-2.us-east-2.aws.neon.tech: + ansible_host: i-09f66c8e04afff2e8 + diff --git a/.github/ansible/ssm_config b/.github/ansible/ssm_config index 94958b4490..0dc67507f2 100644 --- a/.github/ansible/ssm_config +++ b/.github/ansible/ssm_config @@ -1,3 +1,2 @@ ansible_connection: aws_ssm -ansible_aws_ssm_bucket_name: neon-dev-bucket ansible_python_interpreter: /usr/bin/python3 diff --git a/.github/ansible/staging.us-east-2.hosts.yaml b/.github/ansible/staging.us-east-2.hosts.yaml index db3ed87c45..3bbf5fe8cb 100644 --- a/.github/ansible/staging.us-east-2.hosts.yaml +++ b/.github/ansible/staging.us-east-2.hosts.yaml @@ -14,6 +14,7 @@ storage: hostname_suffix: "" remote_user: ssm-user ansible_aws_ssm_region: us-east-2 + ansible_aws_ssm_bucket_name: neon-staging-storage-us-east-2 console_region_id: aws-us-east-2 children: diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 8d16e406ce..7133574a0f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -756,9 +756,9 @@ jobs: defaults: run: shell: bash - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_DEV }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY_DEV }} + strategy: + matrix: + target_region: [ us-east-2 ] steps: - name: Checkout uses: actions/checkout@v3 @@ -781,7 +781,47 @@ jobs: fi ansible-galaxy collection install sivel.toiletwater - ansible-playbook deploy.yaml -i staging.us-east-2.hosts.yaml -e @ssm_config -e CONSOLE_API_TOKEN=${{secrets.NEON_STAGING_API_KEY}} + ansible-playbook deploy.yaml -i staging.${{ matrix.target_region }}.hosts.yaml -e @ssm_config -e CONSOLE_API_TOKEN=${{secrets.NEON_STAGING_API_KEY}} + rm -f neon_install.tar.gz .neon_current_version + + deploy-prod-new: + runs-on: prod + container: 093970136003.dkr.ecr.eu-central-1.amazonaws.com/ansible:latest + # We need both storage **and** compute images for deploy, because control plane picks the compute version based on the storage version. + # If it notices a fresh storage it may bump the compute version. And if compute image failed to build it may break things badly + needs: [ push-docker-hub, calculate-deploy-targets, tag, regress-tests ] + if: | + (github.ref_name == 'release') && + github.event_name != 'workflow_dispatch' + defaults: + run: + shell: bash + strategy: + matrix: + target_region: [ us-east-2, eu-central-1, ap-southeast-1 ] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + + - name: Redeploy + run: | + export DOCKER_TAG=${{needs.tag.outputs.build-tag}} + cd "$(pwd)/.github/ansible" + + if [[ "$GITHUB_REF_NAME" == "main" ]]; then + ./get_binaries.sh + elif [[ "$GITHUB_REF_NAME" == "release" ]]; then + RELEASE=true ./get_binaries.sh + else + echo "GITHUB_REF_NAME (value '$GITHUB_REF_NAME') is not set to either 'main' or 'release'" + exit 1 + fi + + ansible-galaxy collection install sivel.toiletwater + ansible-playbook deploy.yaml -i prod.${{ matrix.target_region }}.hosts.yaml -e @ssm_config -e CONSOLE_API_TOKEN=${{secrets.NEON_PRODUCTION_API_KEY}} rm -f neon_install.tar.gz .neon_current_version deploy-proxy: