Skip to content

LumaKernel/frourio-sample-1

Repository files navigation

Badges

  • Test:
    • Official: Test
    • shields.io: Test
  • Deploy Client to GitHub Pages:
    • Official: Deploy client
    • shields.io: Deploy client
  • Deploy Client to GCP Storage:
    • Official: Deploy client to GCP Storage
    • shields.io: Deploy client to GCP Storage
  • Deploy API server with pm2 deploy:
    • Official: Deploy server
    • shields.io: Deploy server
  • Netlify:
    • Official: Netlify Status
    • shields.io:
  • Vercel ( GitHub Deployments by shields.io )
    • Production:
    • Preview:
    • Production backing lambda:

Deployments

Client

Server

My personal goals

  • 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.

Deploy to GCE as an exmpale using pm2 deploy

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=

Diff

Information

This is a Next.js project bootstrapped with create-next-app.

Getting Started

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.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

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.

Deploy server on Lambda

This is example for constructing infrastructures.

frourio-sample-1-lambda (Created by Cloudcraft)

My personal notes about this, motsly about GCP (Japanese)

I'm using this repo for my GCP playground.