Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
ADded other script to use variables
Browse files Browse the repository at this point in the history
  • Loading branch information
villadalmine committed Sep 14, 2016
1 parent 3c35693 commit 30e1a89
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ ENV MYSQL_HOST "i2mariadb"
ENV MYSQL_DATABASE "registry"
ENV MYSQL_USER "registry_user"
ENV MYSQL_PASSWORD "WJzesbe3poNZ91qIbmR7"
ENV ADMIN_FAMILY "admin"
ENV ADMIN_USERNAME "admin"
ENV ADMIN_NAME "admin"
ENV TERM "testterm"
# How long will we wait for MariaDB to start up?
ENV WAIT_TIME 60
Expand Down
37 changes: 37 additions & 0 deletions container_files/bin/configure_php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,40 @@ else

fi
date >> $log
if [ -z ${COMPOSE+x} ];then
echo "Comanage is not composed no database configuration will be perform" >> $log
else
echo "Comanage is composed. Checking variables to Configure first database data" >> $log
if [[ $ADMIN_NAME && ${ADMIN_NAME-x} ]] && [[ $ADMIN_FAMILY && ${ADMIN_FAMILY-x} ]] && [[ $ADMIN_USERNAME && ${ADMIN_USERNAME-x} ]] & [[ $version && ${version-x} ]]; then
echo "Variables are ok" >> $log
echo "Doing first configuration in database data" >> $log
cd /opt/comanage/comanage-registry-$version/app
./Console/cake database >> $log
laststatus=$?
echo "Composed status: $laststatus" >> $log
if [ "$laststatus" != "0" ]; then
echo "Not composed non-zero exit status: $laststatus" >> $log
echo "Console cake database script failed" >> $log
exit 1
fi
date >> $log
echo "First database input was completed whithout any error" >> $log
echo "Doing variable parsing" >> $log
sed -i "s|ADMIN_NAME|$ADMIN_NAME|g" /opt/bin/configure_php_user.sh
sed -i "s|ADMIN_FAMILY|$ADMIN_FAMILY|g" /opt/bin/configure_php_user.sh
sed -i "s|ADMIN_USERNAME|$ADMIN_USERNAME|g" /opt/bin/configure_php_user.sh
/opt/bin/configure_php_user.sh
laststatus=$?
if [ "$laststatus" != "0" ]; then
echo "Not composed non-zero exit status: $laststatus" >> $log
echo "Console cake database setup script failed" >> $log
exit 1
fi
date >> $log
echo "Configuration of database was completed" >> $log
else
echo "Variables were not provided . Configuration of database is not possible" >> $log
date >> $log
fi

fi
7 changes: 7 additions & 0 deletions container_files/bin/configure_php_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
log=/tmp/php-user.sh

date >> $log
cd /opt/comanage/comanage-registry-$version/app
echo "Performing database user setup" >> $log
./Console/cake setup --admin-given-name ADMIN_NAME --admin-family-name ADMIN_FAMILY --admin-username ADMIN_USERNAME --enable-pooling=No --force >> $log

0 comments on commit 30e1a89

Please sign in to comment.