Skip to content

Commit

Permalink
build: billboard deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
hai-ko committed Nov 6, 2023
1 parent bd36c0d commit 3726417
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-billboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
echo "REACT_APP_BRANCH=${{ env.branch }}" >> ./.env.react
echo "REACT_APP_BUILD_TIME=${{ env.now }}" >> ./.env.react
cat ./.env.react >> ./.env
echo "BILLBOARD_SIGNER_PRIVATE_KEY=${{ secrets.BILLBOARD_SIGNER_PRIVATE_KEY }}" >> ./.env
echo "RESOLVER_ADDR=0xae6646c22D8eE6479eE0a39Bf63B9bD9e57bAD9d" >> ./.env
echo "SIGNING_PUBLIC_KEY=${{ secrets.SIGNING_PUBLIC_KEY }}" >> ./.env
echo "SIGNING_PRIVATE_KEY=${{ secrets.SIGNING_PRIVATE_KEY }}" >> ./.env
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM --platform=linux/amd64 node:18-alpine
WORKDIR /app
COPY . .
RUN apk add --update python3 make g++\
RUN apk add --update python3 make g++ curl\
&& rm -rf /var/cache/apk/*
RUN yarn install
RUN yarn build
26 changes: 18 additions & 8 deletions docker/billboard/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
image: nginx:latest
restart: always
depends_on:
- offchain-resolver
- billboard-client
- ccip-resolver
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
Expand All @@ -33,13 +33,17 @@ services:
image: dm3-backend
command: yarn workspace dm3-billboard-client start
depends_on:
- db
- ccip-resolver
db:
condition: service_started
ccip-resolver:
condition: service_started
offchain-resolver:
condition: service_healthy
environment:
PORT: 8082
PORT: 8083
time: 0
privateKey: ${BILLBOARD_PRIVATE_KEY}
ensNames: '["billboard1.eth"]'
ensNames: '["billboard1.bb-user.dm3.eth"]'
mediators: '[]'
REDIS_URL: redis://db:6379
RPC: ${RPC}
Expand All @@ -65,6 +69,11 @@ services:
DATABASE_URL: postgresql://postgres:example@offchain-resolver-db:5432
PORT: 8082
LOG_LEVEL: 'debug'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8082/0x26139b2349282de5ee2bd9c7a53171a28d6a6c84/0xf8c30f63000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001c0a62696c6c626f617264310762622d7573657203646d3303657468000000000000000000000000000000000000000000000000000000000000000000000000243b3b57de8d7fcfd6548aae2cdb5851741139459856caadb3b9ad3d27872ae921b2348a7d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014bcd6de065fd7e889e3ec86aa2d2780d7553ab3cc000000000000000000000000"]
interval: 30s
timeout: 10s
retries: 5

# web:
# image: dm3-backend
Expand All @@ -85,13 +94,14 @@ services:
image: dm3org/ccip-resolver:v0.2.7
restart: always
depends_on:
- offchain-resolver
offchain-resolver:
condition: service_healthy
environment:
SIGNER_PRIVATE_KEY: ${SIGNER_PRIVATE_KEY}
SIGNER_PRIVATE_KEY: ${BILLBOARD_SIGNER_PRIVATE_KEY}
LOG_LEVEL: debug
CONFIG: |
{
"0xae6646c22d8ee6479ee0a39bf63b9bd9e57bad9d": {
"0x26139b2349282de5ee2bd9c7a53171a28d6a6c84": {
"type": "signing",
"handlerUrl": "http://offchain-resolver:8082"
}
Expand Down
12 changes: 12 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ http {
proxy_redirect off;
}

location /bb-client {
rewrite ^/bb-client(.*)$ $1 break;
limit_req zone=standardlimit burst=50;
proxy_pass http://billboard-client:8083;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_redirect off;
}

location /socket.io {
proxy_pass http://backend:8081/socket.io;
proxy_http_version 1.1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getDeliveryServiceWSClient = (
return Promise.all(
deliveryServices.map(async (ds) => {
const client = await new Promise<Socket>((res, rej) => {
const c = io(ds.url, {
const c = io(ds.url.replace('/api', ''), {
auth: {
account: { ensName },
token: ds.token,
Expand Down
17 changes: 15 additions & 2 deletions packages/cli/profile/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/* eslint-disable no-console */
import { Command, program } from 'commander';
import { getStorageKeyCreationMessage, createStorageKey } from 'dm3-lib-crypto';
import { createProfileKeys, UserProfile } from 'dm3-lib-profile';
import {
createProfileKeys,
getProfileCreationMessage,
SignedUserProfile,
UserProfile,
} from 'dm3-lib-profile';
import { ethers } from 'ethers';
import { getSanitizedWallet } from '../sanitizer/getSanitizedWallet';
import { stringify } from 'dm3-lib-shared';

const newProfile = async (program: Command) => {
const { profilePk, deliveryService } = program.opts();
Expand Down Expand Up @@ -47,7 +53,14 @@ const newProfile = async (program: Command) => {
);
}

console.log(profile);
const profileCreationMessage = getProfileCreationMessage(
stringify(profile),
);

const profileSig = await profileWallet.signMessage(profileCreationMessage);
const signedProfile: SignedUserProfile = { profile, signature: profileSig };

console.log(signedProfile);
};

export { newProfile };

0 comments on commit 3726417

Please sign in to comment.