redwoodjs v3 tutrial
v2 でやってたけど v3 がでたので仕切り直し
8910
port にアクセスしても何もでてこない
root@aee4bd92b7cb:/app# dum rw dev
$ rw
$ /app/node_modules/.bin/rw dev
gen | Generating TypeScript definitions and GraphQL schemas...
gen | 14 files generated
api | Building... Took 496 ms
api | Debugger listening on ws://127.0.0.1:18911/f7b78bf7-0b9b-4b18-92d2-52482ea75651
api | For help, see: https://nodejs.org/en/docs/inspector
api | Starting API Server...
api | Loading server config from /app/api/server.config.js
api |
api | 08:39:06 🌲 Configuring api side
api | 🗒 Custom
api | {
api | "options": {
api | "side": "api",
api | "_": [
api | "api"
api | ],
api | "port": 8911,
api | "p": 8911,
api | "apiRootPath": "/",
api | "rootPath": "/",
api | "root-path": "/",
api | "api-root-path": "/",
api | "$0": "node_modules/@redwoodjs/api-server/dist/index.js"
api | }
api | }
api | Importing Server Functions...
api | /graphql 802 ms
api | ...Done importing in 803 ms
api | Took 882 ms
api | API listening on http://localhost:8911/
api | GraphQL endpoint at /graphql
api | 08:39:06 🐛 Fastify server configuration
api | 🗒 Custom
api | {
api | "requestTimeout": 15000,
api | "connectionTimeout": 0,
api | "keepAliveTimeout": 72000,
api | "maxRequestsPerSocket": 0,
api | "requestIdHeader": "request-id",
api | "requestIdLogLabel": "reqId",
api | "disableRequestLogging": false,
api | "bodyLimit": 1048576,
api | "caseSensitive": true,
api | "allowUnsafeRegex": false,
api | "ignoreTrailingSlash": false,
api | "ignoreDuplicateSlashes": false,
api | "jsonShorthand": true,
api | "maxParamLength": 100,
api | "onProtoPoisoning": "error",
api | "onConstructorPoisoning": "error",
api | "pluginTimeout": 10000,
api | "http2SessionTimeout": 72000,
api | "exposeHeadRoutes": true
api | }
api | 08:39:06 🐛 Registered plugins
api | bound root 844 ms
api | ├── bound _after 4 ms
api | ├── @fastify/url-data 0 ms
api | ├── fastify-raw-body 0 ms
api | ├── bound _after 0 ms
api | ├── bound _after 0 ms
api | ├── bound _after 0 ms
api | ├── bound _after 0 ms
api | └── bound _after 0 ms
api |
api | 08:39:06 🌲 Server listening at http://[::]:8911
web | assets by path static/js/*.js 2.89 MiB
web | asset static/js/app.bundle.js 2.84 MiB [emitted] (name: app) 1 related asset
web | asset static/js/runtime-app.bundle.js 51 KiB [emitted] (name: runtime-app) 1 related asset
web | asset static/js/src_pages_NotFoundPage_NotFoundPage_tsx.chunk.js 3.49 KiB [emitted] 1 related asset
web | asset favicon.png 1.7 KiB [emitted] [from: public/favicon.png] [copied]
web | asset index.html 483 bytes [emitted]
web | asset robots.txt 24 bytes [emitted] [from: public/robots.txt] [copied]
web | Entrypoint app 2.89 MiB (2.79 MiB) = static/js/runtime-app.bundle.js 51 KiB static/js/app.bundle.js 2.84 MiB 2 auxiliary assets
web | 885 modules
web | webpack 5.74.0 compiled successfully in 4531 ms
api | 08:39:15 🌲 incoming request GET xxx /
api | 08:39:15 🚨 Function "" was not found.
api | 08:39:15 🌲 request completed 9ms
過去の自分に助けられた。
app_1 | $ rw
app_1 | $ /app/node_modules/.bin/rw dev
app_1 | gen | Generating TypeScript definitions and GraphQL schemas...
app_1 | api | Building... Took 1727 ms
app_1 | api | Debugger listening on ws://127.0.0.1:18911/70e4212d-541b-41c6-a020-a50979e68464
app_1 | api | For help, see: https://nodejs.org/en/docs/inspector
app_1 | gen | 14 files generated
app_1 | api | Starting API Server...
app_1 | api | Loading server config from /app/api/server.config.js
app_1 | api |
app_1 | api | 08:46:06 🌲 Configuring api side
app_1 | api | 🗒 Custom
app_1 | api | {
app_1 | api | "options": {
app_1 | api | "side": "api",
app_1 | api | "_": [
app_1 | api | "api"
app_1 | api | ],
app_1 | api | "port": 8911,
app_1 | api | "p": 8911,
app_1 | api | "apiRootPath": "/",
app_1 | api | "rootPath": "/",
app_1 | api | "root-path": "/",
app_1 | api | "api-root-path": "/",
app_1 | api | "$0": "node_modules/@redwoodjs/api-server/dist/index.js"
app_1 | api | }
app_1 | api | }
app_1 | api | Importing Server Functions...
app_1 | api | /graphql 819 ms
app_1 | api | ...Done importing in 821 ms
app_1 | api | Took 883 ms
app_1 | api | API listening on http://localhost:8911/
app_1 | api | GraphQL endpoint at /graphql
app_1 | api | 08:46:07 🐛 Fastify server configuration
app_1 | api | 🗒 Custom
app_1 | api | {
app_1 | api | "requestTimeout": 15000,
app_1 | api | "connectionTimeout": 0,
app_1 | api | "keepAliveTimeout": 72000,
app_1 | api | "maxRequestsPerSocket": 0,
app_1 | api | "requestIdHeader": "request-id",
app_1 | api | "requestIdLogLabel": "reqId",
app_1 | api | "disableRequestLogging": false,
app_1 | api | "bodyLimit": 1048576,
app_1 | api | "caseSensitive": true,
app_1 | api | "allowUnsafeRegex": false,
app_1 | api | "ignoreTrailingSlash": false,
app_1 | api | "ignoreDuplicateSlashes": false,
app_1 | api | "jsonShorthand": true,
app_1 | api | "maxParamLength": 100,
app_1 | api | "onProtoPoisoning": "error",
app_1 | api | "onConstructorPoisoning": "error",
app_1 | api | "pluginTimeout": 10000,
app_1 | api | "http2SessionTimeout": 72000,
app_1 | api | "exposeHeadRoutes": true
app_1 | api | }
app_1 | api | 08:46:07 🐛 Registered plugins
app_1 | api | bound root 864 ms
app_1 | api | ├── bound _after 6 ms
app_1 | api | ├── @fastify/url-data 1 ms
app_1 | api | ├── fastify-raw-body 0 ms
app_1 | api | ├── bound _after 0 ms
app_1 | api | ├── bound _after 1 ms
app_1 | api | ├── bound _after 1 ms
app_1 | api | ├── bound _after 0 ms
app_1 | api | └── bound _after 1 ms
app_1 | api |
app_1 | api | 08:46:07 🌲 Server listening at http://[::]:8911
app_1 | web | assets by path static/js/*.js 2.89 MiB
app_1 | web | asset static/js/app.bundle.js 2.84 MiB [emitted] (name: app) 1 related asset
app_1 | web | asset static/js/runtime-app.bundle.js 51 KiB [emitted] (name: runtime-app) 1 related asset
app_1 | web | asset static/js/src_pages_NotFoundPage_NotFoundPage_tsx.chunk.js 3.49 KiB [emitted] 1 related asset
app_1 | web | asset favicon.png 1.7 KiB [emitted] [from: public/favicon.png] [copied]
app_1 | web | asset index.html 483 bytes [emitted]
app_1 | web | asset robots.txt 24 bytes [emitted] [from: public/robots.txt] [copied]
app_1 | web | Entrypoint app 2.89 MiB (2.79 MiB) = static/js/runtime-app.bundle.js 51 KiB static/js/app.bundle.js 2.84 MiB 2 auxiliary assets
app_1 | web | 885 modules
app_1 | web | webpack 5.74.0 compiled successfully in 5505 ms
app_1 | api | 08:47:20 🌲 incoming request POST xxx /graphql
app_1 | api | 08:47:20 🐛 Parsing request to extract GraphQL parameters
app_1 | api | (node:292) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
app_1 | api | (Use `node --trace-warnings ...` to show where the warning was created)
app_1 | api | 08:47:20 🌲 request completed 78ms
app_1 | api | 08:47:20 🐛 Processing GraphQL Parameters
app_1 | api | 08:47:20 🐛 Execution start
app_1 | api | 08:47:20 🐛 Received GraphQL operation:
app_1 | api | 08:47:20 🐛 undefined
app_1 | api | 🔭 Query
app_1 | api | "query RedwoodVersion { redwood { version } }"
app_1 | api | 08:47:20 🐛 graphql-server GraphQL execution started: RedwoodVersion
app_1 | api | 08:47:20 🐛 Execution end
app_1 | api | 08:47:20 🐛 undefined
app_1 | api | 08:47:20 🐛 graphql-server GraphQL execution completed: RedwoodVersion
うごいた
react18 に迂闊に上げてしまったのが原因っぽい
ここまで進めた
v3.0 と v3.1 でまた微妙に scaffold の挙動とか変わってるやんけえ
scaffold だけやり直すか
たまに型の参照が効かなくなるけど、
yarn rw g types
して
するとだいたい直る
https://redwoodjs.com/docs/tutorial/chapter4/deployment を進める前に、local でも postgresdb のセットアップ
こんん感じで migrate
deploy
netlify に上げたけど出て来ない
netlify.toml
作った分を push してなかった
In this tutorial, your serverless functions will be connecting directly to the Postgres database. Because Postgres has a limited number of concurrent connections it will accept, this does not scale—imagine a flood of traffic to your site which causes a 100x increase in the number of serverless function calls. Netlify (and behind the scenes, AWS) will happily spin up 100+ serverless Lambda instances to handle the traffic. The problem is that each one will open its own connection to your database, potentially exhausting the number of available connections. The proper solution is to put a connection pooling service in front of Postgres and connect to that from your lambda functions. To learn how to do that, see the Connection Pooling guide.
企業利用は難しいかもなァ
RDS 利用で、接続プールを VPC 内に作って、外部からはそこにだけアクセスできる、みたいにすればいいのか…?いや、それでもプールへの接続IPの制限はできなさそう。
deploy を VPC 内の lambda に行って、DB へのアクセス処理が VPC 内で完結すれば良い?
無料枠、スケーリングと安定性で見るとアリ?
個人開発の枠を出る可能性があるなら検討の余地はありそう
次章からは別リポジトリで進めてみようかな
まだデプロイできてないヤーン
こうしてるから、base directory の設定変えないといけなかった?
いいぞいいぞ
うごいた。よかった。