From f08d3138bc31758f62cc666722f60488c8fad21a Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Wed, 6 Jun 2018 12:42:16 -0700 Subject: [PATCH] Making local tests runnable (#157) * using the right DB names in the proxy database file * using the right DB names in the olympus database file and the right ports * using the right DB name in the docker-compose * adding mongo URL to the buffalo env file * adding mongo URL to the proxy env file * updating port for the proxy DB * updating DB schemas for olympus and the proxy * making the readme a little more up to date --- README.md | 30 +++++++++++++----------------- cmd/olympus/.env | 1 + cmd/olympus/database.yml | 6 +++--- cmd/olympus/migrations/schema.sql | 4 ++-- cmd/proxy/.env | 1 + cmd/proxy/database.yml | 6 +++--- cmd/proxy/migrations/schema.sql | 4 ++-- docker-compose.yml | 2 +- 8 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 cmd/olympus/.env create mode 100644 cmd/proxy/.env diff --git a/README.md b/README.md index 605771115..81fc57f0c 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,23 @@ Athens is composed roughly of three logical pieces. The below list contains link The server is written using [Buffalo](https://gobuffalo.io/), so it's fairly straightforward to get started on development. You'll need Buffalo v0.11.0 or later to do development on Athens. -Download [v0.11.0](https://github.com/gobuffalo/buffalo/releases/tag/v0.11.0) or later, untar/unzip the binary into your PATH, and then run the following from the root of this repository: +Download [v0.11.0](https://github.com/gobuffalo/buffalo/releases/tag/v0.11.0) or later, untar/unzip the binary into your PATH, and then run the +following to run [Olympus](https://github.com/gomods/athens/wiki/The-Central-Package-Registry-(Olympus)): ```console -cd cmd/proxy +cd cmd/olympus buffalo dev ``` -You'll see some output in your console that looks like this: +... and the following to run [Athens](https://github.com/gomods/athens/wiki/Proxies-(Athens): ```console -$ buffalo dev -buffalo: 2018/02/25 16:09:36 === Rebuild on: :start: === -buffalo: 2018/02/25 16:09:36 === Running: go build -v -i -o tmp/vgoprox-build (PID: 94067) === -buffalo: 2018/02/25 16:09:37 === Building Completed (PID: 94067) (Time: 1.115613079s) === -buffalo: 2018/02/25 16:09:37 === Running: tmp/vgoprox-build (PID: 94078) === -time="2018-02-25T16:09:37-08:00" level=info msg="Starting application at 127.0.0.1:3000" INFO[2018-02-25T16:09:37-08:00] Starting Simple Background Worker Webpack is watching the files… +cd cmd/proxy +buffalo dev ``` -After the `Starting application at 127.0.0.1:3000` is logged, the server is up and running. -As you edit and save code, Buffalo will automatically restart the server. **This means that -all of your modules will disappear** because the only storage driver is in-memory right now. - -See [CLI](./CLI.md) for information on how to add modules back into the server. +After you see something like `Starting application at 127.0.0.1:3000`, the server +is up and running. As you edit and save code, Buffalo will automatically restart the server. ## Dependencies and Set-up @@ -50,16 +44,18 @@ development environments. To create, run the following from the repository root: ```console -docker-compose up -d +docker-compose -p athens up -d ``` To destroy: ```console -docker-compose down +docker-compose -p athens down ``` -A few environment variables are expected by the application and tests. +A few environment variables are expected by the application and tests. They are +stored in `cmd/olympus/.env` and `cmd/proxy/.env`. Below is a table of the +default values: |Variable |Value | |---|---:| diff --git a/cmd/olympus/.env b/cmd/olympus/.env new file mode 100644 index 000000000..8e7b14f7c --- /dev/null +++ b/cmd/olympus/.env @@ -0,0 +1 @@ +ATHENS_MONGO_STORAGE_URL=mongodb://127.0.0.1:27017 diff --git a/cmd/olympus/database.yml b/cmd/olympus/database.yml index 81113e823..59a5ad386 100644 --- a/cmd/olympus/database.yml +++ b/cmd/olympus/database.yml @@ -1,8 +1,8 @@ development: dialect: "mysql" - database: olympusdb + database: athens host: 127.0.0.1 - port: 3307 + port: 3306 user: vgp password: vgp @@ -16,7 +16,7 @@ test_postgres: test: dialect: "mysql" - database: olympusdb + database: athens host: 127.0.0.1 port: 3306 user: vgp diff --git a/cmd/olympus/migrations/schema.sql b/cmd/olympus/migrations/schema.sql index 42cfb1d1a..e76ee5ba5 100644 --- a/cmd/olympus/migrations/schema.sql +++ b/cmd/olympus/migrations/schema.sql @@ -1,6 +1,6 @@ -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: 127.0.0.1 Database: vgoprox +-- Host: 127.0.0.1 Database: athens -- ------------------------------------------------------ -- Server version 5.7.21 @@ -37,4 +37,4 @@ CREATE TABLE `schema_migration` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-03-21 16:06:17 +-- Dump completed on 2018-06-06 12:17:16 diff --git a/cmd/proxy/.env b/cmd/proxy/.env new file mode 100644 index 000000000..8e7b14f7c --- /dev/null +++ b/cmd/proxy/.env @@ -0,0 +1 @@ +ATHENS_MONGO_STORAGE_URL=mongodb://127.0.0.1:27017 diff --git a/cmd/proxy/database.yml b/cmd/proxy/database.yml index 041166ac9..4369e901c 100644 --- a/cmd/proxy/database.yml +++ b/cmd/proxy/database.yml @@ -1,14 +1,14 @@ development: dialect: "mysql" - database: olympusdb + database: athens host: 127.0.0.1 - port: 3307 + port: 3306 user: vgp password: vgp test: dialect: "mysql" - database: olympusdb + database: athens host: 127.0.0.1 port: 3306 user: vgp diff --git a/cmd/proxy/migrations/schema.sql b/cmd/proxy/migrations/schema.sql index 42cfb1d1a..f02c3878b 100644 --- a/cmd/proxy/migrations/schema.sql +++ b/cmd/proxy/migrations/schema.sql @@ -1,6 +1,6 @@ -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: 127.0.0.1 Database: vgoprox +-- Host: 127.0.0.1 Database: athens -- ------------------------------------------------------ -- Server version 5.7.21 @@ -37,4 +37,4 @@ CREATE TABLE `schema_migration` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-03-21 16:06:17 +-- Dump completed on 2018-06-06 12:32:35 diff --git a/docker-compose.yml b/docker-compose.yml index e9e001a4a..05adce935 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - "ALLOW_EMPTY_PASSWORD=yes" - "MYSQL_USER=vgp" - "MYSQL_PASSWORD=vgp" - - "MYSQL_DATABASE=vgoprox" + - "MYSQL_DATABASE=athens" postgres: image: postgres:9.6.9-alpine ports: