Skip to content

Latest commit

 

History

History
85 lines (57 loc) · 2.18 KB

README.md

File metadata and controls

85 lines (57 loc) · 2.18 KB

Development

Prerequisites

  • Go 1.18 or newer
  • Docker 20.10 or newer
  • Task build tool

For Windows

  • WSL2
    • Docker tasks work natively only under Linux and (possibly) macOS. On Windows use WSL2.

When Docker builder image is not used

Preparing the project

In order to generate files, necessary for development (eg. gRPC client/server from protobuf schema) and perform vendoring, execute the dev_prepare task:

task -- task prepare

Starting runtime dependencies

Runtime dependencies (eg. MongoDB) are launched as Docker containers and are managed by Docker Compose. The Compose operations are wrapped into Task tasks.

Make sure that the Docker daemon is running and execute:

task dev:compose:up

In order to remove the containers and their data, run:

task dev:compose:down

To execute arbitrary Docker Compose command <COMMAND>, call:

task dist:compose -- <COMMAND>

Connecting to MongoDB

Since the local MongoDB instance is run is the replica set mode and advertises the internal Docker hostname to other containers, in order to connect to it from the host machine it is necessary to configure the client to ignore the advertised hostname and connect to the instance directly, by specifying the directConnection option in the connection string:

mongodb://root:password@localhost:27017/?directConnection=true

Running the services

Individual services can be built and executed locally with the run_* Task tasks. For example, in order to run the API gateway service, execute:

task -- task api_gateway:run

Running Docker builder image to execute arbitrary commands

In order to launch Docker container with the project's directory mounted, execute:

task

To execute arbitrary command COMMAND in the container, pass it to the Task after --:

task -- COMMAND