diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 0000000..db2123e --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,23 @@ +name: Staging Deployment +on: + push: + branches: + - staging +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: | + cd listener + npm ci + npm run build + - run: | + cd dashboard + npm ci + npm run build + - run: | + bash scripts/health-check.sh http://localhost:3000/health diff --git a/README.md b/README.md index 4c7d750..9f20079 100644 --- a/README.md +++ b/README.md @@ -475,3 +475,9 @@ This project is licensed under the MIT License. NotifyChain is built to simplify event-driven blockchain development by bridging smart contract events with off-chain automation and notification systems. Built on [Stellar](https://www.stellar.org/) and [Soroban](https://soroban.stellar.org/). + +## Staging Environment Instructions +To run the staging environment locally: +1. Export environment variables: `export $(cat listener/.env.staging | xargs)` +2. Build and run listener: `cd listener && npm ci && npm run build && npm start` +3. Run health check: `./scripts/health-check.sh` diff --git a/dashboard/.env.staging b/dashboard/.env.staging new file mode 100644 index 0000000..b027f88 --- /dev/null +++ b/dashboard/.env.staging @@ -0,0 +1,2 @@ +VITE_API_URL=http://localhost:3000 +VITE_ENV=staging diff --git a/listener/.env.staging b/listener/.env.staging new file mode 100644 index 0000000..ea0c7de --- /dev/null +++ b/listener/.env.staging @@ -0,0 +1,4 @@ +PORT=3000 +NODE_ENV=staging +STELLAR_NETWORK=testnet +RPC_URL=https://soroban-testnet.stellar.org diff --git a/scripts/health-check.sh b/scripts/health-check.sh new file mode 100755 index 0000000..ae8ab77 --- /dev/null +++ b/scripts/health-check.sh @@ -0,0 +1,8 @@ +#!/bin/bash +TARGET_URL=${1:-"http://localhost:3000/health"} +STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$TARGET_URL") +if [ "$STATUS" -eq 200 ]; then + exit 0 +else + exit 1 +fi