Skip to content

Commit

Permalink
feat: modernized docker-compose.yml (#94)
Browse files Browse the repository at this point in the history
* Modernized docker-compose.yml

# proposed changes
- Modernized to the latest specs of Compose.
- set casvisor service to only expose the frontend port and not the backend port on all of the host interfaces.
- removed the unmentioned in the documentation port 3000 on the Casvisor port
- Modernized the restart and deploy strategy to optimize for uptime.
- Switched Casvisor service to the official image produced by Casvisor and pushed to the docker hub registry.
- Unpublished MySQL from all interfaces and is now exposed only internally to this docker-compose stack.
- Created an explicitly defined network that is technically superfluous.
- Staggered deployment so that Casvisor does not immediately start but the 30-second delay is technically arbitrary and can't be predicted as to how long MySQL will take to launch.
- unpublished Guacd from the 0.0.0.0 interface.  Meaning it now must be accessed entirely with docker's internal DNS via the separate default network.  This network could optionally have encryption turned on for those with tin foil hats.
- added a rollback function so that if an update fails to launch the container will automatically fall back to the last known good.

* fix: Resove suggestions for PR #94

switched exposed port to 19000 as per suggested and shortened deploy delay to 15 seconds.
  • Loading branch information
Leopere committed May 16, 2024
1 parent e1f43f5 commit 53a25fe
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,57 @@
version: '3.1'
services:
casvisor:
restart: always
build:
context: ./
dockerfile: Dockerfile
target: STANDARD
image: casbin/casvisor
ports:
- "19000:19000"
- "3000:3000"
depends_on:
- db
environment:
RUNNING_IN_DOCKER: "true"
volumes:
- ./conf:/home/casvisor/conf
deploy:
update_config:
order: start-first
failure_action: rollback
delay: 15s
parallelism: 1
networks:
- default

db:
restart: always
image: mysql:8.0.25
platform: linux/amd64
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- /usr/local/docker/mysql:/var/lib/mysql
deploy:
update_config:
order: stop-first
failure_action: rollback
delay: 0s
parallelism: 1
networks:
- default

guacd:
image: guacamole/guacd:latest
environment:
GUACD_LOG_LEVEL: debug
volumes:
- ./data/guacd:/usr/local/casvisor/data
ports:
- "4822:4822"
restart:
always
restart: always
depends_on:
- db
deploy:
update_config:
order: start-first
failure_action: rollback
delay: 0s
parallelism: 1
networks:
- default

networks:
default:

0 comments on commit 53a25fe

Please sign in to comment.