Skip to content

Latest commit

 

History

History
207 lines (141 loc) · 4.15 KB

INSTRUCTIONS.md

File metadata and controls

207 lines (141 loc) · 4.15 KB

⚠️ The instructions below are not final. They change often and may be outdated ⚠️

CONFIGURATION

Add a gigamono.yaml file. See here for instructions. [WIP]

Every other service repo requires gigamono repo to be in parent directory because:

  • the gigamono config file is expected to be found in the gigamono directory.
  • the gigamono directory contains common graphql schema.

DOCKER SETUP

Clone the following repos under the same directory.

git clone github.com/gigamono/gigamono
git clone github.com/gigamono/gigamono-api
git clone github.com/gigamono/gigamono-auth

Follow directions in respective repo to set the up properly.

Change directory.

cd gigamono

Add a .env.docker file following the template .env.docker.sample

Run the following docker-compose command.

docker-compose --env-file ./.env.docker -f docker/compose/local.yaml up

GRAPHQL GENERATION

Build the custom gqlgen binary.

go build cmd/gqlgen/gqlgen.go

Add the binary to system path.

Run command in project root directory.

gqlgen

PROTO GENERATION

Make sure $GOPATH is set to $HOME/go

set -gx $GOPATH $HOME/go

Make sure $GOPATH/bin/ is added to $PATH

set -gx $PATH $GOPATH/bin $PATH

Install protoc

brew install protobuf

Install protoc-gen-go

go get github.com/golang/protobuf/protoc-gen-go

Install protoc-gen-govalidators plugin globally

GO111MODULE="off" go get github.com/mwitkow/go-proto-validators/protoc-gen-govalidators

Compile proto files with this command.

protoc \
	--proto_path=./pkg/services/proto \
	--proto_path=$GOPATH/src \
	--go_out=plugins=grpc:./pkg/services/proto/generated \
	--govalidators_out=./pkg/services/proto/generated \
	--go_opt=paths=source_relative \
	--govalidators_opt=paths=source_relative \
	$(find ./pkg/services/proto -iname "*.proto")

DATABASE

Install postgres

Create postgres databases for the Resource database and the Auth database. For example:

CREATE DATABASE "resourcedb";
CREATE DATABASE "authdb";

Add extensions:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "citext";

Add a .env files in respective following the template .env.docker.sample

Migration

Install goose

go get -u github.com/pressly/goose/cmd/goose

Or follow the instructions here

Run goose command in a directory with migrations or specify with seed directory with --dir flag

goose postgres "postgres://appcypher@localhost:5432/resourcedb?sslmode=disable" up
goose postgres "postgres://appcypher@localhost:5432/resourcedb?sslmode=disable" reset

Check here for more instructions on how to use goose.

Seeding

Clone pgseeder repo and cd into the created folder

git clone https://github.com/gigamono/pgseeder
cd pgseeder

Build the binary.

go build cmd/pgseeder.go

Add the binary to system path and run pgseeder command in a directory with seeds or specify with seed directory with -d flag

pgseeder -c "postgres://appcypher@localhost:5432/resourcedb?sslmode=disable" --add users
pgseeder -c "postgres://appcypher@localhost:5432/resourcedb?sslmode=disable" --add-all -d internal/db/seeds/resource
pgseeder -c "postgres://appcypher@localhost:5432/resourcedb?sslmode=disable" --remove-all

Check here for more instructions on how to use goose.

GENERATING KEYS

Generate private-public key pair with openssl

openssl ecparam -genkey -name secp521r1 -noout -out private.pem
openssl ec -in private.pem -pubout -out public.pem

INSTALLATION [WIP]

Simple Install
curl https://www.gigamono.com/get -sSfL | sh
  • Walks you through the installation.
  • Supports dockerless install for advanced users.
  • Some programs may be required.
    • curl / wget
    • ssh / openssl
    • docker
    • go
    • postgres
Build Install
git clone github.com/gigamono/gigamono
cd gigamono
sh ./install.sh
docker-compose up -f ./docker/compose/local.yaml