Merge pull request #534 from pgmillon/mysql_port
Improve MySQL endpoint ping & add mariadb-connector-c
This commit is contained in:
@@ -10,7 +10,7 @@ RUN --mount=type=cache,target=/root/.cache \
|
|||||||
&& apk add --virtual build-deps gcc python3-dev musl-dev postgresql-dev \
|
&& apk add --virtual build-deps gcc python3-dev musl-dev postgresql-dev \
|
||||||
libffi-dev \
|
libffi-dev \
|
||||||
# psutil needs linux-headers to compile on musl c library.
|
# psutil needs linux-headers to compile on musl c library.
|
||||||
&& apk add --no-cache bash su-exec postgresql-client mysql-client curl python3 py3-pip linux-headers py-cryptography \
|
&& apk add --no-cache bash su-exec postgresql-client mysql-client curl python3 py3-pip linux-headers py-cryptography mariadb-connector-c \
|
||||||
&& python3 -m pip install -U pip setuptools wheel \
|
&& python3 -m pip install -U pip setuptools wheel \
|
||||||
&& python3 -m pip install psycopg2 \
|
&& python3 -m pip install psycopg2 \
|
||||||
gunicorn==19.9.0 \
|
gunicorn==19.9.0 \
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ RUN --mount=type=cache,target=/root/.cache \
|
|||||||
apk update \
|
apk update \
|
||||||
&& apk add --no-cache --virtual build-deps gcc python3-dev musl-dev \
|
&& apk add --no-cache --virtual build-deps gcc python3-dev musl-dev \
|
||||||
postgresql-dev git libffi-dev \
|
postgresql-dev git libffi-dev \
|
||||||
&& apk add --no-cache bash su-exec postgresql-client mysql-client curl python3 py3-pip linux-headers py-cryptography \
|
&& apk add --no-cache bash su-exec postgresql-client mysql-client curl python3 py3-pip linux-headers py-cryptography mariadb-connector-c \
|
||||||
&& python3 -m pip install -U psycopg2 pymysql setuptools wheel \
|
&& python3 -m pip install -U psycopg2 pymysql setuptools wheel \
|
||||||
&& python3 -m pip install \
|
&& python3 -m pip install \
|
||||||
git+https://gitlab.com/mailman/mailman@${CORE_REF} \
|
git+https://gitlab.com/mailman/mailman@${CORE_REF} \
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function wait_for_postgres () {
|
|||||||
|
|
||||||
function wait_for_mysql () {
|
function wait_for_mysql () {
|
||||||
# Check if MySQL is up and accepting connections.
|
# Check if MySQL is up and accepting connections.
|
||||||
HOSTNAME=$(python3 -c "from urllib.parse import urlparse; o = urlparse('$DATABASE_URL'); print(o.hostname);")
|
readarray -d' ' -t ENDPOINT <<< $(python3 -c "from urllib.parse import urlparse; o = urlparse('$DATABASE_URL'); print('%s %s' % (o.hostname, o.port if o.port else '3306'));")
|
||||||
until mysqladmin ping --host "$HOSTNAME" --silent; do
|
until mysqladmin ping --host ${ENDPOINT[0]} --port ${ENDPOINT[1]} --silent; do
|
||||||
>&2 echo "MySQL is unavailable - sleeping"
|
>&2 echo "MySQL is unavailable - sleeping"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ COPY docker-entrypoint.sh /usr/local/bin/
|
|||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
set -ex \
|
set -ex \
|
||||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
||||||
postgresql-dev mariadb-dev python3-dev libffi-dev openldap-dev cargo rust \
|
postgresql-dev mariadb-dev mariadb-connector-c python3-dev libffi-dev openldap-dev cargo rust \
|
||||||
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
||||||
postgresql-client mysql-client py3-mysqlclient curl mailcap gettext \
|
postgresql-client mysql-client py3-mysqlclient curl mailcap gettext \
|
||||||
python3 py3-pip libffi libuuid pcre-dev py-cryptography \
|
python3 py3-pip libffi libuuid pcre-dev py-cryptography \
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ARG CLIENT_REF
|
|||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
set -ex \
|
set -ex \
|
||||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
||||||
postgresql-dev mariadb-dev python3-dev libffi-dev git cargo rust \
|
postgresql-dev mariadb-dev mariadb-connector-c python3-dev libffi-dev git cargo rust \
|
||||||
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
||||||
postgresql-client mysql-client py3-mysqlclient curl mailcap \
|
postgresql-client mysql-client py3-mysqlclient curl mailcap \
|
||||||
python3 py3-pip libffi gettext py-cryptography \
|
python3 py3-pip libffi gettext py-cryptography \
|
||||||
|
|||||||
@@ -16,23 +16,14 @@ function wait_for_postgres () {
|
|||||||
|
|
||||||
function wait_for_mysql () {
|
function wait_for_mysql () {
|
||||||
# Check if MySQL is up and accepting connections.
|
# Check if MySQL is up and accepting connections.
|
||||||
HOSTNAME=$(python3 <<EOF
|
readarray -d' ' -t ENDPOINT <<< $(python3 -c "from urllib.parse import urlparse; o = urlparse('$DATABASE_URL'); print('%s %s' % (o.hostname, o.port if o.port else '3306'));")
|
||||||
try:
|
until mysqladmin ping --host ${ENDPOINT[0]} --port ${ENDPOINT[1]} --silent; do
|
||||||
from urllib.parse import urlparse
|
|
||||||
except ImportError:
|
|
||||||
from urlparse import urlparse
|
|
||||||
o = urlparse('$DATABASE_URL')
|
|
||||||
print(o.hostname)
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
until mysqladmin ping --host "$HOSTNAME" --silent; do
|
|
||||||
>&2 echo "MySQL is unavailable - sleeping"
|
>&2 echo "MySQL is unavailable - sleeping"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
>&2 echo "MySQL is up - continuing"
|
>&2 echo "MySQL is up - continuing"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function check_or_create () {
|
function check_or_create () {
|
||||||
# Check if the path exists, if not, create the directory.
|
# Check if the path exists, if not, create the directory.
|
||||||
if [[ ! -e dir ]]; then
|
if [[ ! -e dir ]]; then
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ COPY docker-entrypoint.sh /usr/local/bin/
|
|||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
set -ex \
|
set -ex \
|
||||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers \
|
||||||
postgresql-dev mariadb-dev python3-dev libffi-dev openldap-dev cargo rust \
|
postgresql-dev mariadb-dev mariadb-connector-c python3-dev libffi-dev openldap-dev cargo rust \
|
||||||
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
&& apk add --no-cache --virtual .mailman-rundeps bash sassc \
|
||||||
postgresql-client mysql-client py3-mysqlclient curl mailcap gettext \
|
postgresql-client mysql-client py3-mysqlclient curl mailcap gettext \
|
||||||
python3 py3-pip xapian-core xapian-bindings-python3 libffi pcre-dev py-cryptography \
|
python3 py3-pip xapian-core xapian-bindings-python3 libffi pcre-dev py-cryptography \
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ ARG CLIENT_REF
|
|||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
set -ex \
|
set -ex \
|
||||||
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers git \
|
&& apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers git \
|
||||||
postgresql-dev mariadb-dev python3-dev libffi-dev openldap-dev cargo rust \
|
postgresql-dev mariadb-dev mariadb-connector-c python3-dev libffi-dev openldap-dev cargo rust \
|
||||||
&& apk add --no-cache --virtual .mailman-rundeps bash sassc pcre-dev \
|
&& apk add --no-cache --virtual .mailman-rundeps bash sassc pcre-dev \
|
||||||
python3 py3-pip postgresql-client mysql-client py3-mysqlclient \
|
python3 py3-pip postgresql-client mysql-client py3-mysqlclient \
|
||||||
curl mailcap xapian-core xapian-bindings-python3 libffi gettext py-cryptography \
|
curl mailcap xapian-core xapian-bindings-python3 libffi gettext py-cryptography \
|
||||||
|
|||||||
@@ -16,23 +16,14 @@ function wait_for_postgres () {
|
|||||||
|
|
||||||
function wait_for_mysql () {
|
function wait_for_mysql () {
|
||||||
# Check if MySQL is up and accepting connections.
|
# Check if MySQL is up and accepting connections.
|
||||||
HOSTNAME=$(python3 <<EOF
|
readarray -d' ' -t ENDPOINT <<< $(python3 -c "from urllib.parse import urlparse; o = urlparse('$DATABASE_URL'); print('%s %s' % (o.hostname, o.port if o.port else '3306'));")
|
||||||
try:
|
until mysqladmin ping --host ${ENDPOINT[0]} --port ${ENDPOINT[1]} --silent; do
|
||||||
from urllib.parse import urlparse
|
|
||||||
except ImportError:
|
|
||||||
from urlparse import urlparse
|
|
||||||
o = urlparse('$DATABASE_URL')
|
|
||||||
print(o.hostname)
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
until mysqladmin ping --host "$HOSTNAME" --silent; do
|
|
||||||
>&2 echo "MySQL is unavailable - sleeping"
|
>&2 echo "MySQL is unavailable - sleeping"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
>&2 echo "MySQL is up - continuing"
|
>&2 echo "MySQL is up - continuing"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function check_or_create () {
|
function check_or_create () {
|
||||||
# Check if the path exists, if not, create the directory.
|
# Check if the path exists, if not, create the directory.
|
||||||
if [[ ! -e dir ]]; then
|
if [[ ! -e dir ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user