Giter VIP home page Giter VIP logo

gotoren / gacha-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 34.77 MB

This project was started to run the gacha API writen by Golang on AWS. Built an API for creating basic applications and designed the infrastructure for operation. It can be run locally with docker-compose. The production will be operated using AWS ECS, AWS RDS (Aurora), etc...

Home Page: https://www.ren510.dev/blog/ca-tech-accel

License: MIT License

Dockerfile 0.88% Makefile 0.46% Go 11.07% HCL 16.99% JavaScript 1.50% Vue 6.17% SCSS 0.08% Python 47.84% Shell 0.05% Jupyter Notebook 14.96%
aws ci-cd docker golang nuxt python3 terraform vue

gacha-api's Introduction

Hi 👋, I'm Ren Goto.

GotoRen

A developer of an overlay network protocol called CYPHONIC at @Pluslab.

Connect with me:

ren510dev ren510dev ren510dev ren510dev ren510dev

Github stats

GitHub stats

Top Langs

trophy

Languages and Tools:

aws gcp terraform docker kubernetes go javascript bash git linux mysql nodejs python react redis typescript

Published on:

IEEEIIICIIISIPSJIEICE

gacha-api's People

Contributors

gotoren avatar kobayashifumiaki avatar

Watchers

 avatar  avatar

Forkers

doctornasa

gacha-api's Issues

[Backend] goモジュールの調整

Modules

  • モジュール名:github.com/GotoRen/gacha-api/api
    • go.mod
    • go.sum

Version

言語/フレームワーク バージョン
Golang go version go1.15 darwin/amd64
MySQL mysql Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)

undefined: r / w

Disputed Point

  • api/controller/gacha.go
if r.Method != http.MethodGet {
	log.Printf("only GET methods are permitted")
    w.WriteHeader(http.StatusMethodNotAllowed)
    return
}

Error

 => ERROR [builder 7/7] RUN go build -o main                                                         5.2s
------
 > [builder 7/7] RUN go build -o main:
#15 5.050 # github.com/fumist23/game-api/controller
#15 5.050 controller/gacha.go:19:5: undefined: r
#15 5.050 controller/gacha.go:21:9: undefined: w
#15 5.050 controller/gacha.go:22:9: not enough arguments to return
#15 5.050 	have ()
#15 5.050 	want ([]model.Character, error)
------
executor failed running [/bin/sh -c go build -o main]: exit code: 2
ERROR: Service 'app' failed to build
make: *** [build] Error 1

Issue

  • ビルド時エラーが発生
  • Dockerfileの分離ができない

[Infra] ui コンテナ化

sample : ) React / Vue | npm / yarn

  • Dockerfile
FROM mhart/alpine-node:10.17 AS builder
WORKDIR /app
COPY package.json ./
COPY yarn.lock .
RUN yarn install
COPY . .
RUN yarn run build

FROM mhart/alpine-node
RUN yarn global add serve
WORKDIR /app
COPY --from=builder /app/build .
EXPOSE 3000
CMD ["serve", "-p", "3000", "-s", "."]
  • docker-compose.yaml
ui:
    container_name: k8s-handson-ui
    build:
      context: ./ui
      dockerfile: ./Dockerfile
    ports:
      - 3000:3000

[Front] Signup機能の実装

  • あれこれって作りかけ??
async userCreateRequest() {
    await this.$axios.$post('/api/user/create',{
    headers: {
    'Content-Type':'application/json'
    },
    body: {
    'name':this.username
    }
    }).then(response => {
    this.token = response.token;
    this.id = response.id;
    this.$store.commit('changeLogin', true);
    this.$store.commit('changeUserData', {
    id: this.id,
    username: this.username,
    token: this.token
    });
    console.log(this.token);
    });
},

Dockerfileの分離

api用Dockerfileとdb用Dockerfileを分離する

  • api
    • golang -> ver 1.15
    • alpine -> ver 3.11.6
  • db
    • mysql -> ver 8.0
  • コンテキスト指定でyamlを実行

[Infra] ログ分析基盤の作成

Logging Pattern

1. CWL -> Lambda -> S3
2. CWL -> Kinesis Data Firehose -> S3
3. CWL -> Kinesis Data Firehose -> Lambda -> S3
4. CWL -> Kinesis Data Streams -> S3

ログインAPIの作成

ログインAPIの作成

  • /user/login的なエンドポイントを作成する
  • id, x-tokenは各ユーザで一意に定まる

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.