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

Added capability to detect schema needs, closes #16 #17

Merged
1 commit merged into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion container_files/bin/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log=/tmp/cleanup.log
log=/opt/log/cleanup.log

date >> $log

Expand Down
2 changes: 1 addition & 1 deletion container_files/bin/configure_httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log="/tmp/httpd.log"
log="/opt/log/httpd.log"
date >> $log
echo "Configuring httpd: " >> $log
echo "Parsing COMANAGE_SERVER_FQDN to $COMANAGE_SERVER_FQDN in virtualhost 80 and 443" >> $log
Expand Down
4 changes: 2 additions & 2 deletions container_files/bin/configure_php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log="/tmp/php.log"
log="/opt/log/php.log"
date >> $log
echo "Configuring php: " >> $log

Expand Down Expand Up @@ -54,7 +54,7 @@ else
exit 1
fi
date >> $log
echo "First database input was completed whithout any error" >> $log
echo "First database input was completed without 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
Expand Down
18 changes: 14 additions & 4 deletions container_files/bin/configure_php_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log=/tmp/php-user.sh
log=/opt/log/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

schema=$( mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" $MYSQL_DATABASE -e 'desc cm_users' )
laststatus=$?

if [ ! $laststatus -eq 0 ]; then
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
else
echo "table cm_users exists, skipping provisioning" >> $log
fi



2 changes: 1 addition & 1 deletion container_files/bin/configure_shibd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log="/tmp/shibd.log"
log="/opt/log/shibd.log"
date >> $log
echo "Configuring shibd: " > $log
if [[ $COMANAGE_SERVER_FQDN && ${COMANAGE_SERVER_FQDN-x} ]]; then
Expand Down
2 changes: 1 addition & 1 deletion container_files/bin/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
log="/tmp/start-main.log"
log="/opt/log/start-main.log"

echo "Starting Container: " > $log
date >> $log
Expand Down
19 changes: 0 additions & 19 deletions container_files/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ else
echo "Testing connectivity to database before continue with install" >> $log
echo "Testing connectivity to database before continue with install"
/opt/wait-for-it/wait-for-it.sh $MYSQL_HOST:3306 -t $WAIT_TIME --strict -- /opt/bin/main.sh >> $log
echo "Mariadb default port is open and test connection ok"
echo "Mariadb default port is open and test connection ok" >> $log
echo "Testing connectivy to database before continue with install" >> $log
echo "Testing connectivy to database before continue with install"
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;"
laststatus="$?"
echo "checking connectivity" >> $log
while [ "$laststatus" != "0" ]; do
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;"
laststatus="$?"
sleep 5
date >> $log
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE"
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE" >> $log
done
echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error" >> $log
echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error"
date >> $log
/opt/bin/main.sh
laststatus="$?"
echo "main.sh last status: $laststatus"
if [ "$laststatus" != "0" ]; then
Expand Down