Giter Club home page Giter Club logo

new-support-tools's Introduction

new-support-tools

Next + サーバーレスなモダンなフレームワークで実装する

ファイル構成

.
├── Dockerfile
├── README.md
├── docker-compose.yml
├── lambda -> lambdaのディレクトリ
│   └── SampleFunction
│       ├── Dockerfile
│       ├── entry.sh
│       ├── go.mod
│       └── main.go
└── support-tools -> Nextのディレクトリ
    ├── README.md
    ├── next-env.d.ts
    ├── next.config.js
    ├── package.json
    ├── pages
    │   ├── _app.tsx
    │   ├── api
    │   │   └── hello.ts
    │   └── index.tsx
    ├── public
    │   ├── favicon.ico
    │   └── vercel.svg
    ├── styles
    │   ├── Home.module.css
    │   └── globals.css
    ├── tsconfig.json
    └── yarn.lock

nodeのライブラリ一覧

  • Nextjs
  • typescript
  • tRPC
  • jest
  • tailwind
  • material-ui

立ち上げ方法

  1. まずold-support-toolsのdbをマイグレートした後に立ち上げてください(GO言語でのマイグレーションは作成していません) LambdaではこのDBに接続します。
docker compose up db
  1. その後、new-support-toolsのDockerを立ち上げます
docker compose up --build

注意: 以下のエラーが出た場合

ERROR [new-support-tools_sample-function internal] load metadata for public.ecr.aws/lambda/provided:al2 => ERROR [new-support-tools_support-tools internal] load metadata for docker.io/library/node:18-alpine

Lambdaを立ち上げるために以下のコマンドでLoginを行う必要がある可能性があります

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws

注意: Windowsの場合、改行コードの変更が必要な可能性があり

 exec /entry.sh: no such file or directory というようなエラーが発生した場合は改行コードを変更する必要があり  詳しくは以下のwebサイトなどを参考のこと How to fix “exec user process caused: no such file or directory” in Docker on Windows?

注意: DBのHOST_NAMEについて

環境によっては以下のケバブケースに書き換える必要がある可能性があります。

HOST_NAME=old-support-tools-db-1

serverless-nextjsのデプロイ方法

注意: まず、AWSのconfigなどが設定されており、その設定が、デプロイしたい環境になっていることを確認してください

serverless-nextjsのデストロイ方法

npx [email protected] remove

ただ、全てのリソースがdestoryされないので注意が必要(要チェック)

https://blog.hey3.dev/posts/deploy-nextjs-to-aws

usage

  • Nextの表示

以下のurlをブラウザで表示することでNextの画面が表示できる

http://localhost:3001/
  • Lambdaの仕様

以下のurlでlocalのLambdaにアクセスできます。

http://localhost:9000/2015-03-31/functions/function/invocations

以下のようにcurlで叩くとDBから持ってきたcgg_idの結果が返ってきます

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

結果例

{"message":"cgg_id: GL1004","statusCode":200}

new-support-tools's People

Contributors

ifhito avatar as-28 avatar takenokoroid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.