Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tpbowden/swarm-ingress-router
Route DNS names to Swarm services based on labels
https://github.com/tpbowden/swarm-ingress-router
docker swarm
Last synced: about 2 months ago
JSON representation
Route DNS names to Swarm services based on labels
- Host: GitHub
- URL: https://github.com/tpbowden/swarm-ingress-router
- Owner: tpbowden
- License: mit
- Archived: true
- Created: 2016-07-04T11:37:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-19T00:00:22.000Z (over 6 years ago)
- Last Synced: 2024-07-31T21:55:42.154Z (4 months ago)
- Topics: docker, swarm
- Language: Go
- Homepage:
- Size: 2.72 MB
- Stars: 164
- Watchers: 13
- Forks: 22
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - tpbowden/swarm-ingress-router - Route DNS names to Swarm services based on labels (docker)
- awesome-docker - Swarm Ingress Router - Route DNS names to Swarm services based on labels. By [@tpbowden](https://github.com/tpbowden/) (Container Operations / Reverse Proxy)
- awesome-docker - Swarm Ingress Router - Route DNS names to Swarm services based on labels. By [@tpbowden](https://github.com/tpbowden/) (Container Operations / Reverse Proxy)
README
# Swarm ingress router
## This package is not maintained. Do not attempt to use in production
Try https://github.com/containous/traefik for all your reverse proxy needs
---
Route DNS names to labelled Swarm services using Docker 1.12's internal service load balancing
[![Build Status](https://travis-ci.org/tpbowden/swarm-ingress-router.svg?branch=master)](https://travis-ci.org/tpbowden/swarm-ingress-router) [![Go Report Card](https://goreportcard.com/badge/github.com/tpbowden/swarm-ingress-router)](https://goreportcard.com/report/github.com/tpbowden/swarm-ingress-router)
## Features
- No external load balancer or config files needed making for easy deployments
- Integrated TLS decryption for services which provide a certificate and key
- Automatic service discovery and load balancing handled by Docker
- Scaled and maintained by the Swarm for high resilience and performance
- Incredibly lightweight image (less than 20MB after decompression)## Installation
These are the manual steps to install the app. You can run `bootstrap.sh` to quickly create the required
services automatically.First of all you will need to create a network for your frontend services to run on and one for storage:
docker network create --driver=overlay frontends
docker network create --driver=overlay router-managementNext you need to start Redis which will store service configuration
docker service create --name router-storage --network router-management redis:3.2-alpine
Then you have to start the router's backend on management network. The service must be restricted to
run only on master nodes (as it has to query for services).docker service create --name router-backend --constraint node.role==manager --mount \
target=/var/run/docker.sock,source=/var/run/docker.sock,type=bind --network router-management \
tpbowden/swarm-ingress-router:latest -r router-storage:6379 collectorNow you can start the router's frontend on both the management and frontend network.
It must listen on the standard HTTP/HTTPS portsdocker service create --name router --mode global -p 80:8080 -p 443:8443 --network frontends \
--network router-management tpbowden/swarm-ingress-router:latest -r \
router-storage:6379 server -b 0.0.0.0### Start a demo app
Finally, start your frontend service on the frontends network and it will be available on all of your Swarm nodes:
docker service create --name frontend --label ingress=true --label ingress.dnsname=example.local \
--label ingress.targetport=80 --network frontends --label ingress.tls=true --label \
ingress.forcetls=true --label ingress.cert="$(cat fixtures/cert.crt)" --label \
ingress.key="$(cat fixtures/key.key)" nginx:stable-alpineIf you add a DNS record for `example.local` pointing to your Docker node in `/etc/hosts` you will be
routed to the service.## Usage
In order for the router to pick up a service, the service must have the following labels:
- `ingress=true`
- `ingress.dnsname=`
- `ingress.targetport=`For TLS you need the following lables:
- `ingress.tls=true`
- `ingress.cert="$(cat )"`
- `ingress.key="$(cat "`To force services to force TLS you can also use the following label:
- `ingress.forcetls=true`
You do not need to publish the service's port as a node port as long as it is exposed internally and on the same network
as the router.## Todo
- Better logging
- Command line argument for log level
- Use Docker events to stay in sync and long polling as a fallback
- Create a docker-compose file which can be converted into a stack
- Add a heathcheck endpoint and use Docker's HEALTHCHECK instruction to ensure maximum uptime