This guide will walk you through the steps to deploy the Golang microservice application using Docker Compose.
- Clone the repository and navigate to the root directory of the project:
git clone https://github.com/infranyx/go-microservice-template
cd go-microservice-template
-
Create a .env file in the
envs
directory of the project and copy thelocal.env
environment variables. -
Run the following command to build and start the containers:
docker-compose up -d --build
This will build and start the following containers:
postgres
: PostgreSQL databasekafka
: Kafka message brokerzookeeper
: In the context of Kafka, Zookeeper is used to store metadata about the Kafka cluster and its topics. It helps the Kafka brokers maintain their cluster membership and elect leaders, and it also helps clients discover the location of the Kafka brokers.redis
: Redis cachesentry
: Sentry error tracking serviceapp
: Golang microservice application
To verify that the containers are running, use the following command:
docker-compose ps
To stop the containers, use the following command:
docker-compose stop
To start the containers again, use the following command:
docker-compose start
To remove the containers, use the following command:
docker-compose down