On /
dir, Run make copy-env
, Modify to suit your environment, focus on these key, you can leave others as it is. The key name is explanatory itself.
# MAIN APP PORT
GATEWAY_PORT=4050
# DATABASE
POSTGRES_PORT=5432
Without docker, you need to install air-verse to activate the hot reloading.
Docker Install.
- On the root folder, Starts the containers in the background and leaves them running :
docker-compose -f docker/docker-compose-dev.yml up --build -d
- Stops containers and removes containers, networks, volumes, and images :
docker-compose down
Change bash directory to each service.
${arg} means replace all of it match your args without space
- Run export path :
export PATH="$PATH:$(go env GOPATH)/bin"
- Create mirgration :
make migrate-create name=${your_migration_name}
- Run migration :
make migrate-up
- Stepback migraiton:
make migrate-down
- Generate proto file, leave the proto args blank if you want to generate all proto file:
make proto ${your-proto.proto}
. If its fail, run this command on specific service. for example, in /service/ run bashexport PATH="$PATH:$(go env GOPATH)/bin"
- Create seeder :
make seed-create name=${your_seeder_name}
- Run seeder :
make seed-run file=${your_seeder_name}.sql
Change the makefile DB_HOST to localhost
if run in local env, when running on docker, change it to postgres
.
You can run multiple seeder references in the seeder_controller.go file.
Change the 'version' column name on schema_migrations to latest succeed migration, change the 'dirty' column to false, then run the migration again
CREATE EXTENSION IF NOT EXISTS pgcrypto;
All endpoints stored in -.json
Feel free to ask if you have any questions or need more details!