Skip to content

Commit

Permalink
docker: Add compose based system
Browse files Browse the repository at this point in the history
- Use rabbitmq container as event broker
- Use consul container as service registry
  • Loading branch information
nkprince007 committed May 23, 2018
1 parent a94df8d commit 167f3e5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

services:
consul:
# Consul will be used to manage service discovery
image: progrium/consul:latest
hostname: consul
command: -server -bootstrap -rejoin
ports:
- "8300:8300"
- "8400:8400"
- "8500:8500"
- "8600:53/udp"
rabbit:
# rabbitmq will be used as message broker to interact with other services
image: rabbitmq:management
hostname: rabbit
ports:
- "5672:5672"
- "15672:15672"
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=password
listen:
# listen is the actual listener service
command: /bin/sh -c "sleep 5; ./app;"
image: registry.gitlab.com/nkprince007/listen:latest
# build: .
ports:
- "8000:8000"
environment:
- MICRO_REGISTRY=consul
- MICRO_REGISTRY_ADDRESS=consul
- MICRO_BROKER=rabbitmq
- MICRO_BROKER_ADDRESS=amqp://admin:password@rabbit:5672
links:
- consul
- rabbit
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main
import (
"os"

_ "github.com/micro/go-plugins/broker/rabbitmq"

"github.com/micro/go-log"
"github.com/micro/go-web"
"gitlab.com/nkprince007/listen/handler"
Expand Down

0 comments on commit 167f3e5

Please sign in to comment.