-
Notifications
You must be signed in to change notification settings - Fork 0
Running the code
We use docker-compose to run the code in the dev environment. All docker related code is in the docker
folder. There are 2 ways to run the code:
- Directly as a process
- As a debug process which can be debugged using delve compatible launch configuration
cd docker
cp .env.local .env
# if you want to run directly
docker-compose up --build
# if you want to run with debugger
docker-compose -f docker-compose-debug.yml up --build
# Then, launch the Connect to Server configuration for the debugger
Then whenever you save any go file, the server automatically restarts.
The following files are present in the docker folder:
This is the environment file used for local development. When you want to start the service, all you need to do is:
cp .env.local .env
and you will get the environment setup for running the code locally.
This is the environment file used for staging env. Please make sure to update this file whenever you add a new env variable in the .env.local
file.
This is the dockerfile to run the code. It is used internally in the docker-compose
file to build & run the code. In 99% of the cases, you don’t need to do anything with this file.
This is the dockerfile to run the code in debug mode with delve
. It is used internally in the docker-compose-debug
file to build & run the code. In 99% of the cases, you don’t need to do anything with this file.
This is the entry point for the Dockerfile. It essentially just starts the [modd](https://github.com/cortesi/modd) daemon so that auto-reload on saving works.
This is the entry point for the Dockerfile-debug. It essentially just starts the [modd](https://github.com/cortesi/modd) daemon so that auto-reload on saving works.
Configuration for modd daemon to build & run on save.
Debug counterpart for modd.conf
This is the main file that ties up all the dependencies together & runs the entire code. It contains database, nats and other dependencies & port mapping for all these services which are required for the code to run.
This is the main file that ties up all the dependencies together & runs the entire code in debug mode. It is exactly the same as docker-compose.yml
but runs Dockerfile-debug
instead of Dockerfile
to run the code in debug mode.
This is the file which contains debugger launch configuration for vscode.
The main configuration which should be used to connect to the code running in debug mode is Connect to Server
.