Skip to content

Commit

Permalink
Basic refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Sep 2, 2016
1 parent 49b84dd commit cb419dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 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"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,31 @@ if [ -e "/tmp/firsttimerunning" ]; then
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"
fi

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

echo "character-set-server = utf8mb4" >> /etc/my.cnf
echo "collation-server = utf8mb4_unicode_ci" >> /etc/my.cnf
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"
else
echo "Not Creating a MariaDB - Using Existing from DataDir: $MYSQL_DATADIR" >> $log

echo "Fixing Permissions" >> $log
chown -R mysql:mysql $MYSQL_DATADIR
/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

/usr/bin/mysqld_safe --datadir="$MYSQL_DATADIR"
fi

Expand Down

0 comments on commit cb419dc

Please sign in to comment.