Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Add testing deployment (#75)
Browse files Browse the repository at this point in the history
* Parametrize ansible SSH HOST

* Add testing deployment

* Add testing URL to check_origin
  • Loading branch information
klaus993 authored Jul 31, 2023
1 parent 95ec188 commit d7712af
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy https://madaraexplorer.com/
on:
push:
tags:
- v**

jobs:

build-deploy:
name: Build and deploy to testing
runs-on: ubuntu-latest
environment:
name: production
url: https://madaraexplorer.com/
steps:

- name: Checkout
uses: actions/[email protected]

- name: Create ssh private key file from env var
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
run: |
set -ex
sed -E 's/(-+(BEGIN|END) OPENSSH PRIVATE KEY-+) *| +/\1\n/g' <<< "$SSH_KEY" > id_ed25519_testing
chmod 400 id_ed25519_production
- name: Install ansible
run: |
pip install ansible
- name: "Deploy with ansible"
env:
MIX_ENV: ${{ vars.MIX_ENV }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
PHX_HOST: ${{ vars.PHX_HOST }}
PHX_SERVER: ${{ vars.PHX_SERVER }}
RPC_API_HOST: ${{ secrets.RPC_API_HOST }}
TESTNET_RPC_API_HOST: ${{ secrets.TESTNET_RPC_API_HOST }}
TESTNET_2_RPC_API_HOST: ${{ secrets.TESTNET_2_RPC_API_HOST }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "./id_ed25519_production"
SSH_HOST: ${{ vars.SSH_HOST }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
5 changes: 3 additions & 2 deletions .github/workflows/deploy-testing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy https://madaraexplorer.com/
name: Deploy https://testing.madaraexplorer.com/
on:
push:
branches:
Expand All @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: testing
url: https://madaraexplorer.com/
url: https://testing.madaraexplorer.com/
steps:

- name: Checkout
Expand Down Expand Up @@ -45,6 +45,7 @@ jobs:
AWS_REGION: ${{ vars.AWS_REGION }}
PROVER_STORAGE: ${{ vars.PROVER_STORAGE }}
ANSIBLE_SSH_PKEY_DIR: "./id_ed25519_testing"
SSH_HOST: ${{ vars.SSH_HOST }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
ansible-playbook -i ansible/inventory.yaml ansible/playbooks/deployment.yaml
2 changes: 1 addition & 1 deletion ansible/inventory.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
webservers:
hosts:
starknet_testing:
ansible_host: "157.90.154.208"
ansible_host: "{{ lookup('ansible.builtin.env', 'SSH_HOST') }}"
ansible_user: starknet_explorer
ansible_python_interpreter: /usr/bin/python3
ansible_ssh_private_key_file: "{{ lookup('ansible.builtin.env', 'ANSIBLE_SSH_PKEY_DIR') }}"
Expand Down
3 changes: 2 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ if config_env() == :prod do
check_origin: [
"https://madaraexplorer.com",
"https://www.madaraexplorer.com",
"https://madaraexplorer.lambdaclass.com"
"https://madaraexplorer.lambdaclass.com",
"https://testing.madaraexplorer.com"
],
http: [
# Enable IPv6 and bind on all interfaces.
Expand Down

0 comments on commit d7712af

Please sign in to comment.