“Albert ecf4af3734 typo
2023-01-18 13:22:43 +01:00

77 lines
1.7 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
rep="guacamole"
apt-get update
apt-get install -y curl wget vim
if ! which docker ; then
curl -s -o getdocker.sh https://get.docker.com
bash getdocker.sh
gpasswd -a vagrant docker
fi
[[ -e "$rep" ]] || mkdir "$rep"
cd "$rep" || exit 1
cat > docker-compose.yml <<EOT
version: '3'
services:
guacdb:
container_name: guacdb
image: mariadb/server:latest
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'MariaDBRootPSW'
MYSQL_DATABASE: 'guacamole_db'
MYSQL_USER: 'guacamole_user'
MYSQL_PASSWORD: 'MariaDBUserPSW'
volumes:
- 'guacdb-data:/var/lib/mysql'
- ./initdb:/docker-entrypoint-initdb.d
guacd:
container_name: guacd
image: guacamole/guacd
restart: unless-stopped
guacamole:
container_name: guacamole
image: 'guacamole/guacamole:latest'
restart: unless-stopped
ports:
- '8080:8080'
environment:
GUACD_HOSTNAME: "guacd"
MYSQL_HOSTNAME: "guacdb"
MYSQL_DATABASE: "guacamole_db"
MYSQL_USER: "guacamole_user"
MYSQL_PASSWORD: "MariaDBUserPSW"
depends_on:
- guacdb
- guacd
volumes:
guacdb-data:
EOT
docker compose pull
# creation fichiers initialisation mariadb
[[ -e "initdb" ]] || mkdir "initdb"
cat > initdb/01-initdb.sql <<EOT
CREATE DATABASE IF NOT EXISTS guacamole_db;
EOT
echo "USE guacamole_db ;" > initdb/02-initdb.sql
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql >> initdb/02-initdb.sql
cat > initdb/03-initdb.sql <<EOT
CREATE USER IF NOT EXISTS 'guacamole_user'@'%' IDENTIFIED BY 'StrongPassw0rd';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'%';
FLUSH PRIVILEGES;
EOT
docker compose up -d