Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edm00se/proxy-simple-docker-compose-node-redis-demo
uses traefik to proxy docker requests for scalable web app instances, based on edm00se/simple-docker-compose-node-redis-demo
https://github.com/edm00se/proxy-simple-docker-compose-node-redis-demo
docker docker-compose nodejs redis traefik
Last synced: 7 days ago
JSON representation
uses traefik to proxy docker requests for scalable web app instances, based on edm00se/simple-docker-compose-node-redis-demo
- Host: GitHub
- URL: https://github.com/edm00se/proxy-simple-docker-compose-node-redis-demo
- Owner: edm00se
- Created: 2020-01-22T21:20:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T11:54:54.000Z (about 2 months ago)
- Last Synced: 2024-09-17T14:28:40.335Z (about 2 months ago)
- Topics: docker, docker-compose, nodejs, redis, traefik
- Language: JavaScript
- Size: 302 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# Docker Compose Getting Started
This is built as a fork from [edm00se/simple-docker-compose-node-redis-demo](https://github.com/edm00se/simple-docker-compose-node-redis-demo), which is a [Node.js](https://nodejs.org/) re-interpretation of [the Docker "getting started" guide from their docs](https://docs.docker.com/compose/gettingstarted/). If you are unfamiliar with either, you should start there.
This project extends [edm00se/simple-docker-compose-node-redis-demo](https://github.com/edm00se/simple-docker-compose-node-redis-demo) by:
- adding [traefik](https://docs.traefik.io/) as a load balancer, via the `docker-compose.yml` config
- re-configuring the `Dockerfile` to expose the HTTP port, instead of solely within the `docker-compose.yml` configuration
- this allows traefik to pick it up automagically
- the `app.js` response now incldues the container ID as "hostname" in the response## Required
1. [Docker](https://www.docker.com/)
2. [Docker Compose](https://docs.docker.com/compose/install/) (this should come with [Docker CE / Docker Desktop](https://store.docker.com/search?offering=community&type=edition) for both macOS and Windows)## Clone and Run
1. `git clone https://github.com/edm00se/proxy-simple-docker-compose-node-redis-demo.git`
2. `cd proxy-simple-docker-compose-node-redis-demo`
3. `docker-compose up` (first time run will perform build)
- you can force a fresh build with `--build`
- you can background (run without holding up your CLI) by using `--detach`
- you can stop and remove the containers associated by substituting `down` in place of `up`
4. `docker-compose up -d --scale web=2` will scale up the "web" app service of our compose config to the specified number## Test
```sh
curl -H Host:myapp.docker.localhost http://127.0.0.1
```The "myapp" label is applied in the defined `labels:` field for the `docker-compose.yml` config definition of the web app "service". By specifying a `Host` header in our request, we are specifying a destination that traefik can interpret.
## License
The MIT License (MIT).