Skip to content

Commit

Permalink
add compose and stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
mhzawadi committed Apr 28, 2024
1 parent 41e2d36 commit 993b3fe
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docker-compose-path.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.5'

# docker stack deploy --compose-file stack-phpmyadmin.yml phpmyadmin

volumes:
phpmyadmin_data:
mariadb_10_4:

services:
proxyv2:
image: traefik:v2.5 # The official Traefik docker image
command:
- "--api.insecure=true"
- "--providers.docker"
ports:
- "80:80" # The HTTP port
- "443:443" # The HTTP port
- "8181:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
labels:
- "traefik.enable=false"
phpmyadmin:
image: mhzawadi/phpmyadmin
volumes:
- phpmyadmin_data:/mysql
labels:
- "traefik.http.routers.phpmyadmin.rule=Path(`/pma`)"
- "traefik.http.routers.phpmyadmin.service=phpmyadmin"
- "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
mariadb_10_4:
# MySQL 5.7
image: mariadb:10.4.10
volumes:
- mariadb_10_4:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mysql_password
- MYSQL_DATABASE=phpmyadmin
- MYSQL_USER=phpmyadmin
- MYSQL_PASSWORD=phpmyadmin
labels:
- "traefik.enable=false"
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.5'

# docker stack deploy --compose-file stack-phpmyadmin.yml phpmyadmin

volumes:
phpmyadmin_data:
mariadb_10_4:

services:
proxyv2:
image: traefik:v2.5 # The official Traefik docker image
command:
- "--api.insecure=true"
- "--providers.docker"
ports:
- "80:80" # The HTTP port
- "443:443" # The HTTP port
- "8181:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
labels:
- "traefik.enable=false"
phpmyadmin:
image: mhzawadi/phpmyadmin
volumes:
- phpmyadmin_data:/mysql
labels:
- "traefik.http.routers.phpmyadmin.rule=Host(`phpmyadmin.docker.local`)"
- "traefik.http.routers.phpmyadmin.service=phpmyadmin"
- "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
mariadb_10_4:
# MySQL 5.7
image: mariadb:10.4.10
volumes:
- mariadb_10_4:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mysql_password
- MYSQL_DATABASE=phpmyadmin
- MYSQL_USER=phpmyadmin
- MYSQL_PASSWORD=phpmyadmin
labels:
- "traefik.enable=false"
53 changes: 53 additions & 0 deletions stack-phpmyadmin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3.5'

# docker stack deploy --compose-file stack-phpmyadmin.yml phpmyadmin

volumes:
phpmyadmin_data:
mariadb_10_4:

services:
proxyv2:
image: traefik:v2 # The official Traefik docker image
command:
- "--api.insecure=true"
- "--providers.docker"
- "--providers.docker.swarmMode=true"
ports:
- "80:80" # The HTTP port
- "443:443" # The HTTP port
- "8181:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
deploy:
mode: replicated
replicas: 1
labels:
- "traefik.enable=false"
phpmyadmin:
image: mhzawadi/phpmyadmin
volumes:
- phpmyadmin_data:/mysql
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
- "traefik.http.routers.phpmyadmin.rule=Host(`phpmyadmin.docker.local`)"
- "traefik.http.routers.phpmyadmin.service=phpmyadmin"
- "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
mariadb_10_4:
# MySQL 5.7
image: mariadb:10.4.10
volumes:
- mariadb_10_4:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=mysql_password
- MYSQL_DATABASE=phpmyadmin
- MYSQL_USER=phpmyadmin
- MYSQL_PASSWORD=phpmyadmin
deploy:
mode: replicated
replicas: 1
labels:
- "traefik.enable=false"

0 comments on commit 993b3fe

Please sign in to comment.