From 2fc957e9ec2698d788d0978e1c64cb15ebb194d8 Mon Sep 17 00:00:00 2001 From: Quanzheng Long Date: Fri, 11 Sep 2020 12:48:13 -0700 Subject: [PATCH] Improve developer contribution guide for Postgres development (#3495) --- CONTRIBUTING.md | 8 ++++++-- docs/persistence.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c6128d7877b..b1e38d5ed07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,12 @@ This doc is intended for contributors to `cadence` server (hopefully that's you!) -**Note:** All contributors also need to fill out the [Uber Contributor License Agreement](http://t.uber.com/cla) before we can merge in any of your changes +>Note: All contributors also need to fill out the [Uber Contributor License Agreement](http://t.uber.com/cla) before we can merge in any of your changes ## Development Environment -* Go. Install on OS X with `brew install go`. +* Golang. Install on OS X with `brew install go`. +>Note: If running into any compiling issue, make sure you upgrade to the latest stable version of Golang. ## Checking out the code @@ -59,6 +60,9 @@ make bins ## Testing +>Note: The default setup of Cadence depends on Cassandra and Kafka(is being deprecated). +This section assumes you are testing with them, too. Please refer to [persistence documentation](https://github.com/uber/cadence/blob/master/docs/persistence.md) if you want to test with others like MySQL/Postgres. + Before running the tests you must have `cassandra`, `kafka`, and its `zookeeper` dependency: ```bash diff --git a/docs/persistence.md b/docs/persistence.md index b267f53bcab..98bc915da11 100644 --- a/docs/persistence.md +++ b/docs/persistence.md @@ -35,7 +35,14 @@ brew services start mysql cd $GOPATH/github.com/uber/cadence make install-schema-mysql ``` +When run tests and CLI command locally, Cadence by default uses a user `uber` with password `uber`, with privileges of creating databases. +You can use the following command to create user(role) and grant access. +In the mysql shell: +``` +> CREATE USER 'uber' IDENTIFIED BY 'uber'; +> GRANT All Privileges to 'uber'; +``` ### Start cadence server ``` cd $GOPATH/github.com/uber/cadence @@ -43,6 +50,34 @@ cp config/development_mysql.yaml config/development.yaml ./cadence-server start --services=frontend,matching,history,worker ``` +## PostgresQL +### Start PostgresQL server +``` +brew install postgres +brew services start postgres +``` +When run tests and CLI command locally, Cadence by default uses a superuser `postgres` with password `cadence`. +You can use the following command to create user(role) and grant access: +``` +$psql postgres +postgres=# CREATE USER postgres WITH PASSWORD 'cadence'; +CREATE ROLE +postgres=# ALTER USER postgres WITH SUPERUSER; +ALTER ROLE +``` +### Install cadence schema +``` +cd $GOPATH/github.com/uber/cadence +make install-schema-postgres +``` + +### Start cadence server +``` +cd $GOPATH/github.com/uber/cadence +cp config/development_postgres.yaml config/development.yaml +./cadence-server start --services=frontend,matching,history,worker +``` + # Configuration ## Common to all persistence implementations There are two major sub-subsystems within cadence that need persistence - cadence-core and visibility. cadence-core is