diff --git a/docs/dev_services.md b/docs/dev_services.md --- a/docs/dev_services.md +++ b/docs/dev_services.md @@ -50,7 +50,7 @@ # Building and running -`services/package.json` provides useful scripts to build and run services. The `run` scripts will automatically build the services if necessary and run them. The `dev-mode` scripts allow you to use local instances of S3 and DynamoDB instead of the production ones. +`services/package.json` provides useful scripts to build and run services. The `run` scripts will automatically build the services if necessary and run them. You can find the full list of scripts [here](https://github.com/CommE2E/comm/blob/master/services/package.json) in the `scripts` section. @@ -59,3 +59,43 @@ ## Visual Studio Code If you are using Visual Studio Code as your code editor you can [attach to a Docker container](https://code.visualstudio.com/docs/remote/attach-container) and develop inside it. + +## Services dev mode + +You can run services in your local dev environment for development and debugging purposes. In this case, services will be using a [local cloud stack](https://localstack.cloud/) that includes DynamoDB and S3 running locally in Docker containers. + +Tunnelbroker also requires a [RabbitMQ](https://www.rabbitmq.com/) server to run. It will be started in a local Docker container when running Tunnelbroker locally in dev mode. + +## Configuration changes when running in dev mode + +In dev mode, services will connect to a local cloud stack ignoring the `~/.aws` connection settings. The `-test` suffix is applied for all DynamoDB table names in this mode. Tunnelbroker service will use `services/tunnelbroker/tunnelbroker-dev.ini` configuration file and connect to a local instance of the RabbitMQ server which is running from the local Docker container. + +The log level in this mode is increased from errors only to additional information and warning messages. + +## Running services locally in dev mode + +First, you need to initialize the local cloud using the following command from the the `services` directory: + +``` +yarn init-local-cloud +``` + +This will start the LocalStack Docker image and initialize required setup, including DynamoDB tables, s3 buckets using [Terraform](https://www.terraform.io/) scripts located in `services/terraform`. + +To start a certain service in development mode you can run the following command: + +``` +yarn run-[service-name]-service-dev-mode +``` + +For example, for Tunnelbroker the command will look like this: + +``` +yarn run-tunnelbroker-service-dev-mode +``` + +You can also run all services at once in the dev-mode using the command below: + +``` +yarn run-all-services-dev-mode +```