Bläddra i källkod

fixed mariadb upgrade

master
Lukasz Jarosz 5 år sedan
förälder
incheckning
680e9cf0e8
3 ändrade filer med 13 tillägg och 21 borttagningar
  1. 1
    1
      Dockerfile
  2. 9
    0
      files/etc/s6/mariadb-upgrade/run
  3. 3
    20
      files/etc/s6/mariadb/setup

+ 1
- 1
Dockerfile Visa fil

@@ -5,5 +5,5 @@ LABEL maintainer="Lukasz Jarosz <lukasz@jarosz.pl>"
5 5
 COPY files /
6 6
 
7 7
 RUN apk update && \
8
-    apk add --no-cache mariadb mariadb-server-utils  mariadb-client nginx pwgen su-exec python3 openssl && \
8
+    apk add --no-cache mariadb mariadb-server-utils mariadb-client nginx pwgen su-exec python3 openssl && \
9 9
     pip3 install acme-tiny

+ 9
- 0
files/etc/s6/mariadb-upgrade/run Visa fil

@@ -0,0 +1,9 @@
1
+#!/bin/sh
2
+
3
+s6-svwait -ua /etc/s6/mariadb
4
+sleep 2
5
+
6
+echo "triggering MariaDB upgrade..."
7
+mysql_upgrade
8
+
9
+exec tail -f /dev/null

+ 3
- 20
files/etc/s6/mariadb/setup Visa fil

@@ -4,6 +4,7 @@ if [ ! -d /run/mysqld ]; then
4 4
   echo "/run/mysqld not found so creating one"
5 5
   mkdir -p /run/mysqld
6 6
 fi
7
+echo "ensuring /run/mysqld permissions"
7 8
 chown mysql:mysql /run/mysqld
8 9
 
9 10
 if [ /etc/my.cnf.d/mariadb-server.cnf ]; then
@@ -30,7 +31,7 @@ if [ ! -d $DATADIR ]; then
30 31
     if echo 'SELECT 1' | mysql &> /dev/null; then
31 32
       break
32 33
     fi
33
-    echo 'MySQL init process in progress...'
34
+    echo 'MariaDB init process in progress...'
34 35
     sleep 5
35 36
 	done
36 37
 
@@ -38,27 +39,9 @@ if [ ! -d $DATADIR ]; then
38 39
   cat /tmp/dbinit.sql | mysql
39 40
 
40 41
   if ! kill -s TERM "$pid" || ! wait "$pid"; then
41
-    echo >&2 'MySQL init process failed.'
42
+    echo >&2 'MariaDB init process failed.'
42 43
     exit 1
43 44
   fi
44 45
 
45 46
   rm /tmp/dbinit.sql
46 47
 fi
47
-
48
-su-exec mysql:mysql mysqld --bind-address=127.0.0.1 --datadir=$DATADIR &
49
-pid="$!"
50
-
51
-for i in {30..0}; do
52
-  if echo 'SELECT 1' | mysql &> /dev/null; then
53
-    break
54
-  fi
55
-  echo 'MySQL init process in progress...'
56
-  sleep 5
57
-done
58
-
59
-mysql_upgrade
60
-
61
-if ! kill -s TERM "$pid" || ! wait "$pid"; then
62
-  echo >&2 'MySQL upgrade process failed.'
63
-  exit 1
64
-fi

Laddar…
Avbryt
Spara