- Test:
- Deploy Client to GitHub Pages:
- Deploy Client to GCP Storage:
- Deploy API server with pm2 deploy:
- Netlify:
- Vercel ( GitHub Deployments by shields.io )
-
GitHub Pages: https://lumakernel.github.io/frourio-sample-1
-
GCP Cloud Storage + LB + Cloud CDN: https://www.frourio-sample-1.luma.place/
-
Use Lambda version for backend
- GCP VM and load balancer: https://api.frourio-sample-1.luma.place/
- AWS Lambda (serverless): https://8d9g90gifk.execute-api.ap-northeast-1.amazonaws.com/
- Deploy server to GCE + GCP LB
- Use pm2 graceful start
- Deploy client to Cloud CDN + GCS
- Use fluent-logger
-
Deploy server to GAE- Some problems:
- Read-only. I can't use sqlite and write images.
- Fully controlled by App Engine. We should use single package.json or take workspace (by yarn workspace, lerna, or npm v7 or above workspace) strategy.
- We can use
preinstall
script for this purpose, but it does not look smart.
- We can use
- Some problems:
I'm using the setup script like this with Ubuntu20.04
#!/bin/bash
sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt update
sudo apt install -y git nodejs
sudo mkdir -p /opt/apiserver
sudo mkdir -p /srv/apiserver
USER="ci"
sudo chown "$USER:$USER" /opt/apiserver
sudo chown "$USER:$USER" /srv/apiserver
And setting GitHub Actions secrets like this.
API_DEPLOY_HOST= host ip got from GCP console
API_DEPLOY_KNOWN_HOSTS= run `ssh-keyscan -H $host` for above host
API_DEPLOY_SSH_KEY= ssh private key that can access to above host registered by GCE metadata
API_DEPLOY_USER=ci
API_DATABASE_URL=file:/srv/apiserver/prod.db
API_JWT_SECRET=supersecret
API_BASE_PATH=/api
API_ORIGIN=https://api.frourio-sample-1.luma.place
API_USER_ID=myuser
API_USER_PASS=mypass
API_SERVER_PORT=8080
API_USER_STATIC_DIR=/srv/apiserver/static
AWS_REGION=ap-northeast-1
AWS_LAMBDA_FUNCTION_NAME_SERVER=your lambda name 1
AWS_LAMBDA_FUNCTION_NAME_MIGRATION=your lambda name 2
AWS_ACCESS_KEY_ID= your akid
AWS_SECRET_ACCESS_KEY= your secret
GCP_BUCKET_BASE_PATH=
This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3001 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
This is example for constructing infrastructures.
(Created by Cloudcraft)
I'm using this repo for my GCP playground.
- https://scrapbox.io/lookmark/B:_Installing_the_Cloud_Logging_agent_on_a_single_VM_%C2%A0%7C%C2%A0_Google_Cloud
- https://scrapbox.io/lookmark/B:_Google_Cloud_for_AWS_Professionals
- https://scrapbox.io/lookmark/B:_Using_Google-managed_SSL_certificates_%C2%A0%7C%C2%A0_Load_Balancing_%C2%A0%7C%C2%A0_Google_Cloud
- https://scrapbox.io/lookmark/B:_How_To_Host_a_Next.js_Static_Website_With_GCP_Cloud_Storage_%7C_by_Bhargav_Bachina_%7C_Bachina_Labs_%7C_Medium