-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'billboard-devconnect' of https://github.com/corpus-io/dm3…
… into billboard-devconnect
- Loading branch information
Showing
6 changed files
with
196 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Staging billboard deploy | ||
on: push | ||
|
||
jobs: | ||
messenger-demo-deploy: | ||
runs-on: ubuntu-latest | ||
# if: ${{ contains( github.ref, vars.STAGING_BRANCH) }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
node-version: 18.0.0 | ||
cache: 'yarn' | ||
- name: Declare some variables | ||
shell: bash | ||
run: | | ||
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | ||
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV" | ||
echo "now=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | ||
- name: Prepare SSH | ||
run: | | ||
mkdir ~/.ssh | ||
echo "${{ secrets.STAGING_HOST_SSH_BILLBOARD }}" > ~/.ssh/known_hosts | ||
echo "${{ secrets.DO_SSH_KEY }}" > ./ssh-key | ||
chmod 600 ./ssh-key | ||
- name: Create .env file | ||
env: | ||
TARGET_HOST: ${{ secrets.STAGING_HOST_BILLBOARD }} | ||
run: | | ||
echo "REACT_APP_ADDR_ENS_SUBDOMAIN=.beta-addr.dm3.eth" >> ./.env.react | ||
echo "REACT_APP_BACKEND=http://${{ secrets.STAGING_HOST_BILLBOARD }}/api" >> ./.env.react | ||
echo "REACT_APP_DEFAULT_DELIVERY_SERVICE=beta-ds.dm3.eth" >> ./.env.react | ||
echo "REACT_APP_DEFAULT_SERVICE=http://${{ secrets.STAGING_HOST_BILLBOARD }}/api" >> ./.env.react | ||
echo "REACT_APP_ETHEREUM_PROVIDER=${{ secrets.REACT_APP_ETHEREUM_PROVIDER }}" >> ./.env.react | ||
echo "REACT_APP_PROFILE_BASE_URL=http://${{ secrets.STAGING_HOST_BILLBOARD }}/api" >> ./.env.react | ||
echo "REACT_APP_RESOLVER_BACKEND=http://${{ secrets.STAGING_HOST_BILLBOARD }}/resolver-handler" >> ./.env.react | ||
echo "REACT_APP_USER_ENS_SUBDOMAIN=.beta-user.dm3.eth" >> ./.env.react | ||
echo "REACT_APP_WALLET_CONNECT_PROJECT_ID=${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }}" >> ./.env.react | ||
echo "REACT_APP_COMMIT_HASH=${{ env.sha_short }}" >> ./.env.react | ||
echo "REACT_APP_BRANCH=${{ env.branch }}" >> ./.env.react | ||
echo "REACT_APP_BUILD_TIME=${{ env.now }}" >> ./.env.react | ||
cat ./.env.react >> ./.env | ||
echo "RESOLVER_ADDR=0xae6646c22D8eE6479eE0a39Bf63B9bD9e57bAD9d" >> ./.env | ||
echo "SIGNING_PUBLIC_KEY=${{ secrets.SIGNING_PUBLIC_KEY }}" >> ./.env | ||
echo "SIGNING_PRIVATE_KEY=${{ secrets.SIGNING_PRIVATE_KEY }}" >> ./.env | ||
echo "SIGNER_PRIVATE_KEY=${{ secrets.SIGNER_PRIVATE_KEY }}" >> ./.env | ||
echo "SPAM_PROTECTION=${{ secrets.SPAM_PROTECTION }}" >> ./.env | ||
echo "ENCRYPTION_PUBLIC_KEY=${{ secrets.ENCRYPTION_PUBLIC_KEY }}" >> ./.env | ||
echo "ENCRYPTION_PRIVATE_KEY=${{ secrets.ENCRYPTION_PRIVATE_KEY }}" >> ./.env | ||
echo "RPC=${{ secrets.STAGING_RPC }}" >> ./.env | ||
echo "BILLBOARD_PRIVATE_KEY=${{ secrets.BILLBOARD_PRIVATE_KEY}}" >> ./.env | ||
echo "interceptor=${{ secrets.INTERCEPTOR}}" >> ./.env | ||
envsubst '${SSL_CERTIFICATE_BASE_LOC} ${TLS_CERTIFICATE_LOCATION} ${TARGET_HOST}' < ./docker/nginx.conf > ./nginx.conf | ||
cat ./.env | ||
- name: Build docker image | ||
run: | | ||
cp ./.env.react packages/messenger-demo/.env | ||
docker build --progress=plain -t dm3-backend:latest -f ./docker/Dockerfile . | ||
docker save -o ./dm3-backend.tar dm3-backend:latest | ||
- name: Sync files | ||
run: | | ||
rsync -avz -e 'ssh -i ./ssh-key' ./.env app@${{ secrets.STAGING_HOST_BILLBOARD }}:/home/app/dm3 | ||
rsync -avz -e 'ssh -i ./ssh-key' ./dm3-backend.tar app@${{ secrets.STAGING_HOST_BILLBOARD }}:/home/app/dm3 | ||
rsync -avz -e 'ssh -i ./ssh-key' ./nginx.conf app@${{ secrets.STAGING_HOST_BILLBOARD }}:/home/app/dm3 | ||
rsync -avz -e 'ssh -i ./ssh-key' ./docker/billboard/docker-compose.yml app@${{ secrets.STAGING_HOST_BILLBOARD }}:/home/app/dm3 | ||
- name: Prepare docker | ||
run: | | ||
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST_BILLBOARD }} "\ | ||
cd dm3 && docker compose down && docker system prune -af" | ||
ssh -i ./ssh-key root@${{ secrets.STAGING_HOST_BILLBOARD }} "\ | ||
systemctl restart docker.service" | ||
- name: Load docker image | ||
run: | | ||
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST_BILLBOARD }} "\ | ||
cd dm3 && docker load -i dm3-backend.tar; \ | ||
rm dm3-backend.tar || true" | ||
- name: Firewall config | ||
run: | | ||
ssh -i ./ssh-key root@${{ secrets.STAGING_HOST_BILLBOARD }} "\ | ||
ufw allow from 172.18.0.1/16 proto tcp to ${{ secrets.STAGING_HOST_BILLBOARD }} port 80" | ||
- name: Start | ||
run: | | ||
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST_BILLBOARD }} "\ | ||
cd dm3 && docker compose --env-file .env up -d" |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Push Workflow | ||
name: Staging deploy | ||
on: push | ||
|
||
jobs: | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Push Workflow | ||
name: Build and test | ||
on: push | ||
|
||
jobs: | ||
|
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
version: "3.1" | ||
services: | ||
|
||
nginx: | ||
container_name: nginx | ||
image: nginx:latest | ||
restart: always | ||
depends_on: | ||
- offchain-resolver | ||
- billboard-client | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
|
||
backend: | ||
image: dm3-backend | ||
command: yarn workspace dm3-backend start | ||
depends_on: | ||
- db | ||
environment: | ||
REDIS_URL: redis://db:6379 | ||
SIGNING_PUBLIC_KEY: ${SIGNING_PUBLIC_KEY} | ||
SIGNING_PRIVATE_KEY: ${SIGNING_PRIVATE_KEY} | ||
ENCRYPTION_PUBLIC_KEY: ${ENCRYPTION_PUBLIC_KEY} | ||
ENCRYPTION_PRIVATE_KEY: ${ENCRYPTION_PRIVATE_KEY} | ||
RPC: ${RPC} | ||
PORT: 8081 | ||
LOG_LEVEL: 'debug' | ||
|
||
billboard-client: | ||
image: dm3-backend | ||
command: yarn workspace dm3-billboard-client start | ||
depends_on: | ||
- db | ||
- ccip-resolver | ||
environment: | ||
PORT: 8082 | ||
time: 0 | ||
privateKey: ${BILLBOARD_PRIVATE_KEY} | ||
ensNames: '["billboard1.eth"]' | ||
mediators: '[]' | ||
REDIS_URL: redis://db:6379 | ||
RPC: ${RPC} | ||
LOG_LEVEL: 'debug' | ||
|
||
db: | ||
image: redis | ||
restart: always | ||
|
||
offchain-resolver-db: | ||
image: postgres | ||
restart: always | ||
container_name: offchain_resolver_db | ||
environment: | ||
POSTGRES_PASSWORD: example | ||
|
||
offchain-resolver: | ||
image: dm3-backend | ||
command: yarn workspace dm3-offchain-resolver start | ||
depends_on: | ||
- offchain-resolver-db | ||
environment: | ||
DATABASE_URL: postgresql://postgres:example@offchain-resolver-db:5432 | ||
PORT: 8082 | ||
LOG_LEVEL: 'debug' | ||
|
||
# web: | ||
# image: dm3-backend | ||
# command: yarn workspace messenger-demo start | ||
# environment: | ||
# REACT_APP_ADDR_ENS_SUBDOMAIN: ${REACT_APP_ADDR_ENS_SUBDOMAIN} | ||
# REACT_APP_BACKEND: ${REACT_APP_BACKEND} | ||
# REACT_APP_DEFAULT_DELIVERY_SERVICE: ${REACT_APP_DEFAULT_DELIVERY_SERVICE} | ||
# REACT_APP_DEFAULT_SERVICE: ${REACT_APP_DEFAULT_SERVICE} | ||
# REACT_APP_ETHEREUM_PROVIDER: ${REACT_APP_ETHEREUM_PROVIDER} | ||
# REACT_APP_PROFILE_BASE_URL: ${REACT_APP_PROFILE_BASE_URL} | ||
# REACT_APP_RESOLVER_BACKEND: ${REACT_APP_RESOLVER_BACKEND} | ||
# REACT_APP_USER_ENS_SUBDOMAIN: ${REACT_APP_USER_ENS_SUBDOMAIN} | ||
# REACT_APP_WALLET_CONNECT_PROJECT_ID: ${REACT_APP_WALLET_CONNECT_PROJECT_ID} | ||
# RESOLVER_ADDR: ${RESOLVER_ADDR} | ||
|
||
ccip-resolver: | ||
image: dm3org/ccip-resolver:v0.2.7 | ||
restart: always | ||
depends_on: | ||
- offchain-resolver | ||
environment: | ||
SIGNER_PRIVATE_KEY: ${SIGNER_PRIVATE_KEY} | ||
LOG_LEVEL: debug | ||
CONFIG: | | ||
{ | ||
"0xae6646c22d8ee6479ee0a39bf63b9bd9e57bad9d": { | ||
"type": "signing", | ||
"handlerUrl": "http://offchain-resolver:8082" | ||
} | ||
} | ||
PORT: 8181 | ||
|
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 was deleted.
Oops, something went wrong.