フィアットでQuadratic Fundingするツール https://github.com/supermodularxyz/simplegrants
手元で動かそうと試行錯誤したログ
これを見る
You have to use Node version >= 17.5!
% node -vv21.2.0
all you need to do is to change the payment provider in
provider.service.tsto the provider you want to use.
ts
export class ProviderService {
constructor(private readonly prisma: PrismaService) {
this.paymentProvider = new StripeProvider({
prisma,
secret: process.env.PAYMENT_KEY,
country: 'US',
});
}
Stripeを使うためにはこの設定をする必要があるがとりあえず無視
% npm install
:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'next-auth@4.18.8',
npm WARN EBADENGINE required: { node: '^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.12.0' },
npm WARN EBADENGINE current: { node: 'v21.2.0', npm: '10.2.3' }
npm WARN EBADENGINE }
Dockerを立ち上げるのになんでnpmでnext-authをインストールするんだ? とりあえず無視
$ npm run docker:up
コンテナは立ち上がった
$ npm install -g yarn
$ yarn install
$ cp .env.example .env.local
$ yarn dev -p 3001
とりあえず起動はした
API key requiredとは何か
NEXT_PUBLIC_FINGERPRINT_KEYに何を入れるのか調べるこの辺のどこかで本家からcloneしたのを消して https://github.com/Naokiakazawa/simplegrants/tree/verification からやることにした(akazawaさんが隣の席にいたのでその方が効率的と判断)
.envのサンプルにはないけどcodeでprocess.envから設定を読んでる。
Setting up OAuth 2.0 - Google Cloud Platform Console Help
雑に設定してGOOGLE_CLIENT_IDとGOOGLE_CLIENT_SECRETを入れたが'"ikm" must be at least one byte in length'になってしまった
NEXTAUTH_SECRETか
$ openssl rand -base64 32ここまでできた
READMEにそんなことは一言も書いてない
yarn installしてyarn dev -p 3001しろと書いてるのでいかにも普通に動きそう# Prisma ENV
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_CONTAINER}:5432/${POSTGRES_USER}?schema=public&connect_timeout=300"
networks: simplegrants的な設定をしている、これが大事、多分project rootでdocker composeする
$ docker compose -f docker-compose.dev.yml up --buildその後root/backendでDB初期化
$ cd backend$ yarn setup
:All migrations have been successfully applied.
Environment variables loaded from .env
Running seed command `ts-node prisma/seed` ...
An error occurred while running the seed command:
Error: Command failed with ENOENT: ts-node prisma/seed
spawn ts-node ENOENT
http://をhttps://にするミスをしたPublishing status: In productionにした
2024-01-31 02:44:34.623 UTC [93] FATAL: no PostgreSQL user name specified in startup packet$ docker compose -f docker-compose.dev.yml up --builddocker-compose.dev.ymlを使ってるのだから.env.productionではなく.env.localが読まれるdocker composeからやり直したらできた!