Skip to content

Commit

Permalink
Responding to desire to only perform DB related activities on first c…
Browse files Browse the repository at this point in the history
…ontainer run
  • Loading branch information
Jim Van Fleet committed Sep 2, 2016
1 parent 3aebcd3 commit fe2446e
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ ENV GROUPER_SYSTEM_PASSWORD=3cf0ccc7d6b240390188367933c9cd90
ENV MYSQL_HOST=mariadb

ADD ./container_files /root
COPY conf/grouper.installer.properties /opt/grouper/$version
COPY conf/grouper.hibernate.properties /opt/grouper/$version

RUN /root/container_start.sh
RUN rm /opt/grouper/2.3.0/grouper.apiBinary-2.3.0/conf/grouper.hibernate.properties && \
ln -s /opt/grouper/$version/grouper.hibernate.properties /opt/grouper/2.3.0/grouper.apiBinary-2.3.0/conf/grouper.hibernate.properties && \
rm /opt/grouper/2.3.0/grouper.ws-2.3.0/grouper-ws/build/dist/grouper-ws/WEB-INF/classes/grouper.hibernate.properties && \
ln -s /opt/grouper/$version/grouper.hibernate.properties /opt/grouper/2.3.0/grouper.ws-2.3.0/grouper-ws/build/dist/grouper-ws/WEB-INF/classes/grouper.hibernate.properties && \
rm /opt/grouper/2.3.0/grouper.ui-2.3.0/dist/grouper/WEB-INF/classes/grouper.hibernate.properties && \
ln -s /opt/grouper/$version/grouper.hibernate.properties /opt/grouper/2.3.0/grouper.ui-2.3.0/dist/grouper/WEB-INF/classes/grouper.hibernate.properties

VOLUME /opt/grouper/2.3.0/apache-tomcat-$TOMCAT_VERSION/logs
45 changes: 45 additions & 0 deletions conf/grouper.hibernate.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright 2014 Internet2
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Grouper Hibernate Configuration
# $Id: grouper.hibernate.example.properties,v 1.9 2009-08-11 20:18:09 mchyzer Exp $
#

# The grouper hibernate config uses Grouper Configuration Overlays (documented on wiki)
# By default the configuration is read from grouper.hibernate.base.properties
# (which should not be edited), and the grouper.hibernate.properties overlays
# the base settings. See the grouper.hibernate.base.properties for the possible
# settings that can be applied to the grouper.hibernate.properties

########################################
## DB settings
########################################

# e.g. mysql: jdbc:mysql://localhost:3306/grouper
# e.g. p6spy (log sql): [use the URL that your DB requires]
# e.g. oracle: jdbc:oracle:thin:@server.school.edu:1521:sid
# e.g. hsqldb (a): jdbc:hsqldb:dist/run/grouper;create=true
# e.g. hsqldb (b): jdbc:hsqldb:hsql://localhost:9001/grouper
# e.g. postgres: jdbc:postgresql://localhost:5432/database
# e.g. mssql: jdbc:sqlserver://localhost:3280;databaseName=grouper
hibernate.connection.url = jdbc:mysql://#MYSQL_HOST#:3306/#MYSQL_DATABASE#

hibernate.connection.username = #MYSQL_USER#
# If you are using an empty password, depending upon your version of
# Java and Ant you may need to specify a password of "".
# Note: you can keep passwords external and encrypted: https://bugs.internet2.edu/jira/browse/GRP-122
hibernate.connection.password = #MYSQL_USER#
10 changes: 6 additions & 4 deletions container_files/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

sed -i "s|#GROUPER_SYSTEM_PASSWORD#|$GROUPER_SYSTEM_PASSWORD|g" /opt/grouper/2.3.0/grouper.installer.properties

sed -i "s|#MYSQL_HOST#|$MYSQL_HOST|g" /opt/grouper/2.3.0/grouper.installer.properties
sed -i "s|#MYSQL_HOST#|$MYSQL_HOST|g" /opt/grouper/2.3.0/grouper.hibernate.properties

sed -i "s|#MYSQL_USER#|$MYSQL_USER|g" /opt/grouper/2.3.0/grouper.installer.properties
sed -i "s|#MYSQL_USER#|$MYSQL_USER|g" /opt/grouper/2.3.0/grouper.hibernate.properties

sed -i "s|#MYSQL_PASSWORD#|$MYSQL_PASSWORD|g" /opt/grouper/2.3.0/grouper.installer.properties
sed -i "s|#MYSQL_PASSWORD#|$MYSQL_PASSWORD|g" /opt/grouper/2.3.0/grouper.hibernate.properties

cat /opt/grouper/2.3.0/grouper.installer.properties
sed -i "s|#MYSQL_DATABASE#|$MYSQL_DATABASE|g" /opt/grouper/2.3.0/grouper.hibernate.properties

cat /opt/grouper/2.3.0/grouper.hibernate.properties

0 comments on commit fe2446e

Please sign in to comment.