Skip to content

Instantly share code, notes, and snippets.

@deanet
Created April 21, 2021 13:36
Show Gist options
  • Save deanet/1ec97e3f8e172335cf6df8e3111e18f1 to your computer and use it in GitHub Desktop.
Save deanet/1ec97e3f8e172335cf6df8e3111e18f1 to your computer and use it in GitHub Desktop.
Docker Exam SPE ACADEMY 2021
upstream app_backend {
server app-spe-a:80;
server app-spe-b:80;
server app-spe-c:80;
}
server {
listen 80;
server_name dp190200-b.vm;
location / {
proxy_pass http://app_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
upstream portainer {
server portainer:9000;
}
server {
listen 80;
server_name portainer.dp190200-b.vm;
location / {
proxy_pass http://portainer;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
version: "3.5"
## ExamSpeAc2021
##Docker A
services:
nginx:
image: nginx:latest
restart: always
container_name: nginx-exam
ports:
- "8080:80"
- "8036:8036"
- "8017:8017"
volumes:
- nginx-vol-exam:/etc/nginx
networks:
spe-academy-exam:
ipv4_address: 172.19.0.2
mysql:
image: mysql:5.7
container_name: dbmysql-exam
environment:
MYSQL_ROOT_PASSWORD: nobody
ports:
- "3306:3306"
volumes:
- dbmysql-vol-exam:/var/lib/mysql
networks:
spe-academy-exam:
ipv4_address: 172.19.0.3
dbmongo:
image: mongo:latest
container_name: dbmongo-exam
ports:
- "27017:27017"
volumes:
- dbmongo-vol-exam:/data/db
- dbmongo-volconf-exam:/data/configdb
networks:
spe-academy-exam:
ipv4_address: 172.19.0.4
volumes:
nginx-vol-exam:
name: "nginx-exam"
driver_opts:
type: "none"
o: "bind"
device: "/root/nginx-exam"
dbmongo-vol-exam:
name: "dbmongo-exam"
dbmongo-volconf-exam:
name: "dbmongo-exam-config"
dbmysql-vol-exam:
name: "dbmysql-exam"
networks:
spe-academy-exam:
name: "spe-academy-exam-net"
driver: bridge
ipam:
config:
- subnet: 172.19.0.0/16
gateway: 172.19.0.1
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
stream {
upstream stream_backend {
server mysql:3306;
}
server {
listen 8036;
proxy_pass stream_backend;
proxy_connect_timeout 1s;
}
upstream stream_backend_mongo {
server dbmongo:27017;
}
server {
listen 8017;
proxy_pass stream_backend_mongo;
proxy_connect_timeout 1s;
}
}
version: "3.5"
## ExamSpeAc2021
services:
nginx:
image: nginx:latest
restart: always
container_name: nginx-exam
ports:
- "80:80"
volumes:
- nginx-vol-exam:/etc/nginx/conf.d
networks:
spe-academy-exam:
ipv4_address: 172.20.0.2
app-spe-a:
image: devunix/spe-acc
container_name: app-spe-acc-a
ports:
- "81:80"
environment:
DB_MYSQL_HOST: mysql.dp190200-a.vm
DB_MYSQL_PORT: 8036
DB_MYSQL_DATABASE: spe_acc
DB_MYSQL_USERNAME: root
DB_MYSQL_PASSWORD: nobody
DB_MONGODB_HOST: mongo.dp190200-a.vm
DB_MONGODB_PORT: 8017
DB_MONGODB_DATABASE: spe_acc
volumes:
- app-vol-exam:/var/www/html/special-academy
networks:
spe-academy-exam:
ipv4_address: 172.20.0.3
extra_hosts:
- "mysql.dp190200-a.vm:10.73.104.7"
- "mongo.dp190200-a.vm:10.73.104.7"
app-spe-b:
image: devunix/spe-acc
container_name: app-spe-acc-b
ports:
- "82:80"
environment:
DB_MYSQL_HOST: mysql.dp190200-a.vm
DB_MYSQL_PORT: 8036
DB_MYSQL_DATABASE: spe_acc
DB_MYSQL_USERNAME: root
DB_MYSQL_PASSWORD: nobody
DB_MONGODB_HOST: mongo.dp190200-a.vm
DB_MONGODB_PORT: 8017
DB_MONGODB_DATABASE: spe_acc
volumes:
- app-vol-exam:/var/www/html/special-academy
networks:
spe-academy-exam:
ipv4_address: 172.20.0.4
extra_hosts:
- "mysql.dp190200-a.vm:10.73.104.7"
- "mongo.dp190200-a.vm:10.73.104.7"
app-spe-c:
image: devunix/spe-acc
container_name: app-spe-acc-c
ports:
- "83:80"
environment:
DB_MYSQL_HOST: mysql.dp190200-a.vm
DB_MYSQL_PORT: 8036
DB_MYSQL_DATABASE: spe_acc
DB_MYSQL_USERNAME: root
DB_MYSQL_PASSWORD: nobody
DB_MONGODB_HOST: mongo.dp190200-a.vm
DB_MONGODB_PORT: 8017
DB_MONGODB_DATABASE: spe_acc
volumes:
- app-vol-exam:/var/www/html/special-academy
networks:
spe-academy-exam:
ipv4_address: 172.20.0.5
extra_hosts:
- "mysql.dp190200-a.vm:10.73.104.7"
- "mongo.dp190200-a.vm:10.73.104.7"
portainer:
image: portainer/portainer-ce
command: -H unix:///var/run/docker.sock
restart: always
ports:
- 127.0.0.1:9000:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
networks:
spe-academy-exam:
ipv4_address: 172.20.0.6
volumes:
nginx-vol-exam:
name: "nginx-exam"
driver_opts:
type: "none"
o: "bind"
device: "/root/nginx-exam"
app-vol-exam:
name: "app-exam"
driver_opts:
type: "none"
o: "bind"
device: "/root/app-exam"
portainer_data:
networks:
spe-academy-exam:
name: "spe-academy-exam-net"
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
gateway: 172.20.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment