Skip to content

Instantly share code, notes, and snippets.

@macielti
Last active August 3, 2023 11:25
Show Gist options
  • Save macielti/0087c37bb5375ecd09bd97d496b820c5 to your computer and use it in GitHub Desktop.
Save macielti/0087c37bb5375ecd09bd97d496b820c5 to your computer and use it in GitHub Desktop.
Example of deployment for RabbitMQ in production environiment
version: "3"
volumes:
rabbitmq:
services:
rabbitmq:
image: rabbitmq:3-management
container_name: global-rabbitmq
restart: always
environment:
- RABBITMQ_DEFAULT_USER=username
- RABBITMQ_DEFAULT_PASS=secretpassword
volumes:
- rabbitmq:/var/lib/rabbitmq
ports:
- 5672:5672
- 15672:15672
serveo:
image: alpine
restart: always
links:
- rabbitmq
command: sh -c 'apk add openssh && apk add autossh && mkdir -p /root/.ssh && chmod 0700 /root/.ssh && ssh-keyscan -t rsa serveo.net >> ~/.ssh/known_hosts && autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 5672:rabbitmq:5672 random-subdomain@serveo.net'
tunnel:
container_name: cloudflared-tunnel-rabbitmq
restart: always
image: cloudflare/cloudflared
restart: unless-stopped
links:
- rabbitmq
command: tunnel run
env_file: ./tunnel.env
# https://github.com/macielti/marcos/blob/7cd3504035209401426c4c2663030f37fdae98d5/docker-compose.yml#L4
TUNNEL_TOKEN=random-token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment