From b994593ffb7ffbb747a6395e3c650716cb993490 Mon Sep 17 00:00:00 2001 From: Sam Davidge Date: Fri, 12 Feb 2021 15:46:00 +0000 Subject: [PATCH 1/2] Update documentation for local setup to be consistent with other repos for GFW micro services and set the NODE_PATH --- README.md | 44 ++++++++++++++++++++++++++++---------- docker-compose-develop.yml | 1 + 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6ab7b14..f58317f 100644 --- a/README.md +++ b/README.md @@ -24,25 +24,47 @@ Dependencies on other Microservices: ## Getting Started -### OS X - **First, make sure that you have the [API gateway running locally](https://github.com/control-tower/control-tower).** -We're using Docker which, luckily for you, means that getting the -application running locally should be fairly painless. First, make sure -that you have [Docker Compose](https://docs.docker.com/compose/install/) -installed on your machine. +Start by cloning the repository from github to your execution environment ``` -git clone https://github.com/resource-watch/query -cd query -./query.sh develop -```text +git clone https://github.com/resource-watch/query.git && cd query +``` + +After that, follow one of the instructions below: + +### Using native execution + +1 - Set up your environment variables. See `dev.env.sample` for a list of variables you should set, which are described in detail in [this section](#environment-variables) of the documentation. Native execution will NOT load the `dev.env` file content, so you need to use another way to define those values + +2 - Install node dependencies using yarn: +``` +yarn +``` + +3 - Start the application server: +``` +yarn start +``` + +The endpoints provided by this microservice should now be available through Control Tower's URL. + +### Using Docker + +1 - Create and complete your `dev.env` file with your configuration. You can find an example `dev.env.sample` file in the project root. -You can now access the microservice through the CT gateway. +2 - Execute the following command to run Control tower: ``` +./query.sh develop +``` + +The endpoints provided by this microservice should now be available through Control Tower's URL. + + +You can now access the microservice through the API gateway. ### Configuration diff --git a/docker-compose-develop.yml b/docker-compose-develop.yml index 737236c..dde5b00 100644 --- a/docker-compose-develop.yml +++ b/docker-compose-develop.yml @@ -5,6 +5,7 @@ services: ports: - "35749:35729" environment: + NODE_PATH: app/src CT_URL: http://mymachine:9000 LOCAL_URL: http://mymachine:5000 API_VERSION: v1 From 6d43bf994ebc039a37012724d83d38954ab0d53f Mon Sep 17 00:00:00 2001 From: Sam Davidge Date: Fri, 19 Feb 2021 12:35:03 +0000 Subject: [PATCH 2/2] Update local docker setup so it builds and registers with the Control Tower correctly --- docker-compose-develop.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose-develop.yml b/docker-compose-develop.yml index dde5b00..978daee 100644 --- a/docker-compose-develop.yml +++ b/docker-compose-develop.yml @@ -3,13 +3,14 @@ services: develop: build: . ports: - - "35749:35729" + - "5001:5001" environment: + PORT: 5001 NODE_PATH: app/src CT_URL: http://mymachine:9000 - LOCAL_URL: http://mymachine:5000 + LOCAL_URL: http://mymachine:5001 API_VERSION: v1 - CT_TOKEN: null + CT_TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Im1pY3Jvc2VydmljZSIsImNyZWF0ZWRBdCI6IjIwMTYtMDktMTQifQ.IRCIRm1nfIQTfda_Wb6Pg-341zhV8soAgzw7dd5HxxQ CT_REGISTER_MODE: auto GCLOUD_STORAGE: ${GCLOUD_STORAGE} GOOGLE_APPLICATION_CREDENTIALS: /opt/query/storage.json