This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from docker/comanagephp
Comanagephp
- Loading branch information
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
#!/bin/bash | ||
|
||
log=/tmp/cleanup.log | ||
|
||
date >> $log | ||
|
||
echo "Cleaning firsttimerunning" >> $log | ||
|
||
rm /tmp/firsttimerunning | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,9 @@ | |
|
||
/opt/bin/configure_httpd.sh | ||
|
||
/opt/bin/configure_shibd.sh | ||
|
||
/opt/bin/configure_php.sh | ||
|
||
/opt/bin/configure_shibd.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,62 @@ | ||
#!/bin/bash | ||
|
||
log="/tmp/php.log" | ||
date >> $log | ||
echo "Configuring php: " >> $log | ||
|
||
echo "Configuring php: " > $log | ||
echo " " >> $log | ||
echo "Checking variables before configuring config files " >> $log | ||
|
||
if [[ $MYSQL_HOST && ${MYSQL_HOST-x} ]] && [[ $MYSQL_USER && ${MYSQL_USER-x} ]] && [[ $MYSQL_PASSWORD && ${MYSQL_PASSWORD-x} ]] && [[ $MYSQL_DATABASE && ${MYSQL_DATABASE-x} ]] && [[ $COMANAGE_MAIL_FROM && ${COMANAGE_MAIL_FROM-x} ]] && [[ $COMANAGE_MAIL_HOST && ${COMANAGE_MAIL_HOST-x} ]] && [[ $COMANAGE_MAIL_PORT && ${COMANAGE_MAIL_PORT-x} ]] && [[ $COMANAGE_MAIL_USER && ${COMANAGE_MAIL_USER-x} ]] && [[ $COMANAGE_MAIL_PASS && ${COMANAGE_MAIL_PASS-x} ]]; then | ||
sed -i "s|CHANGE_TO_ENV_MYSQL_HOST|$MYSQL_HOST|g" /opt/etc/php/database.php | ||
sed -i "s|CHANGE_TO_ENV_MYSQL_USERNAME|$MYSQL_USER|g" /opt/etc/php/database.php | ||
sed -i "s|CHANGE_TO_ENV_MYSQL_PASSWORD|$MYSQL_PASSWORD|g" /opt/etc/php/database.php | ||
sed -i "s|CHANGE_TO_ENV_MYSQL_TABLE|$MYSQL_DATABASE|g" /opt/etc/php/database.php | ||
sed -i "s|CHANGE_TO_COMANAGE_MAIL_FROM|$COMANAGE_MAIL_FROM|g" /opt/etc/php/email.php | ||
sed -i "s|CHANGE_TO_COMANAGE_MAIL_HOST|$COMANAGE_MAIL_HOST|g" /opt/etc/php/email.php | ||
sed -i "s|CHANGE_TO_COMANAGE_MAIL_PORT|$COMANAGE_MAIL_PORT|g" /opt/etc/php/email.php | ||
sed -i "s|CHANGE_TO_COMANAGE_MAIL_USER|$COMANAGE_MAIL_USER|g" /opt/etc/php/email.php | ||
sed -i "s|CHANGE_TO_COMANAGE_MAIL_PASS|$COMANAGE_MAIL_PASS|g" /opt/etc/php/email.php | ||
echo "Variables process was completed without any error" >> $log | ||
else | ||
echo "Variables are not totally filled so no configuration was performed" >> $log | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters