Skip to content

Commit

Permalink
Merge branch 'bigfleet-refactor'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Sep 5, 2016
2 parents f37b952 + ff3bf9c commit 0955c61
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ LABEL Build docker build --rm --tag $registry/$maintainer/$imagename .
RUN yum -y install --setopt=tsflags=nodocs mariadb-server bind-utils pwgen psmisc hostname vim

# Add starters and installers
ADD ./container_files /root
ADD ./container_files /opt

# Add Volumes and Set permissions
RUN mkdir /opt/shared && chmod 777 /opt/shared && chmod 777 /root/*.sh
RUN mkdir /opt/shared && chmod 777 /opt/shared && chmod 777 /opt/bin/*.sh

# Place VOLUME statement below all changes to /var/lib/mysql
VOLUME /var/lib/mysql
Expand All @@ -39,4 +39,4 @@ ENV TERM "testterm"
# Port
EXPOSE 3306

CMD ["/root/container_start.sh"]
CMD ["/opt/bin/start.sh"]
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ node('docker') {

sh 'rm -rf tmp'
sh 'docker rm mariadb'
sh 'docker volume rm $(docker volume ls -qf dangling=true)'

}

Expand Down
2 changes: 1 addition & 1 deletion bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
source common.bash .

echo "Running Docker image($registry/$maintainer/$imagename)"
docker run --name=$imagename -d -p 3306:3306 $maintainer/$imagename
docker run --name=$imagename -d -p 3306:3306 -v mysql:/var/lib/mysql $maintainer/$imagename

exit 0
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ if [ -e "/tmp/firsttimerunning" ]; then


if [ "$MYSQL_DATABASE" != "" ]; then
echo "flush privileges;" >> "$tempSqlFile"
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" >> "$tempSqlFile"
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'comanage.compose_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'comanage.comanage_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'comanage.config_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'$MYSQL_DATABASE.%_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'$MYSQL_DATABASE.%_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
echo "GRANT ALL ON $MYSQL_DATABASE.* TO '$MYSQL_USER'@'$MYSQL_DATABASE.%_i2network' IDENTIFIED BY '$MYSQL_PASSWORD' ;" >> "$tempSqlFile"
fi

echo 'FLUSH PRIVILEGES ;' >> "$tempSqlFile"

echo "character-set-server = utf8mb4" >> /etc/my.cnf
echo "collation-server = utf8mb4_unicode_ci" >> /etc/my.cnf
# [jvf] mysqld_safe unknown option '--character-set-server=utf8' [FIXME]
#echo "character-set-server = utf8" >> /etc/my.cnf
#echo "collation-server = utf8_unicode_ci" >> /etc/my.cnf
echo "" >> /etc/my.cnf

echo "Fixing Permissions" >> $log
chown -R mysql:mysql $MYSQL_DATADIR
/root/fix-permissions.sh $MYSQL_DATADIR >> $log
/root/fix-permissions.sh /var/log/mariadb/ >> $log
/root/fix-permissions.sh /var/run/ >> $log
/opt/bin/fix-permissions.sh $MYSQL_DATADIR >> $log
/opt/bin/fix-permissions.sh /var/log/mariadb/ >> $log
/opt/bin/fix-permissions.sh /var/run/ >> $log
echo "Done Fixing Permissions" >> $log

/usr/bin/mysqld_safe --init-file="$tempSqlFile" --datadir="$MYSQL_DATADIR"
Expand Down

0 comments on commit 0955c61

Please sign in to comment.