From a02c29af60ccdbcf11548efbc393b30080792c4b Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Fri, 7 Jun 2019 12:07:17 -0700 Subject: [PATCH 1/2] docs(README): add instructions on how to run starterkit against a production API Signed-off-by: Machiko Yasuda --- README.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f6c5ce0944..f2243775b9 100644 --- a/README.md +++ b/README.md @@ -62,17 +62,28 @@ cd reaction-next-starterkit ``` ### Build and run in development mode with logs + ```sh docker-compose up -d && docker-compose logs -f ``` -### Running Commands inside the container +### Run in development against a production API + +Change the `INTERNAL_GRAPHQL_URL` in `.env` to the production API URL. The URL should end in `/graphql-alpha`, like: `https://my-website.com/graphql-alpha`. Save the `.env` file and restart the application with: + +```sh +docker-compose run --rm --service-ports web yarn start:local +``` + +### Run commands in container + ```sh docker-compose run --rm web [command] ``` -Run any command inside a Docker container and then remove the container. Use this to run any tooling operations. Remember your project directory will be mounted and things will usually just work. +Run any command inside a Docker container and then remove the container. Use this to run any tooling operations. Remember your project directory will be mounted and things will usually just work. See Yarn section below for more examples. + +### Run tests in container -### Running Tests in Container Run tests locally ```sh docker-compose run --rm web yarn test @@ -88,19 +99,19 @@ To update a failing snapshot (if you've made changes to a component) docker-compose run --rm web yarn test -u ``` -To run snyk security tests (this will run tests in the same way as CI) +To run Snyk security tests (this will run tests in the same way as CI) ```sh docker-compose run --rm web sh -c "cp package.json ../ && cp .snyk ../ && cd .. && snyk auth && snyk test" ``` -To run eslint +To run ESLint ```sh docker-compose run --rm web eslint src ``` -### Debugging the server with chrome devtools +### Debugging the server with Chrome DevTools -You can use the chrome devtools to debug the code running in the node.js application server while it's running inside docker. +You can use the Google Chrome DevTools to debug the code running in the node.js application server while it's running inside docker. - run `docker-compose run --rm --publish 9229:9229 --publish 4000:4000 -e NODE_ENV=development web babel-node --inspect=0.0.0.0:9229 ./src/server.js` - Open chrome and browse to `chrome://inspect`. Find the process under **Remote Target** and click **inspect**. @@ -142,7 +153,7 @@ Sometimes we need to test [`reaction-component-library`](https://github.com/reac 1. Undo the renaming of your `.yarnrc` file 1. Undo the URL change inside your `.env` file -## Cleanup Containers +## Clean up containers Stop, and retain containers: ```sh docker-compose stop @@ -158,7 +169,7 @@ Stop, and remove containers, volumes and built images: docker-compose down -v --rmi local ``` -## Building and running the production app locally +## Build and run the production app locally Sometimes it is helpful during development to make a production build of the app and run that locally. From 0102e03b9e3be86937be0fd8d2748e308084a44e Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Fri, 7 Jun 2019 12:17:40 -0700 Subject: [PATCH 2/2] docs(README): start not startlocal Signed-off-by: Machiko Yasuda --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2243775b9..42ad08d985 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ docker-compose up -d && docker-compose logs -f Change the `INTERNAL_GRAPHQL_URL` in `.env` to the production API URL. The URL should end in `/graphql-alpha`, like: `https://my-website.com/graphql-alpha`. Save the `.env` file and restart the application with: ```sh -docker-compose run --rm --service-ports web yarn start:local +docker-compose run --rm --service-ports web yarn start ``` ### Run commands in container