turned base into guacamole deployment
This commit is contained in:
1 parent
5ed1af1f7f
commit
6aef4d222c
4 files changed
+132
-12
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
WAIT_TIMEOUT=10
|
||||
|
||||
# Retrieve proper environment variables
|
||||
GUACAMOLE_VERSION=$(cat .env | grep GUACAMOLE_VERSION | sed 's/GUACAMOLE_VERSION=//')
|
||||
MARIADB_NAME=$(cat .env | grep MARIADB_NAME | sed 's/MARIADB_NAME=//')
|
||||
|
||||
# Pull the Guacamole image
|
||||
docker pull guacamole/guacamole:"${GUACAMOLE_VERSION}"
|
||||
|
||||
# Generate initial database schema from Guacamole's image
|
||||
docker run -it --rm \
|
||||
guacamole/guacamole:"${GUACAMOLE_VERSION}" \
|
||||
/opt/guacamole/bin/initdb.sh \
|
||||
--mysql > initdb.sql
|
||||
|
||||
# Start the database instance
|
||||
docker compose up -d mariadb
|
||||
|
||||
# Wait a couple of seconds that the database is ready
|
||||
for I in $(eval echo "{$WAIT_TIMEOUT..1}"); do
|
||||
printf " ${I}"
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
|
||||
# Initialize the database
|
||||
docker compose exec \
|
||||
--no-TTY -e MARIADB_NAME="${MARIADB_NAME}" mariadb \
|
||||
sh -c 'exec mysql -uroot -p"$MARIADB_ROOT_PASSWORD" "$MARIADB_NAME"' < initdb.sql
|
||||
|
||||
# Remove the unnecessary database init file
|
||||
rm -rf initdb.sql
|
||||
|
||||
# Stop & remove the database container for good measure
|
||||
docker compose rm -fs mariadb
|
||||
Reference in new issue
Block a user