From 1a93d10b8dba08f69da6b2ceeb64ba89d42fc1d3 Mon Sep 17 00:00:00 2001 From: Travis Patterson Date: Tue, 10 Apr 2018 09:27:08 -0600 Subject: [PATCH 1/4] Change github.com/cloudfoundry urls to code.cloudfoundry.org Signed-off-by: Jason Keene --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03e69d3923..3b91205750 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ The Diego team uses GitHub and accepts contributions via [pull request](https:// The `diego-release` repository is a [BOSH](https://github.com/cloudfoundry/bosh) release for Diego. The root of this repository doubles as a Golang [`GOPATH`](https://golang.org/doc/code.html#GOPATH). For more information about configuring your Golang environment and automatically setting your `GOPATH` to the release directory, see the [instructions below](#initial-setup). -All Diego components are submodules in diego-release and can be found in the [`src/github.com/cloudfoundry`](https://github.com/cloudfoundry/diego-release/tree/master/src/github.com/cloudfoundry) and [`src/github.com/cloudfoundry-incubator`](https://github.com/cloudfoundry/diego-release/tree/master/src/github.com/cloudfoundry-incubator) directories of this repository. +All Diego components are submodules in diego-release and can be found in the [`src/code.cloudfoundry.org`](https://github.com/cloudfoundry/diego-release/tree/master/src/code.cloudfoundry.org) directory of this repository. If you wish to make a change to an individual Diego component, submit a pull request to the master branches of its repository. Once accepted, those changes should make their way into `diego-release`. From f0512ef32168f533e06ce188af0917299113c919 Mon Sep 17 00:00:00 2001 From: Jason Keene Date: Tue, 10 Apr 2018 09:27:32 -0600 Subject: [PATCH 2/4] Bump go version in contributing docs Signed-off-by: Travis Patterson --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b91205750..ca7cd776fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ automated system uses, then we manually make the Pull Request as having a CLA on ## Initial Setup This BOSH release doubles as a `$GOPATH`. It will automatically be set up for you if you have [direnv](http://direnv.net) installed. -**NOTE:** diego-release and its components assume you're running go **1.9**. The project may not compile or work as expected with other versions of go. +**NOTE:** diego-release and its components assume you're running go **1.10**. The project may not compile or work as expected with other versions of go. # create parent directory of cf-release and diego-release mkdir -p ~/workspace From c80eecdf927fe31f0d91a0b8d2723e82f2b6eba6 Mon Sep 17 00:00:00 2001 From: Travis Patterson Date: Tue, 10 Apr 2018 09:28:10 -0600 Subject: [PATCH 3/4] Change OS X to MacOS in contributing docs Signed-off-by: Jason Keene --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca7cd776fd..9531fd9070 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,7 +122,9 @@ Metrics added to any of the Diego components need to follow the naming and docum As of Diego 1.0, SQL unit tests are the default unit tests for Diego. To run the SQL unit tests locally requires running MySQL and Postgres with the correct configuration. -On OS X, follow these steps to install and configure MySQL and Postgres: +#### MacOS + +On MacOS, follow these steps to install and configure MySQL and Postgres: 1. Install MySQL: From 11f065de003d746010eea5b52602b4062808733b Mon Sep 17 00:00:00 2001 From: Jason Keene Date: Tue, 10 Apr 2018 09:30:41 -0600 Subject: [PATCH 4/4] Add docker instructions for running tests to contributing docs Signed-off-by: Travis Patterson --- CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9531fd9070..fee6b49de1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -197,6 +197,66 @@ On MacOS, follow these steps to install and configure MySQL and Postgres: This command will run all regular unit tests, as well as BBS and component integration tests where a backing store is required in MySQL-backed and Postgres-backed modes. +#### Docker + +If you would prefer to run the databases using docker follow these steps: + +1. Write out the MySQL config: + + echo -e "[mysqld]\nsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES" > my.cnf + +1. Run MySQL container. Note: Your `my.cnf` should be in the current directory: + + docker run \ + --rm \ + --detach \ + --name mysql \ + -p 3306:3306 \ + -e MYSQL_ROOT_PASSWORD=diego \ + -v my.cnf:/etc/mysql/conf.d/my.cnf \ + mysql + +1. Run the following SQL commands to create a diego user with the correct permissions: + + docker exec -it mysql /bin/bash + mysql -uroot -pdiego -hlocalhost + CREATE USER 'diego'@'%' IDENTIFIED BY 'diego_password'; + GRANT ALL PRIVILEGES ON `diego\_%`.* TO 'diego'@'%'; + GRANT ALL PRIVILEGES ON `routingapi\_%`.* TO 'diego'@'%'; + +1. Create a self-signed certificate as described in the [PostgreSQL documentation](https://www.postgresql.org/docs/9.4/static/ssl-tcp.html#SSL-CERTIFICATE-CREATION). + Save the certificate and key to a local directory of your choosing. + +1. Set the owner to the postgres user: + + sudo chown 999:999 server.key server.crt + +1. Run Postgres container. Note: Your `server.crt` and `server.key` should be in the current directory: + + docker run \ + --rm \ + --detach \ + --name pg \ + -p 5432:5432 \ + -e POSTGRES_PASSWORD=diego_pw \ + -e POSTGRES_DB=diego \ + -e POSTGRES_USER=diego \ + -v $PWD/server.crt:/var/lib/postgresql/server.crt \ + -v $PWD/server.key:/var/lib/postgresql/server.key \ + postgres \ + -c ssl=on \ + -c ssl_cert_file=/var/lib/postgresql/server.crt \ + -c ssl_key_file=/var/lib/postgresql/server.key + +1. You should now be able to run the SQL unit tests. To run all the SQL-backed + tests, run the following command from + the root of diego-release: + + ./scripts/run-unit-tests + + This command will run all regular unit tests, as well as BBS and component + integration tests where a backing store is required in MySQL-backed and Postgres-backed modes. + ## Deploying Diego to BOSH-Lite 1. Install and start [BOSH-Lite](https://github.com/cloudfoundry/bosh-lite),