bunkerweb 1.4.0
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
# Load balancer
|
||||
|
||||
Simple example on how to load balance requests to multiple backends.
|
||||
|
||||
## Architecture
|
||||
|
||||
<img src="https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/load-balancer/architecture.png?raw=true" />
|
||||
|
||||
## Configuration
|
||||
|
||||
Edit the custom `upstream` directive in the **http-confs/upstream.conf** file according to your use case.
|
||||
|
||||
## Docker
|
||||
|
||||
See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/load-balancer/docker-compose.yml).
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,5 @@
|
||||
upstream app {
|
||||
server app1:80;
|
||||
server app2:80;
|
||||
server app3:80;
|
||||
}
|
||||
@@ -2,28 +2,24 @@ version: '3'
|
||||
|
||||
services:
|
||||
|
||||
myreverse:
|
||||
image: bunkerity/bunkerized-nginx
|
||||
restart: always
|
||||
depends_on:
|
||||
- app1
|
||||
- app2
|
||||
- app3
|
||||
mybunker:
|
||||
image: bunkerity/bunkerweb:1.4.0
|
||||
ports:
|
||||
- 80:8080
|
||||
- 443:8443
|
||||
# bunkerized-nginx runs as an unprivileged user with UID/GID 101
|
||||
# ⚠️ read this if you use local folders for volumes ⚠️
|
||||
# bunkerweb runs as an unprivileged user with UID/GID 101
|
||||
# don't forget to edit the permissions of the files and folders accordingly
|
||||
# example if you need to create a directory : mkdir folder && chown root:101 folder && chmod 770 folder
|
||||
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
|
||||
# more info at https://docs.bunkerweb.io
|
||||
volumes:
|
||||
- ./letsencrypt:/etc/letsencrypt
|
||||
- ./http-confs:/http-confs:ro
|
||||
- ./bw-data:/data # contains upstreams definition at http context
|
||||
environment:
|
||||
- SERVER_NAME=www.example.com # replace with your domain
|
||||
- SERVER_NAME=www.example.com # replace with your domain
|
||||
- SERVE_FILES=no
|
||||
- DISABLE_DEFAULT_SERVER=yes
|
||||
- REDIRECT_HTTP_TO_HTTPS=yes
|
||||
- AUTO_LETS_ENCRYPT=yes
|
||||
- USE_PROXY_CACHE=yes
|
||||
- USE_CLIENT_CACHE=yes
|
||||
- USE_GZIP=yes
|
||||
- USE_REVERSE_PROXY=yes
|
||||
@@ -31,20 +27,10 @@ services:
|
||||
- REVERSE_PROXY_HOST=http://app
|
||||
|
||||
app1:
|
||||
build: js-app
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
image: tutum/hello-world
|
||||
|
||||
app2:
|
||||
build: js-app
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
image: tutum/hello-world
|
||||
|
||||
app3:
|
||||
build: js-app
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
|
||||
image: tutum/hello-world
|
||||
@@ -1,5 +0,0 @@
|
||||
upstream app {
|
||||
server app1:3000;
|
||||
server app2:3000;
|
||||
server app3:3000;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
FROM node
|
||||
|
||||
COPY app/ /home/node/app
|
||||
|
||||
RUN cd /home/node/app && npm install && chown -R root:node /home/node/app && chmod -R 770 /home/node/app
|
||||
|
||||
WORKDIR /home/node/app
|
||||
|
||||
USER node
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
@@ -1,13 +0,0 @@
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
const port = 3000
|
||||
var os = require("os");
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Container id = ' + os.hostname())
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
})
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "js-app",
|
||||
"version": "1.0.0",
|
||||
"description": "demo",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
}
|
||||
9
examples/load-balancer/setup.sh
Executable file
9
examples/load-balancer/setup.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(id -u) -ne 0 ] ; then
|
||||
echo "❌ Run me as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chown -R root:101 bw-data
|
||||
chmod -R 770 bw-data
|
||||
Reference in New Issue
Block a user