1
0
mirror of https://github.com/MysticRyuujin/guac-install.git synced 2023-10-10 13:36:56 +02:00
guac-install/docker-install.sh
Chase Wright d07bfcb98b
0.9.14 Release (#23)
* Support Upgrade From Older Versions

First I've added a MySQL Root Password Prompt, it will verify that the user is entering the correct password and will not continue until the MySQL Root Password is entered correctly.

Second, I'm just getting the tomcat version number from /etc/ folder name...This seems to work well enough (instead of making the user edit the script manually)...Maybe someone can come up with a better solution?

Third, I'm using the Version.js file to get the currently installed versions number. This allows for supporting multiple version number upgrades (E.G going from 0.8.2 to 0.9.14). The script will now loop through all of the SQL Upgrade files, and apply any that are newer than the OLDVERSION...

I.E. Going from 0.9.9 to 0.9.13 should automatically install `upgrade-pre-0.9.10.sql` & `upgrade-pre-0.9.11.sql` & `upgrade-pre-0.9.13.sql`

* Remove GUACAMOLE_HOME

According to the documentation this is now a default search path, so this isn't required anymore

* Version Control for Ubuntu and Debian

This might need more work but it should install the proper packages for both Ubuntu and Debian and account for Tomcat 8.0.x and 8.5.x differences...

http://tomcat.apache.org/whichversion.html

7.x does not say end of life... but 8.0.x does. The distro maintainers have different versions of Tomcat8 so we can check for 8.5.x or newer options and install, otherwise go the safer route and install Tomcat7

* Remove rm and ln of tomcat/.guacamole

According to the documentation this is not required (it may not have been required to begin with?)

* No Longer Incubating!
2018-01-20 08:23:04 -06:00

66 lines
2.2 KiB
Bash

#!/bin/bash
# WORKING ON UBUNTU 16.04 LTS
VERSION="0.9.14"
# Get MySQL root password and Guacamole User password
echo
while true
do
read -s -p "Enter a MySQL ROOT Password: " mysqlrootpassword
echo
read -s -p "Confirm MySQL ROOT Password: " password2
echo
[ "$mysqlrootpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
while true
do
read -s -p "Enter a Guacamole User Database Password: " guacdbuserpassword
echo
read -s -p "Confirm Guacamole User Database Password: " password2
echo
[ "$guacdbuserpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
#Install Stuff
apt update
apt -y install docker.io mysql-client wget
# Get perfered download server
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}-incubating"
# Download the Guacamole auth files for MySQL
wget -O guacamole-auth-jdbc-${VERSION}-incubating.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
tar -xzf guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
# Start MySQL
docker run --restart=always --detach --name=mysql --env="MYSQL_ROOT_PASSWORD=$mysqlrootpassword" --publish 3306:3306 mysql
# Sleep to let MySQL load (there's probably a better way to do this)
echo "Waiting 30 seconds for MySQL to load"
sleep 30
# Create the Guacamole database and the user account
# SQL Code
SQLCODE="
create database guacamole_db;
create user 'guacamole_user'@'%' identified by '$guacdbuserpassword';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'%';
flush privileges;"
# Execute SQL Code
echo $SQLCODE | mysql -h 127.0.0.1 -P 3306 -u root -p$mysqlrootpassword
cat guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/*.sql | mysql -u root -p$mysqlrootpassword -h 127.0.0.1 -P 3306 guacamole_db
docker run --restart=always --name guacd -d guacamole/guacd
docker run --restart=always --name guacamole --link mysql:mysql --link guacd:guacd -e MYSQL_HOSTNAME=127.0.0.1 -e MYSQL_DATABASE=guacamole_db -e MYSQL_USER=guacamole_user -e MYSQL_PASSWORD=$guacdbuserpassword --detach -p 8080:8080 guacamole/guacamole
rm -rf guacamole-auth-jdbc-${VERSION}-incubating*