diff --git a/README.md b/README.md index ed7a2c6..2268c46 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # vagrant -le 2025-09-25 13h30 - ps +le 2025-11-25 13h30 - ps Ce dépôt héberge des **Vagrantfile** dont : * **dns** : Vagrantfile pour 2 serveurs **Bind9** (1 maitre et un esclave), tests **goss** chainés * **divers/logs** : Vagrantfile pour serveur et client **rsyslog** sans journald * **docker** * **docker-wordpress** - * **docker-glpi** + * **docker-glpi** : Vagrantfile pour GLPI 11.0 avec docker - VM Debian 12 * **docker-elk** * **docker-traefik-nextcloud** * **docker-traefik-nextcloud-ss-tls** diff --git a/docker-glpi/Vagrantfile b/docker-glpi/Vagrantfile index f80d760..9889613 100644 --- a/docker-glpi/Vagrantfile +++ b/docker-glpi/Vagrantfile @@ -12,7 +12,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.box = "debian/bookworm64" config.vm.hostname = "glpi" # Disable automatic box update checking. If you disable this, then @@ -65,6 +65,7 @@ Vagrant.configure("2") do |config| # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL + timedatectl set-timezone Europe/Paris apt-get update apt install -y wget curl git vim if ! which docker ; then @@ -73,44 +74,54 @@ Vagrant.configure("2") do |config| gpasswd -a vagrant docker fi mkdir -p docker/glpi && cd docker/glpi -cat > docker-compose.yml <<-EOT -version: "3.2" - +cat > compose.yml <<-EOT services: -#MariaDB Container - mariadb: - image: mariadb:10.7 - container_name: mariadb - hostname: mariadb - volumes: - - ./mysql:/var/lib/mysql - env_file: - - ./mariadb.env - restart: always - -#GLPI Container glpi: - image: diouxx/glpi - container_name: glpi - hostname: glpi + image: "glpi/glpi:latest" + restart: "unless-stopped" + volumes: + - "./storage/glpi:/var/glpi:rw" + env_file: .env # Pass environment variables from .env file to the container + depends_on: + db: + condition: service_healthy ports: - "80:80" - volumes: - - /etc/timezone:/etc/timezone:ro - - /etc/localtime:/etc/localtime:ro - - /var/www/html/glpi/:/var/www/html/glpi environment: - TIMEZONE=Europe/Paris - restart: always + + db: + image: "mariadb" + restart: "unless-stopped" + volumes: + - "./storage/mysql:/var/lib/mysql" + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + environment: + MYSQL_RANDOM_ROOT_PASSWORD: "yes" + MYSQL_DATABASE: ${GLPI_DB_NAME} + MYSQL_USER: ${GLPI_DB_USER} + MYSQL_PASSWORD: ${GLPI_DB_PASSWORD} + healthcheck: + #test: mariadbadmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + start_period: 5s + interval: 5s + timeout: 5s + retries: 10 + expose: + - "3306" EOT -cat > mariadb.env <<-EOT -MARIADB_ROOT_PASSWORD=diouxx -MARIADB_DATABASE=glpidb -MARIADB_USER=glpi_user -MARIADB_PASSWORD=glpi + +cat > .env <<-EOT +GLPI_DB_HOST=db +GLPI_DB_PORT=3306 +GLPI_DB_NAME=glpi +GLPI_DB_USER=glpi +GLPI_DB_PASSWORD=glpi EOT docker compose up -d ip -br a - SHELL + SHELL end