Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jjethwa authored Jan 12, 2021
2 parents d16de72 + 91ccdf6 commit 1e88542
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ RUNDECK_GID - The unix group ID to be used for the rundeck account when rundeck
RUNDECK_WITH_SSL - Enable SSL
RUNDECK_USER - MySQL 'rundeck' username
RUNDECK_PASSWORD - MySQL 'rundeck' user password
RUNDECK_ADMIN_PASSWORD - The rundeck server admin password
Expand Down
13 changes: 7 additions & 6 deletions content/opt/run
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ if [ ! -f "${initfile}" ]; then
fi

DATABASE_URL=${DATABASE_URL:-"jdbc:mysql://localhost/rundeckdb?autoReconnect=true"}
DATABASE_DRIVER=${DATABASE_DRIVER:-"com.mysql.jdbc.Driver"}
DATABASE_DRIVER=${DATABASE_DRIVER:-"org.mariadb.jdbc.Driver"}
RUNDECK_USER=${RUNDECK_USER:-"rundeck"}
RUNDECK_PASSWORD=${RUNDECK_PASSWORD:-$(pwgen -s 15 1)}
DATABASE_ADMIN_PASSWORD=${DATABASE_ADMIN_PASSWORD:-${RUNDECK_PASSWORD}}
DATABASE_ADMIN_USER=${DATABASE_ADMIN_USER:-rundeck}
Expand Down Expand Up @@ -117,7 +118,7 @@ if [ ! -f "${initfile}" ]; then

(
echo "CREATE DATABASE IF NOT EXISTS rundeckdb;"
echo "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, CREATE VIEW, ALTER, INDEX, EXECUTE ON rundeckdb.* TO 'rundeck'@'localhost' IDENTIFIED BY '${RUNDECK_PASSWORD}';"
echo "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, CREATE VIEW, ALTER, INDEX, EXECUTE ON rundeckdb.* TO '${RUNDECK_USER}'@'localhost' IDENTIFIED BY '${RUNDECK_PASSWORD}';"
echo "quit"
) |
mysql
Expand All @@ -138,7 +139,7 @@ if [ ! -f "${initfile}" ]; then
echo "=>Initializing remote MySQL setup"
(
echo "CREATE DATABASE IF NOT EXISTS rundeckdb;"
echo "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, CREATE VIEW, ALTER, INDEX, EXECUTE ON rundeckdb.* TO 'rundeck'@'%' IDENTIFIED BY '${RUNDECK_PASSWORD}';"
echo "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, CREATE VIEW, ALTER, INDEX, EXECUTE ON rundeckdb.* TO '${RUNDECK_USER}'@'%' IDENTIFIED BY '${RUNDECK_PASSWORD}';"
echo "quit"
) |
mysql --host=${MYSQL_SERVER_NODE} --port=${MYSQL_SERVER_PORT} --user=${DATABASE_ADMIN_USER} --password=${DATABASE_ADMIN_PASSWORD}
Expand Down Expand Up @@ -176,7 +177,7 @@ if [ ! -f "${initfile}" ]; then
fi

sed -i 's,dataSource.dbCreate.*,,g' /etc/rundeck/rundeck-config.properties
sed -i 's,dataSource.url = .*,dataSource.url = '${DATABASE_URL}',g' /etc/rundeck/rundeck-config.properties
sed -i 's,dataSource.url = .*,dataSource.url = '${DATABASE_URL//\&/\\\&}',g' /etc/rundeck/rundeck-config.properties
if grep -q dataSource.driverClassName /etc/rundeck/rundeck-config.properties ; then
sed -i 's,dataSource.driverClassName = .*,dataSource.driverClassName = '${DATABASE_DRIVER}',g' /etc/rundeck/rundeck-config.properties
else
Expand All @@ -185,7 +186,7 @@ if [ ! -f "${initfile}" ]; then
if grep -q dataSource.username /etc/rundeck/rundeck-config.properties ; then
:
else
echo -e "\ndataSource.username = rundeck" >> /etc/rundeck/rundeck-config.properties
echo -e "\ndataSource.username = ${RUNDECK_USER}" >> /etc/rundeck/rundeck-config.properties
fi
if grep -q dataSource.password /etc/rundeck/rundeck-config.properties ; then
sed -i 's,dataSource.password = .*,dataSource.password = '${RUNDECK_PASSWORD}',g' /etc/rundeck/rundeck-config.properties
Expand Down Expand Up @@ -327,7 +328,7 @@ if [ ! -f "${initfile}" ]; then
else
echo "MySQL user 'root' has no password but only allows local connections"
fi
echo "MySQL user 'rundeck' password set to ${RUNDECK_PASSWORD}"
echo "MySQL user '${RUNDECK_USER}' password set to ${RUNDECK_PASSWORD}"
echo "Rundeck project storage type set to ${RUNDECK_PROJECT_STORAGE_TYPE}"
echo "Rundeck Storage provider set to ${RUNDECK_STORAGE_PROVIDER}"
echo "Rundeck public key:"
Expand Down
2 changes: 1 addition & 1 deletion content/opt/rundeck-defaults/rundeck-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rss.enabled=false
# change hostname here
#grails.serverURL=

dataSource.driverClassName = com.mysql.jdbc.Driver
dataSource.driverClassName = org.mariadb.jdbc.Driver
dataSource.url = jdbc:mysql://localhost/rundeckdb?autoReconnect=true
dataSource.username = rundeck
dataSource.password = rundeck
Expand Down

0 comments on commit 1e88542

Please sign in to comment.