Last active
March 30, 2017 14:52
-
-
Save nneves/a66bba34216f259017f8d4774c125cae to your computer and use it in GitHub Desktop.
micro-compose: launch greeter-srv and expose port to host network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://github.com/mcoquet/micro-compose | |
# | |
# run docker-compose with: | |
# > EXTERNAL_IP="192.168.1.65" GREETER_SRV_PORT="1234" docker-compose up | |
# | |
# Query micro greeter service from host | |
# > micro query go.micro.srv.greeter Say.Hello '{"name": "John"}' | |
# | |
# Query micro greeter service from host (launch container to run micro cli tool - usefull if you do not have gomicro tools installed) | |
# > docker run --net=host microhq/micro --registry_address=localhost:8500 query go.micro.srv.greeter Say.Hello '{"name": "John"}' | |
version: "2" | |
services: | |
consul: | |
command: agent -dev -client 0.0.0.0 | |
image: consul:latest | |
ports: | |
- "8300:8300" | |
- "8400:8400" | |
- "8500:8500" | |
- "8600:53/udp" | |
api: | |
command: --registry_address=consul:8500 --enable_stats --register_interval=5 --register_ttl=10 api | |
image: microhq/micro:latest | |
depends_on: | |
- consul | |
ports: | |
- "8080:8080" | |
sidecar: | |
command: --registry_address=consul:8500 --register_interval=5 --register_ttl=10 sidecar | |
image: microhq/micro:latest | |
depends_on: | |
- consul | |
ports: | |
- "8081:8081" | |
web: | |
command: --registry_address=consul:8500 --register_interval=5 --register_ttl=10 web | |
image: microhq/micro:latest | |
depends_on: | |
- consul | |
ports: | |
- "8082:8082" | |
greeter: | |
command: --registry_address=consul:8500 --server_address=:${GREETER_SRV_PORT} --server_advertise=${EXTERNAL_IP}:${GREETER_SRV_PORT} greeter-srv | |
image: microhq/greeter-srv:latest | |
depends_on: | |
- consul | |
ports: | |
- "${GREETER_SRV_PORT}:${GREETER_SRV_PORT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment