From 779cba97c96b576a2e070cf434d452255f8ca2b4 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Thu, 17 Dec 2020 22:49:16 -0800 Subject: [PATCH] chore: updated contributing guide to include docker version --- CONTRIBUTING.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3288930..6ca1a09 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,18 @@ ## Database migrations +### Docker + +Note: Up migrations are automatically executed when the application is run. + +```bash +docker run --rm --mount type=bind,source="${PWD}",target=/root onepanel-helper:v1.0.0 goose -dir db/sql create sql # Create migration in db/sql folder +docker run --rm --mount type=bind,source="${PWD}",target=/root onepanel-helper:v1.0.0 goose -dir db postgres "${DB_DATASOURCE_NAME}" up # Migrate the DB to the most recent version available +docker run --rm --mount type=bind,source="${PWD}",target=/root onepanel-helper:v1.0.0 goose -dir db postgres "${DB_DATASOURCE_NAME}" down # Roll back the version by 1 +docker run --rm --mount type=bind,source="${PWD}",target=/root onepanel-helper:v1.0.0 goose help # See all available commands +``` + +### Local + Install `goose`: ```bash go get -u github.com/pressly/goose/cmd/goose @@ -8,13 +21,15 @@ go get -u github.com/pressly/goose/cmd/goose Note: Up migrations are automatically executed when the application is run. ```bash -goose -dir db create sql # Create migration in db folder +goose -dir db/sql create sql # Create migration in db/sql folder goose -dir db postgres "${DB_DATASOURCE_NAME}" up # Migrate the DB to the most recent version available goose -dir db postgres "${DB_DATASOURCE_NAME}" down # Roll back the version by 1 goose help # See all available commands ``` -## gRPC installation +## gRPC + +### local installation Install gRPC: ```bash @@ -47,6 +62,15 @@ Make sure that your `$GOBIN` is in your `$PATH`. ## API code generation +### Docker + +Generate Go and Swagger APIs: +```bash +docker run --rm --mount type=bind,source="${PWD}",target=/root onepanel-helper:v1.0.0 make api version=1.0.0 +``` + +### Local Installation + Generate Go and Swagger APIs: ```bash make api version=1.0.0