Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DMY-002 Fixing MySQL 5.7 startup-errors
- Loading branch information
Showing
15 changed files
with
489 additions
and
333 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Note: | ||
# To effectively apply the changes you will have | ||
# to re-index the git index (if there are already | ||
# commited files) | ||
# | ||
# $ git rm -r --cached . | ||
# $ git add . | ||
# $ git commit -m ".gitignore index rebuild" | ||
# | ||
|
||
|
||
###################################### | ||
# CUSTOM | ||
###################################### | ||
|
||
|
||
###################################### | ||
# GENERIC | ||
###################################### | ||
|
||
###### std ###### | ||
.lock | ||
*.log | ||
|
||
###### patches/diffs ###### | ||
*.patch | ||
*.diff | ||
*.orig | ||
*.rej | ||
|
||
|
||
###################################### | ||
# Operating Systems | ||
###################################### | ||
|
||
###### OSX ###### | ||
._* | ||
.DS* | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
###### Windows ###### | ||
Thumbs.db | ||
ehthumbs.db | ||
Desktop.ini | ||
$RECYCLE.BIN/ | ||
*.lnk | ||
*.shortcut | ||
|
||
###################################### | ||
# Editors | ||
###################################### | ||
|
||
###### Sublime ###### | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
###### Eclipse ###### | ||
.classpath | ||
.buildpath | ||
.project | ||
.settings/ | ||
|
||
###### Netbeans ###### | ||
/nbproject/ | ||
|
||
###### Intellij IDE ###### | ||
.idea/ | ||
.idea_modules/ | ||
|
||
###### vim ###### | ||
*.swp | ||
*.swo | ||
*.swn | ||
*.swm | ||
*~ | ||
|
||
###### TextMate ###### | ||
.tm_properties | ||
*.tmproj | ||
|
||
###### BBEdit ###### | ||
*.bbprojectd | ||
*.bbproject | ||
|
||
.vagrant |
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
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,56 @@ | ||
#!/bin/sh -eu | ||
|
||
|
||
### | ||
### Globals | ||
### | ||
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)/.." | ||
|
||
|
||
### | ||
### Funcs | ||
### | ||
run() { | ||
_cmd="${1}" | ||
_red="\033[0;31m" | ||
_green="\033[0;32m" | ||
_reset="\033[0m" | ||
_user="$(whoami)" | ||
|
||
printf "${_red}%s \$ ${_green}${_cmd}${_reset}\n" "${_user}" | ||
sh -c "LANG=C LC_ALL=C ${_cmd}" | ||
} | ||
|
||
|
||
### | ||
### Checks | ||
### | ||
|
||
# Check Dockerfile | ||
if [ ! -f "${CWD}/Dockerfile" ]; then | ||
echo "Dockerfile not found in: ${CWD}/Dockerfile." | ||
exit 1 | ||
fi | ||
|
||
# Get docker Name | ||
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then | ||
echo "No 'image' LABEL found" | ||
exit | ||
fi | ||
|
||
# Make sure exactly 1 container is running | ||
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )" | ||
COUNT="$( docker ps | grep -c "cytopia/${NAME}" || true)" | ||
if [ "${COUNT}" != "1" ]; then | ||
echo "${COUNT} 'cytopia/${NAME}' container running. Unable to attach." | ||
exit 1 | ||
fi | ||
|
||
|
||
### | ||
### Attach | ||
### | ||
DID="$(docker ps | grep "cytopia/${NAME}" | awk '{print $1}')" | ||
|
||
echo "Attaching to: cytopia/${NAME}" | ||
run "docker exec -it ${DID} env TERM=xterm /bin/bash -l" |
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,70 @@ | ||
#!/bin/sh -eu | ||
|
||
|
||
### | ||
### Globals | ||
### | ||
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)/.." | ||
|
||
|
||
### | ||
### Funcs | ||
### | ||
run() { | ||
_cmd="${1}" | ||
_red="\033[0;31m" | ||
_green="\033[0;32m" | ||
_reset="\033[0m" | ||
_user="$(whoami)" | ||
|
||
printf "${_red}%s \$ ${_green}${_cmd}${_reset}\n" "${_user}" | ||
sh -c "LANG=C LC_ALL=C ${_cmd}" | ||
} | ||
|
||
|
||
### | ||
### Checks | ||
### | ||
|
||
# Check Dockerfile | ||
if [ ! -f "${CWD}/Dockerfile" ]; then | ||
echo "Dockerfile not found in: ${CWD}/Dockerfile." | ||
exit 1 | ||
fi | ||
|
||
# Get docker Name | ||
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then | ||
echo "No 'image' LABEL found" | ||
exit | ||
fi | ||
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )" | ||
DATE="$( date '+%Y-%m-%d' )" | ||
|
||
|
||
### | ||
### Build | ||
### | ||
|
||
# Update build date | ||
run "sed -i'' 's/<small>\*\*Latest\sbuild.*/<small>**Latest build:** ${DATE}<\/small>/g' ${CWD}/README.md" | ||
run "sed -i'' 's/build-date=\".*\"/build-date=\"${DATE}\"/g' ${CWD}/Dockerfile" | ||
|
||
# Build Docker | ||
run "docker build -t cytopia/${NAME} ${CWD}" | ||
|
||
|
||
### | ||
### Retrieve information afterwards and Update README.md | ||
### | ||
|
||
docker run -d --rm --name my_tmp_${NAME} -e MYSQL_ROOT_PASSWORD= -t cytopia/${NAME} | ||
SQL_VERSION="$( docker exec my_tmp_${NAME} mysqld -V )" | ||
docker stop "$(docker ps | grep "my_tmp_${NAME}" | awk '{print $1}')" | ||
|
||
echo "${SQL_VERSION}" | ||
|
||
sed -i'' '/##[[:space:]]Modules/q' "${CWD}/README.md" | ||
echo "" >> "${CWD}/README.md" | ||
echo "**[Version]**" >> "${CWD}/README.md" | ||
echo "" >> "${CWD}/README.md" | ||
echo "${SQL_VERSION}" >> "${CWD}/README.md" |
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,46 @@ | ||
#!/bin/sh -eu | ||
|
||
|
||
### | ||
### Globals | ||
### | ||
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)/.." | ||
|
||
|
||
### | ||
### Funcs | ||
### | ||
run() { | ||
_cmd="${1}" | ||
_red="\033[0;31m" | ||
_green="\033[0;32m" | ||
_reset="\033[0m" | ||
_user="$(whoami)" | ||
|
||
printf "${_red}%s \$ ${_green}${_cmd}${_reset}\n" "${_user}" | ||
sh -c "LANG=C LC_ALL=C ${_cmd}" | ||
} | ||
|
||
|
||
### | ||
### Checks | ||
### | ||
|
||
# Check Dockerfile | ||
if [ ! -f "${CWD}/Dockerfile" ]; then | ||
echo "Dockerfile not found in: ${CWD}/Dockerfile." | ||
exit 1 | ||
fi | ||
|
||
# Get docker Name | ||
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then | ||
echo "No 'image' LABEL found" | ||
exit | ||
fi | ||
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )" | ||
|
||
|
||
### | ||
### Enter | ||
### | ||
run "docker run -i --entrypoint /bin/bash -t cytopia/${NAME}" |
Oops, something went wrong.