cake-service
This application you can run on docker container.
- Docker
- OS Linux Docker Image,
- Golang version 1.19 or latest
$ docker build -t {IMAGE_NAME} -f deployment/dockerfiles/dockerfile .
# example
$ docker build -t cake-service -f deployment/dockerfiles/dockerfile .
# example run http serve:
$ docker run -i --name cake-service -p 8081:8081 -t cake-service
Linux or MacOS
# please read this link installation guide of go
# https://go.dev/doc/install
run command below:
mkdir $HOME/go
mkdir $HOME/go/src
mkdir $HOME/go/pkg
mkdir $HOME/go/bin
mkdir -p $HOME/go/src/github.com/bangcodv/cake-service
chmod -R 775 $HOME/go
cd $HOME/go/src/github.com/bangcodv/cake-service
export GOPATH=$HOME/go
# edit bash profile in $HOME/.bash_profile
# add below to new line in file .bash_profile
PATH=$PATH:$HOME/bin:$HOME/go/bin
export PATH
export GOPATH=$HOME/go
# run command :
source $HOME/.bash_profile
# run command :
cd $HOME/go/src/github.com/bangcodv/cake-service
git clone -b development https://github.com/bangcodv/cake-service .
cd $HOME/go/src/github.com/bangcodv/cake-service
go mod tidy && go mod download && go mod vendor
cp config/app.yaml.dist config/app.yaml
# edit config/app.yaml with server environtment
go build
# run application after build or create on supervisord
./cake-service http
{{host}}/liveness
migration up
go run main.go db:migrate up
migration down
go run main.go db:migrate down
migration reset
go run main.go db:migrate reset
migration reset
go run main.go db:migrate reset
migration redo
go run main.go db:migrate redo
migration status
go run main.go db:migrate status
create migration table
go run main.go db:migrate create {table-name} sql
# example
go run main.go db:migrate create users sql
to show all command
go run main.go db:migrate
docker-compose -f deployment/docker-compose.yaml --project-directory . up -d --build
make sure already have database and table
go run main.go gen:all {tableName}
# example
go run main.go gen:entity users
make sure already have database and table
go run main.go gen:entity {tableName}
# example
go run main.go gen:entity users
no needed database
go run main.go gen:logic {packageName} {fileName}
# example
go run main.go gen:entity users user_create