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
envsdirectory of the project and copy thelocal.envenvironment variables. -
Run the following command to build and start the containers:
docker-compose up -d --buildThis 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 psTo stop the containers, use the following command:
docker-compose stopTo start the containers again, use the following command:
docker-compose startTo remove the containers, use the following command:
docker-compose down