rentbook

command module
v0.0.0-...-d4bccd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 31 Imported by: 0

README

RentBook Project

Test and Release Docker in main branch - GitHub Packages codecov

Aplikasi yang membantu manajement untuk mengirim dan menerima buku antara pengguna.

Arsitekture dan Task:

Setup Environment Variable

Env yang di perlukan agar aplikasi bisa berjalan .env


### DATABASE ###
DB_DRIVER=mysql
DB_USERNAME=alterra_rent_book
DB_PASSWORD=test
DB_NAME=alterra_rent_book_db
DB_ADDRESS='127.0.0.1'
DB_PORT=3306
MYSQL_ROOT_PASSWORD=root

### Redis ###
REDIS_ADDRESS=localhost
REDIS_PORT=6379
REDIS_USERNAME="alterra_rent_book"
REDIS_PASSWORD="password"

### APP CONFIGURATION ###
APP_HOST='127.0.0.1'
APP_PORT=8000
JWT_SECRET=secret
API_ENDPOINT='127.0.0.1:8000'

Note:

  • API_ENDPOINT is using by swagger gui to where are the endpoint

Deploy to Server (Dockerize)

Untuk deploy ke server pastikan docker dan docker compose terinstall ke dalam server pada env varibel ubah API_ENDPOINT sesuai dengan nama host server.

Run In Server:

  1. Build docker image for the source code
  2. Push docker image into repository provider like hub.docker.com
  3. copy the .env and docker-compose the replace the docker-compose with bellow
  web-app:
    restart: always
    build:
      dockerfile: Dockerfile
      context: .

with

  web-app:
    restart: always
    image: <repo_name>/<image_name>:<tag>

Note: Replace <repo_name>, <image_name> and with own docker hub configuration

Testing

  • Run All test
    go test ./...
  • Run All test with coverage output
    go test ./... -v -coverprofile=coverage.out
  • Output the coverage into html file
    go tool cover -html=coverage.out

Bootup Server (Amazon ES2)

To bootup server is easy after all above requirement is fullfilled. The important part is setup inbounding incoming request security to allow the HTTP and HTTPS Port

  1. Start the server just docker-compose up -d
    The app now run in server and start automaticaly in background

Deploy Cli Cmd

chmod +x deploy.sh
./deploy.sh \
app_port=8000 \
app_name=go_book \
app_domain=gobook.satulayar.com \
mysql_root_password=root \
app_user=rentbook \
app_password=rentbook \
jwt_secret=secret \
app_image="ghcr.io/alta-be7-i-kadek-adi-gunawan/rentbook" \
app_tag=main

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
delivery
Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT This file was generated by swaggo/swag
repository
usecase

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL