From baeca72ed60ec4f500ce6c2bd0b2f63fec9429db Mon Sep 17 00:00:00 2001 From: Yaroslav Grishajev Date: Thu, 3 Oct 2024 11:16:52 +0200 Subject: [PATCH] feat(config): setup doppler env for api --- apps/api/deploy.yml | 13 +------------ apps/api/package.json | 1 + apps/indexer/package.json | 1 + apps/stats-web/package.json | 1 + apps/stats-web/src/hooks/useSelectedNetwork.ts | 0 apps/stats-web/src/lib/constants.ts | 0 apps/stats-web/src/store/networkStore.ts | 0 docker/Dockerfile.node | 11 +++++++++-- packages/network-store/src/network.store.ts | 2 +- 9 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 apps/stats-web/src/hooks/useSelectedNetwork.ts create mode 100644 apps/stats-web/src/lib/constants.ts create mode 100644 apps/stats-web/src/store/networkStore.ts diff --git a/apps/api/deploy.yml b/apps/api/deploy.yml index 9067ad4c4..0f632041c 100644 --- a/apps/api/deploy.yml +++ b/apps/api/deploy.yml @@ -6,19 +6,8 @@ services: image: : depends-on: cloud-sql-proxy env: - - GITHUB_PAT= - - AKASH_SANDBOX_DATABASE_CS= - - USER_DATABASE_CS= - - SECRET_TOKEN= - - NETWORK= - - MASTER_WALLET_MNEMONIC= - - POSTGRES_DB_URI= - - ANONYMOUS_USER_TOKEN_SECRET= - - SENTRY_DSN= + - DOPPLER_TOKEN= - SENTRY_SERVER_NAME= - - DEPLOYMENT_ENV= - - STRIPE_SECRET_KEY= - - STRIPE_WEBHOOK_SECRET= expose: - port: 3080 as: 80 diff --git a/apps/api/package.json b/apps/api/package.json index f6e2f54bf..66f481867 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -19,6 +19,7 @@ "lint": "eslint .", "migrate": "node-pg-migrate", "migration:gen": "drizzle-kit generate", + "prod": "doppler run -- node dist/server.js", "start": "webpack --config webpack.dev.js --watch", "test": "jest --selectProjects unit functional", "test:cov": "jest --selectProjects unit functional --coverage", diff --git a/apps/indexer/package.json b/apps/indexer/package.json index 6b23c4c92..4808c0737 100644 --- a/apps/indexer/package.json +++ b/apps/indexer/package.json @@ -18,6 +18,7 @@ "dev": "npm run start", "format": "prettier --write ./*.{js,json} **/*.{ts,js,json}", "lint": "eslint .", + "prod": "node dist/server.js", "start": "webpack --mode development --config webpack.dev.js --watch", "test": "jest" }, diff --git a/apps/stats-web/package.json b/apps/stats-web/package.json index c9a54267f..2616ebbb7 100644 --- a/apps/stats-web/package.json +++ b/apps/stats-web/package.json @@ -13,6 +13,7 @@ "dependencies": { "@akashnetwork/network-store": "*", "@akashnetwork/ui": "*", + "@akashnetwork/network-store": "*", "@cosmjs/encoding": "^0.32.4", "@json2csv/plainjs": "^7.0.4", "@nivo/line": "^0.87.0", diff --git a/apps/stats-web/src/hooks/useSelectedNetwork.ts b/apps/stats-web/src/hooks/useSelectedNetwork.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/stats-web/src/lib/constants.ts b/apps/stats-web/src/lib/constants.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/stats-web/src/store/networkStore.ts b/apps/stats-web/src/store/networkStore.ts new file mode 100644 index 000000000..e69de29bb diff --git a/docker/Dockerfile.node b/docker/Dockerfile.node index 630ccb489..6c5e38b9d 100644 --- a/docker/Dockerfile.node +++ b/docker/Dockerfile.node @@ -44,11 +44,15 @@ RUN npm ci --workspace $WORKSPACE --omit=dev RUN apk add --no-cache libcap; \ setcap cap_net_bind_service=+ep `readlink -f \`which node\`` +RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/cli@doppler-8004D9FF50437357.rsa.pub && \ + echo 'https://packages.doppler.com/public/cli/alpine/any-version/main' | tee -a /etc/apk/repositories && \ + apk add doppler + USER $APP_USER WORKDIR /app/$WORKSPACE -CMD ["node", "dist/server.js"] +CMD ["npm", "run", "prod"] FROM production AS production-nginx @@ -62,4 +66,7 @@ RUN apk add --no-cache libcap nginx openssl \ COPY $WORKSPACE/nginx.conf /etc/nginx/nginx.conf -CMD sed -i "s/127.0.0.1/$(hostname -i)/" /etc/nginx/nginx.conf && sed -i "s/:3000/:$PORT/" /etc/nginx/nginx.conf && nginx && node dist/server.js \ No newline at end of file +ARG PORT=3000 +ENV PORT=${PORT} + +CMD sed -i "s/127.0.0.1/$(hostname -i)/" /etc/nginx/nginx.conf && sed -i "s/:3000/:$PORT/" /etc/nginx/nginx.conf && nginx && npm run prod \ No newline at end of file diff --git a/packages/network-store/src/network.store.ts b/packages/network-store/src/network.store.ts index 6f13aff3f..2d65b61b2 100644 --- a/packages/network-store/src/network.store.ts +++ b/packages/network-store/src/network.store.ts @@ -105,7 +105,7 @@ export class NetworkStore { } } - private initiateNetworkFromUrlQuery(): Network["id"] | undefined { + private initiateNetworkFromUrlQuery(): void { if (typeof window === "undefined") { return; }