Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
917a0ada90 | |||
7513d39eb6 | |||
0436310086 | |||
82659b67e9 | |||
c7d69b2af3 | |||
9ec91834aa | |||
d345d47c9f |
78
docker-traefik-nginx/Vagrantfile
vendored
78
docker-traefik-nginx/Vagrantfile
vendored
@ -13,7 +13,7 @@ Vagrant.configure("2") do |config|
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://vagrantcloud.com/search.
|
||||
config.vm.box = "debian/bullseye64"
|
||||
config.vm.hostname = "glpi"
|
||||
config.vm.hostname = "traefik"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
@ -66,52 +66,52 @@ Vagrant.configure("2") do |config|
|
||||
# documentation for more information about their specific syntax and use.
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
apt-get update
|
||||
apt install -y wget curl git vim
|
||||
apt-get install -y wget curl git vim libnss3-tools
|
||||
if ! which docker ; then
|
||||
curl -s -o getdocker.sh https://get.docker.com
|
||||
bash getdocker.sh
|
||||
gpasswd -a vagrant docker
|
||||
fi
|
||||
mkdir -p docker/traefik && cd docker/traefik
|
||||
cat > docker-compose.yml <<-EOT
|
||||
version: "3.2"
|
||||
traefik:
|
||||
image: traefik:latest
|
||||
command:
|
||||
- --entrypoints.web.address=:80
|
||||
- --entrypoints.websecure.address=:443
|
||||
- --providers.docker=true
|
||||
- --providers.file.directory=/etc/traefik/dynamic_conf
|
||||
- --providers.file.watch=true
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ./certs/:/certs/:ro
|
||||
- ./traefik.yml:/etc/traefik/dynamic_conf/conf.yml:ro
|
||||
mkdir nginx
|
||||
echo "my.nginx" > nginx/index.html
|
||||
mkdir nginx2
|
||||
echo "my.nginx2" > nginx2/index.html
|
||||
#cat > docker-compose.yml <<-EOT
|
||||
cat > docker-compose.yml <<'EOT'
|
||||
version: '3'
|
||||
|
||||
web:
|
||||
image: nginx:1.17.8-alpine
|
||||
labels:
|
||||
# http with redirection
|
||||
- traefik.http.middlewares.redirect-middleware.redirectscheme.scheme=https
|
||||
- traefik.http.routers.web-router.entrypoints=web
|
||||
- traefik.http.routers.web-router.rule=Host(`your-domain.net`)
|
||||
- traefik.http.routers.web-router.middlewares=redirect-middleware
|
||||
# https
|
||||
- traefik.http.routers.websecure-router.entrypoints=websecure
|
||||
- traefik.http.routers.websecure-router.tls=true
|
||||
- traefik.http.routers.websecure-router.rule=Host(`your-domain.net`)
|
||||
EOT
|
||||
cat > mariadb.env <<-EOT
|
||||
tls:
|
||||
certificates:
|
||||
- certFile: /certs/awx.afone.priv.crt
|
||||
keyFile: /certs/awx.afone.priv.key
|
||||
EOT
|
||||
services:
|
||||
reverse-proxy:
|
||||
# The official v2 Traefik docker image
|
||||
image: traefik:latest
|
||||
# Enables the web UI and tells Traefik to listen to docker
|
||||
command: --api.insecure=true --providers.docker
|
||||
ports:
|
||||
# The HTTP port
|
||||
- "80:80"
|
||||
# The Web UI (enabled by --api.insecure=true)
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
# So that Traefik can listen to the Docker events
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
nginx:
|
||||
# A container that exposes an API to show its IP address
|
||||
image: nginx:1.23-alpine
|
||||
volumes:
|
||||
- ./nginx:/usr/share/nginx/html:ro
|
||||
labels:
|
||||
- "traefik.http.routers.nginx.rule=Host(`my.nginx`)"
|
||||
nginx2:
|
||||
# A container that exposes an API to show its IP address
|
||||
image: nginx:1.23-alpine
|
||||
volumes:
|
||||
- ./nginx2:/usr/share/nginx/html:ro
|
||||
labels:
|
||||
- "traefik.http.routers.nginx2.rule=Host(`my.nginx2`)"
|
||||
'EOT'
|
||||
docker compose up -d
|
||||
ip -br a
|
||||
SHELL
|
||||
SHELL
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user