Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Quest Chains from ethers to Viem for Contract Access #1761

Merged
merged 41 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
aa2109f
converting PNGs to WebP 🚁
dysbulic Jul 9, 2024
c353420
replacing `ethers` with Viem for Quest Chains contract access 🪡
dysbulic Jul 9, 2024
6230eb3
displaying ENS name for Quest Chain author 🈴
dysbulic Jul 9, 2024
b07ada6
fixing submission 🏈
dysbulic Jul 9, 2024
e4fec00
adding `onComplete` handler for uploading 🥕
dysbulic Jul 9, 2024
fbeef7f
in the process of upgrading `ethers` to `v6`
dysbulic Jul 9, 2024
d7369f0
trying to upgrade `yarn` b/c `yarn` classic was crapping out 🪇
dysbulic Jul 9, 2024
0dfe315
updating dependencies 🫛
dysbulic Jul 9, 2024
0207ed4
almost running; need to check another branch 🎤
dysbulic Jul 10, 2024
d725c5c
disabled `yarn` PnP 🥏
dysbulic Jul 10, 2024
fa37b69
pushing so I can reinstall my OS 🧙‍♂️
dysbulic Jul 12, 2024
11d9c91
switching to `package.json` import munging from TypeScript `paths` 🥔
dysbulic Jul 15, 2024
4163b66
fixing ERC-20 contract read using WAGMI 👛
dysbulic Jul 15, 2024
235ad17
criminey, much finessing to hopefully cause the test instance to buil…
dysbulic Jul 15, 2024
e7b8c04
moving Markdown component to `design-system` 🧱
dysbulic Jul 15, 2024
7193bbf
upgrading `eslint` 🪢
dysbulic Jul 16, 2024
6b511b1
switching to `yarn workspaces focus` for production dependencies 🔱
dysbulic Jul 16, 2024
09e495e
removing unneeded `node_modules/`? ✊🏻
dysbulic Jul 16, 2024
cb07eff
enable `corepack` for `yarn` `berry` 🪮
dysbulic Jul 16, 2024
a3c3058
fighting with `docker` ⛑️
dysbulic Jul 16, 2024
298c4ef
finagling `package.json` `imports` to work in dev & prod 🥫
dysbulic Jul 18, 2024
9773e46
allowing Discord bot to start w/o credentials 🏺
dysbulic Jul 18, 2024
83e942c
frontend container building & should deploy 🦥
dysbulic Jul 19, 2024
1204ce2
working on auth & fixing all-category playbooks 🍂
dysbulic Jul 19, 2024
ace7ab6
improving login experience 🪴
dysbulic Jul 19, 2024
18addfd
working on relative paths & saving to Ceramic 🧇
dysbulic Jul 25, 2024
b5f28bd
matching [a recent example](https://github.com/ceramicstudio/walletco…
dysbulic Jul 25, 2024
56707ef
debugging Ceramic & winnowing down `ethers` presence 🏎️
dysbulic Jul 25, 2024
a9e45c4
cleaning up save error messages 🌀
dysbulic Jul 25, 2024
34f2279
Merge branch 'develop' into fix/quest-chains-ethers
dysbulic Jul 30, 2024
12d63d6
testing `yarn` install error on GitHub 🐦‍🔥
dysbulic Jul 30, 2024
6701d92
🪆 Merge branch 'fix/quest-chains-ethers' of github.com:MetaFam/TheGam…
dysbulic Jul 30, 2024
f3aa8a4
trying to get `yarn` to not die when installing from GitHub 🥕
dysbulic Jul 30, 2024
3283e13
missed updating `yarn.lock` 🦞
dysbulic Jul 30, 2024
d944743
reenabling EAS & switching `node-ts` to `tsx` 🏚️
dysbulic Aug 13, 2024
f0aec1f
tweaking Discord bot GraphQL codegen 🏔️
dysbulic Aug 13, 2024
36d41d9
tweaking backend GraphQL codegen 🚒
dysbulic Aug 13, 2024
82e4b09
trying DAOHaus v3 Graph endpoint 🚜
dysbulic Aug 13, 2024
207a713
trying DAOHaus Graph endpoint from [the docs]('https://docs.daohaus.c…
dysbulic Aug 13, 2024
7cde476
maybe this Graph will work 🛰️
dysbulic Aug 13, 2024
c509513
making attestations non-conditional 🚤
dysbulic Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

83 changes: 0 additions & 83 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ tsconfig.tsbuildinfo
# Ceramic daemon
ipfs
packages/backend/uploads/
*.key
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/iron
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"develop"
]
}
{
"githubPullRequests.ignoredPullRequestBranches": [
"develop"
],
"typescript.tsdk": "node_modules/typescript/lib"
}
7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

preferInteractive: true

progressBarStyle: simba

checksumBehavior: update
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
HASURA_GRAPHQL_DEV_MODE: ${HASURA_GRAPHQL_DEV_MODE:-false}

database:
image: postgres:12
image: postgres:16
volumes:
- database:/var/lib/postgresql/data
ports:
Expand All @@ -39,6 +39,8 @@ services:
context: .
dockerfile: ./docker/backend/Dockerfile
target: base
args:
CACHEBUST: ${CACHEBUST:-$(date +%s)}
command: yarn backend:dev
ports:
- 4000:4000
Expand Down
93 changes: 58 additions & 35 deletions docker/backend/Dockerfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dysbulic Does line 41 change need an actual url link also?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or it's fine because line 44 refers to the env? I'm still getting backend build fails on the test build for dAcademy PR. @dysbulic

Original file line number Diff line number Diff line change
@@ -1,65 +1,88 @@
FROM node:20-slim as base
FROM node:20-slim AS base
WORKDIR /usr/src/app

# varying arg to prevent caching
# ARG CACHEBUST

# Install dependencies not included in the slim image
RUN apt-get update && \
apt-get install -y --no-install-recommends g++ make python3 git openssl && \
apt-get install -y --no-install-recommends --reinstall ca-certificates

# Install dependencies for dev and prod
COPY package.json .
COPY lerna.json .
COPY yarn.lock .
COPY schema.graphql .
COPY tsconfig.base.json .
COPY package.json ./
COPY lerna.json ./
COPY yarn.lock ./
COPY schema.graphql ./
COPY tsconfig.base.json ./
COPY packages/backend/*.json ./packages/backend/
COPY packages/utils/*.json ./packages/utils/
COPY packages/discord-bot/*.json ./packages/discord-bot/
# Not needed for the backend, but the --immutable flag fails w/o them
COPY packages/design-system/package.json ./packages/design-system/
COPY packages/web/package.json ./packages/web/

RUN corepack enable
RUN yarn config set nodeLinker node-modules
RUN yarn install --immutable

RUN yarn install --pure-lockfile
# RUN set -x && echo $CACHEBUST && ls -la

# Dev environment doesn't run this stage or beyond
FROM base as build
# Dev environment doesn't run beyond here
FROM base AS build

# Copy source files
COPY packages/backend ./packages/backend/
COPY packages/utils ./packages/utils/
COPY packages/discord-bot ./packages/discord-bot/
COPY packages/@types ./packages/@types/
COPY packages/backend/ ./packages/backend/
COPY packages/utils/ ./packages/utils/
COPY packages/discord-bot/ ./packages/discord-bot/
COPY packages/@types/ ./packages/@types/

# Set env vars
ARG GRAPHQL_HOST=hasura
ARG GRAPHQL_DOMAIN=onrender.com
ARG GRAPHQL_URL=https://$GRAPHQL_HOST.$GRAPHQL_DOMAIN/v1/graphql
ARG THE_GRAPH_API_TOKEN=unspecified
ARG GRAPHQL_HOST
ARG GRAPHQL_DOMAIN
ARG GRAPHQL_URL
ARG THE_GRAPH_API_TOKEN

ENV GRAPHQL_URL $GRAPHQL_URL
ENV HASURA_GRAPHQL_ADMIN_SECRET metagame_secret
ENV THE_GRAPH_API_TOKEN $THE_GRAPH_API_TOKEN
ENV GRAPHQL_URL=$GRAPHQL_URL
ENV HASURA_GRAPHQL_ADMIN_SECRET=metagame_secret
ENV THE_GRAPH_API_TOKEN=$THE_GRAPH_API_TOKEN

# Build
RUN yarn backend:build

# Delete devDependencies
RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline
#RUN corepack enable
# RUN yarn workspaces focus @metafam/backend --production # --immutable
# RUN yarn install --immutable
# RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

# Create completely new stage including only necessary files
FROM node:20-slim as app
FROM node:20-slim AS app
WORKDIR /app

ARG CACHEBUST

# Copy necessary files into the stage
COPY --from=build /usr/src/app/package.json ./package.json
COPY --from=build /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/yarn.lock ./
COPY --from=build /usr/src/app/package.json ./
#COPY --from=build /usr/src/app/node_modules ./

COPY --from=build /usr/src/app/packages/backend/package.json ./packages/backend/
COPY --from=build /usr/src/app/packages/backend/dist/ ./packages/backend/dist/
#COPY --from=build /usr/src/app/packages/backend/node_modules ./packages/backend/
# RUN mkdir -p ./packages/backend/node_modules

COPY --from=build /usr/src/app/packages/utils/package.json ./packages/utils/
COPY --from=build /usr/src/app/packages/utils/dist/ ./packages/utils/dist/
#COPY --from=build /usr/src/app/packages/utils/node_modules ./packages/utils/

COPY --from=build /usr/src/app/packages/discord-bot/package.json ./packages/discord-bot/
COPY --from=build /usr/src/app/packages/discord-bot/dist/ ./packages/discord-bot/dist/

COPY --from=build /usr/src/app/packages/backend/package.json ./packages/backend/package.json
COPY --from=build /usr/src/app/packages/backend/dist ./packages/backend/dist
COPY --from=build /usr/src/app/packages/backend/node_modules ./packages/backend/node_modules
RUN corepack enable
RUN yarn config set nodeLinker node-modules
RUN yarn workspaces focus @metafam/backend --production # --immutable
RUN yarn cache clean

COPY --from=build /usr/src/app/packages/utils/package.json ./packages/utils/package.json
COPY --from=build /usr/src/app/packages/utils/dist ./packages/utils/dist
COPY --from=build /usr/src/app/packages/utils/node_modules ./packages/utils/node_modules
RUN echo $CACHEBUST && ls -la packages/*/

COPY --from=build /usr/src/app/packages/discord-bot/package.json ./packages/discord-bot/package.json
COPY --from=build /usr/src/app/packages/discord-bot/dist ./packages/discord-bot/dist

CMD ["yarn", "backend", "start"]
CMD ["yarn", "workspace", "@metafam/backend", "start"]
18 changes: 11 additions & 7 deletions docker/discord-bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-slim as base
FROM node:20-slim AS base
WORKDIR /usr/src/app

# Install dependencies not included in the slim image
Expand All @@ -15,10 +15,12 @@ COPY tsconfig.base.json .
COPY packages/discord-bot/*.json ./packages/discord-bot/
COPY packages/utils/*.json ./packages/utils/

RUN yarn install --pure-lockfile
RUN corepack enable
RUN yarn config set nodeLinker node-modules
RUN yarn install # --immutable

# Dev environment doesn't run this stage or beyond
FROM base as build
FROM base AS build

# Copy source files
COPY packages/discord-bot ./packages/discord-bot/
Expand All @@ -28,14 +30,16 @@ COPY packages/@types ./packages/@types/
# Set env vars
ARG GRAPHQL_HOST

ENV GRAPHQL_URL https://$GRAPHQL_HOST.onrender.com/v1/graphql
ENV HASURA_GRAPHQL_ADMIN_SECRET metagame_secret
ENV GRAPHQL_URL=https://$GRAPHQL_HOST.onrender.com/v1/graphql
ENV HASURA_GRAPHQL_ADMIN_SECRET=metagame_secret

# Build
RUN yarn discord-bot build

# Delete devDependencies
RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline
RUN corepack enable
RUN yarn config set nodeLinker node-modules
RUN yarn workspaces focus @metafam/discord-bot --production # --immutable
# RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

# Create completely new stage including only necessary files
FROM node:20-slim as app
Expand Down
37 changes: 25 additions & 12 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@ FROM node:20-slim AS base
WORKDIR /usr/src/app

# Install dependencies not included in the slim image
RUN apt-get update && apt-get install -y --no-install-recommends g++ make python3 git ca-certificates
RUN apt update && apt install -y --no-install-recommends g++ make python3 git ca-certificates

# Install dependencies for dev and prod
COPY package.json ./
COPY lerna.json ./
COPY yarn.lock ./
COPY schema.graphql ./
COPY tsconfig.*json ./
COPY .eslintrc.cjs ./
COPY packages/web/*.json ./packages/web/
COPY packages/web/codegen.ts ./packages/web/
COPY packages/web/graphql ./packages/web/graphql/
COPY packages/utils/*.json ./packages/utils/
COPY packages/design-system/*.json ./packages/design-system/
# Needed for an immutable `yarn install`
COPY packages/discord-bot/*.json ./packages/discord-bot/
COPY packages/backend/*.json ./packages/backend/

RUN yarn install --pure-lockfile
RUN corepack enable
RUN yarn config set nodeLinker node-modules
RUN yarn install --immutable

FROM base AS build

Expand All @@ -41,14 +44,14 @@ FROM build AS build-production

# Each ENV below must have an ARG as well to be available at runtime
ARG APP_ENV
ARG GRAPHQL_URL https://api.metagame.wtf/v1/graphql
ARG FRONTEND_URL https://metagame.wtf
ARG GRAPHQL_URL=https://api.metagame.wtf/v1/graphql
ARG FRONTEND_URL=https://metagame.wtf
ARG IMGIX_TOKEN
ARG YOUTUBE_API_KEY
ARG HONEYBADGER_API_KEY
ARG GOOGLE_ANALYTICS_ID
ARG USERBACK_TOKEN
ARG CERAMIC_URL https://ceramic.metagame.wtf
ARG CERAMIC_URL=https://ceramic.metagame.wtf
ARG WEB3_STORAGE_TOKEN
ARG OPENSEA_API_KEY
ARG GCAL_CALENDAR_ID
Expand Down Expand Up @@ -85,33 +88,43 @@ ENV GCAL_CLIENT_EMAIL=$GCAL_CLIENT_EMAIL
ENV GCAL_PROJECT_NUMBER=$GCAL_PROJECT_NUMBER

ONBUILD RUN yarn web:build
# Delete devDependencies
ONBUILD RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

FROM build AS build-development
ONBUILD RUN yarn web:deps:build

FROM "build-$TARGET" as built
FROM "build-$TARGET" AS built

# New stage including only necessary files
FROM node:20-slim AS app
WORKDIR /app

# Copy necessary files into the stage
COPY --from=built /usr/src/app/package.json ./
COPY --from=built /usr/src/app/node_modules/ node_modules/
# COPY --from=built /usr/src/app/node_modules/ ./

# Copy the built web app
FROM app AS copy-production

# ARG CACHEBUST

ONBUILD COPY --from=built /usr/src/app/packages/utils/package.json packages/utils/
ONBUILD COPY --from=built /usr/src/app/packages/utils/dist/ packages/utils/dist/
ONBUILD COPY --from=built /usr/src/app/packages/design-system/package.json packages/design-system/
ONBUILD COPY --from=built /usr/src/app/packages/design-system/dist/ packages/design-system/dist/
ONBUILD COPY --from=built /usr/src/app/packages/web/package.json packages/web/
ONBUILD COPY --from=built /usr/src/app/packages/web/node_modules/ packages/web/node_modules/
# ONBUILD COPY --from=built /usr/src/app/packages/web/node_modules packages/web/
ONBUILD COPY --from=built /usr/src/app/packages/web/public/ packages/web/public/
ONBUILD COPY --from=built /usr/src/app/packages/web/.next/ packages/web/.next/

ONBUILD RUN apt update && apt install -y --no-install-recommends git ca-certificates

ONBUILD RUN corepack enable
ONBUILD RUN yarn config set nodeLinker node-modules
ONBUILD RUN yarn workspaces focus @metafam/web --production # --immutable
# ONBUILD RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

ONBUILD RUN ls -la packages/*/

ONBUILD CMD ["yarn", "web", "start"]

# Copy the sources
Expand Down
Loading
Loading