Skip to content

Commit

Permalink
Merge pull request #24 from desci-labs/m0ar/enable-codex
Browse files Browse the repository at this point in the history
V2 resolver
  • Loading branch information
hubsmoke authored Jun 27, 2024
2 parents b33716a + 6a134c1 commit 0fa7e35
Show file tree
Hide file tree
Showing 34 changed files with 22,812 additions and 6,957 deletions.
10 changes: 9 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.git
.gitignore
.husky
.env
.github/
.vscode/
dist/
node_modules/
test/
kubernetes/
node_modules/
log/
24 changes: 23 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
PORT=5460
SUPABASE_URL=
SUPABASE_KEY=
DPID_ENV=dev
IPFS_GATEWAY=https://ipfs.desci.com/ipfs
# If truthy, the `/*` route will use the legacy handler
FALLBACK_RESOLVER=0

# Local
# DPID_ENV=local # TODO, app prob doesn't like this yet
# OPTIMISM_RPC_URL=http://localhost:8545
# CERAMIC_URL=https://localhost:7007

# Dev & staging
DPID_ENV=dev
OPTIMISM_RPC_URL=https://reverse-proxy-dev.desci.com/rpc_opt_sepolia
CERAMIC_URL=https://ceramic-dev.desci.com

# Staging
# DPID_ENV=staging
# OPTIMISM_RPC_URL=https://reverse-proxy-staging.desci.com/rpc_opt_sepolia
# CERAMIC_URL=https://ceramic-prod.desci.com

# Prod
# DPID_ENV=production
# OPTIMISM_RPC_URL=https://reverse-proxy-prod.desci.com/rpc_opt_sepolia
# CERAMIC_URL=https://ceramic-prod.desci.com
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bash sanityCheckEnv.sh
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
v20.13.1
30 changes: 22 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
FROM node:16.17.0
FROM node:20.13.1-alpine3.20 AS base
RUN apk update && apk add --no-cache bash dumb-init

WORKDIR /usr/src/app
COPY . ./
RUN npm install -g npm@9.5.1
RUN npm ci --ignore-scripts
EXPOSE 5460
COPY .env.example .env
COPY package*.json ./

FROM base as builder

RUN --mount=type=cache,target=/usr/src/app/.npm \
npm set cache /usr/src/app/.npm && \
npm ci
COPY . .
RUN npm run build
RUN apt-get install -y bash
CMD [ "npm", "run", "start" ]

FROM base AS prod

COPY --chown=node:node --from=builder /usr/src/app/dist dist/
COPY --chown=node:node --from=builder /usr/src/app/node_modules node_modules/
COPY --chown=node:node --from=builder /usr/src/app/.env.example .env

USER node
EXPOSE 5460

CMD [ "dumb-init", "node", "--no-warnings=ExperimentalWarning", "dist/index.js" ]
12 changes: 8 additions & 4 deletions kubernetes/deployment.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ spec:
vault.hashicorp.com/agent-inject-template-config: |
{{- with secret "secrets/dpid-resolver/dev" -}}
echo "appstart";
export NODE_ENV=production
export ENV=dev
export NODE_ENV={{ .Data.NODE_ENV }}
export SUPABASE_URL={{ .Data.SUPABASE_URL }}
export SUPABASE_KEY={{ .Data.SUPABASE_KEY }}
export DEBUG_TEST=0;
export DPID_ENV={{ .Data.DPID_ENV }}
export IPFS_GATEWAY={{ .Data.IPFS_GATEWAY}}
export OPTIMISM_RPC_URL={{ .Data.OPTIMISM_RPC_URL }}
export CERAMIC_URL={{ .Data.CERAMIC_URL }}
export FALLBACK_RESOLVER={{ .Data.FALLBACK_RESOLVER }}
echo "loaded"
{{- end -}}
labels:
Expand All @@ -40,7 +44,7 @@ spec:
name: dpid-resolver-dev
command: ["/bin/bash", "-c"]
args:
- echo "SOURCING ENV"; source /vault/secrets/config; NODE_PATH=./dist node ./dist/index.js;
- echo "SOURCING ENV"; source /vault/secrets/config; dumb-init node ./dist/index.js;
ports:
- containerPort: 5460
resources:
Expand Down
16 changes: 10 additions & 6 deletions kubernetes/deployment.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ spec:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-status: "update"
vault.hashicorp.com/role: app-vault-reader
vault.hashicorp.com/agent-inject-secret-config: secrets/dpid-resolver/dev
vault.hashicorp.com/agent-inject-secret-config: secrets/dpid-resolver/production
vault.hashicorp.com/agent-inject-template-config: |
{{- with secret "secrets/dpid-resolver/dev" -}}
{{- with secret "secrets/dpid-resolver/production" -}}
echo "appstart";
export NODE_ENV=production
export DPID_ENV=production
export NODE_ENV={{ .Data.NODE_ENV }}
export SUPABASE_URL={{ .Data.SUPABASE_URL }}
export SUPABASE_KEY={{ .Data.SUPABASE_KEY }}
export DEBUG_TEST=0;
export DPID_ENV={{ .Data.DPID_ENV }}
export IPFS_GATEWAY={{ .Data.IPFS_GATEWAY}}
export OPTIMISM_RPC_URL={{ .Data.OPTIMISM_RPC_URL }}
export CERAMIC_URL={{ .Data.CERAMIC_URL }}
export FALLBACK_RESOLVER={{ .Data.FALLBACK_RESOLVER }}
echo "loaded"
{{- end -}}
labels:
Expand All @@ -40,7 +44,7 @@ spec:
name: dpid-resolver
command: ["/bin/bash", "-c"]
args:
- echo "SOURCING ENV"; source /vault/secrets/config; NODE_PATH=./dist node ./dist/index.js;
- echo "SOURCING ENV"; source /vault/secrets/config; dumb-init node ./dist/index.js;
ports:
- containerPort: 5460
resources:
Expand Down
17 changes: 10 additions & 7 deletions kubernetes/deployment.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ spec:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-status: "update"
vault.hashicorp.com/role: app-vault-reader
vault.hashicorp.com/agent-inject-secret-config: secrets/dpid-resolver/dev
vault.hashicorp.com/agent-inject-secret-config: secrets/dpid-resolver/staging
vault.hashicorp.com/agent-inject-template-config: |
{{- with secret "secrets/dpid-resolver/dev" -}}
{{- with secret "secrets/dpid-resolver/staging" -}}
echo "appstart";
export NODE_ENV=production
export ENV=staging
export DPID_ENV=staging
export NODE_ENV={{ .Data.NODE_ENV }}
export SUPABASE_URL={{ .Data.SUPABASE_URL }}
export SUPABASE_KEY={{ .Data.SUPABASE_KEY }}
export DEBUG_TEST=0;
export DPID_ENV={{ .Data.DPID_ENV }}
export IPFS_GATEWAY={{ .Data.IPFS_GATEWAY }}
export OPTIMISM_RPC_URL={{ .Data.OPTIMISM_RPC_URL }}
export CERAMIC_URL={{ .Data.CERAMIC_URL }}
export FALLBACK_RESOLVER={{ .Data.FALLBACK_RESOLVER }}
echo "loaded"
{{- end -}}
labels:
Expand All @@ -77,7 +80,7 @@ spec:
name: dpid-resolver-staging
command: ["/bin/bash", "-c"]
args:
- echo "SOURCING ENV"; source /vault/secrets/config; NODE_PATH=./dist node ./dist/index.js;
- echo "SOURCING ENV"; source /vault/secrets/config; dumb-init node ./dist/index.js;
ports:
- containerPort: 5460
resources:
Expand Down
Loading

0 comments on commit 0fa7e35

Please sign in to comment.