shorty
This application you can run on docker container.
- Docker
- OS Linux Docker Image,
- Golang version 1.14 or latest
$ docker build -t {IMAGE_NAME} -f deployment/dockerfiles/dockerfile--dev .
# example
$ docker build -t shorty -f deployment/dockerfiles/dockerfile-dev .
# example run http serve:
$ docker run -i --name shorty -p 8081:8081 -t shorty
Linux or MacOS
# please read this link installation guide of go
# https://golang.org/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/aryayunanta-ralali/shorty
chmod -R 775 $HOME/go
cd $HOME/go/src/github.com/ralali
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/aryayunanta-ralali/shorty
git clone -b development https://github.com/aryayunanta-ralali/shorty .
cd $HOME/go/src/github.com/aryayunanta-ralali/shorty
go mod tidy && go mod download && go mod vendor
cp config/app.yaml.tpl config/app.yaml
# edit config/app.yaml with server environtment
go build
# run application after build or create on supervisord
./shorty serve-http
{{host}}/in/health
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