Unverified Commit 2dab7f18 authored by Sheogorath's avatar Sheogorath Committed by David Mehren

Remove dockerize and entrypoint-script parsing

Currently the entrypoint script parses the database URL configuration
string in order to extract the remote location and waits for the
database to be available.

This patch removes this logic and also removes `dockerize`, which was
used to wait for the connection. However, this change should not be
merged without the changes introduced in a commit on the main
applicaiton, that implements an own connection retry mechanism.

Reference:
https://github.com/hedgedoc/hedgedoc/pull/1228Signed-off-by: 's avatarSheogorath <sheogorath@shivering-isles.com>
parent b181d5ca
...@@ -3,13 +3,6 @@ FROM node:16.9.0-alpine@sha256:697313d55634a94b36cc5cf75a687b210c7e4a8e433e64d80 ...@@ -3,13 +3,6 @@ FROM node:16.9.0-alpine@sha256:697313d55634a94b36cc5cf75a687b210c7e4a8e433e64d80
FROM base AS basebuilder FROM base AS basebuilder
RUN apk update RUN apk update
FROM basebuilder AS dockerize
# Download and extract dockerize, used in resources/docker-entrypoint.sh
ENV DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN tar -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
FROM basebuilder AS builder FROM basebuilder AS builder
# Build arguments to change source url, branch or tag # Build arguments to change source url, branch or tag
...@@ -40,7 +33,6 @@ FROM base ...@@ -40,7 +33,6 @@ FROM base
ARG UID=10000 ARG UID=10000
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=dockerize dockerize /usr/local/bin/
COPY --chown=$UID --from=builder /hedgedoc /hedgedoc COPY --chown=$UID --from=builder /hedgedoc /hedgedoc
# Add configuraton files # Add configuraton files
......
...@@ -3,14 +3,6 @@ FROM node:16.9.0-slim@sha256:fca208cb6a90179412cc78ac590a81c3b802b2d3a66b202e315 ...@@ -3,14 +3,6 @@ FROM node:16.9.0-slim@sha256:fca208cb6a90179412cc78ac590a81c3b802b2d3a66b202e315
FROM base AS basebuilder FROM base AS basebuilder
RUN apt-get update RUN apt-get update
FROM basebuilder AS dockerize
# Download and extract dockerize, used in resources/docker-entrypoint.sh
ENV DOCKERIZE_VERSION=v0.6.1
RUN apt-get install --no-install-recommends -y ca-certificates wget
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN tar -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
FROM basebuilder AS builder FROM basebuilder AS builder
# Build arguments to change source url, branch or tag # Build arguments to change source url, branch or tag
...@@ -46,7 +38,6 @@ RUN apt-get update && \ ...@@ -46,7 +38,6 @@ RUN apt-get update && \
apt-get install --no-install-recommends -y fonts-noto gosu && \ apt-get install --no-install-recommends -y fonts-noto gosu && \
rm -r /var/lib/apt/lists/* rm -r /var/lib/apt/lists/*
COPY --from=dockerize dockerize /usr/local/bin/
COPY --chown=$UID --from=builder /hedgedoc /hedgedoc COPY --chown=$UID --from=builder /hedgedoc /hedgedoc
# Add configuraton files # Add configuraton files
......
...@@ -4,32 +4,10 @@ ...@@ -4,32 +4,10 @@
UID="$(id -u)" UID="$(id -u)"
[ "$UID" -eq 0 ] && GOSU="gosu hedgedoc" || GOSU="" [ "$UID" -eq 0 ] && GOSU="gosu hedgedoc" || GOSU=""
if [ "$HMD_DB_URL" != "" ] && [ "$CMD_DB_URL" = "" ]; then
CMD_DB_URL="$HMD_DB_URL"
fi
if [ "$HMD_IMAGE_UPLOAD_TYPE" != "" ] && [ "$CMD_IMAGE_UPLOAD_TYPE" = "" ]; then if [ "$HMD_IMAGE_UPLOAD_TYPE" != "" ] && [ "$CMD_IMAGE_UPLOAD_TYPE" = "" ]; then
CMD_IMAGE_UPLOAD_TYPE="$HMD_IMAGE_UPLOAD_TYPE" CMD_IMAGE_UPLOAD_TYPE="$HMD_IMAGE_UPLOAD_TYPE"
fi fi
DOCKER_SECRET_DB_URL_FILE_PATH="/run/secrets/dbURL"
if [ -f "$DOCKER_SECRET_DB_URL_FILE_PATH" ]; then
CMD_DB_URL="$(cat $DOCKER_SECRET_DB_URL_FILE_PATH)"
fi
if [ "$CMD_DB_URL" = "" ]; then
CMD_DB_URL="postgres://hedgedoc:password@database:5432/hedgedoc"
fi
export CMD_DB_URL
DB_SOCKET=$(echo ${CMD_DB_URL} | sed -e 's/.*:\/\//\/\//' -e 's/.*\/\/[^@]*@//' -e 's/\/.*$//')
if [ "$DB_SOCKET" != "" ]; then
dockerize -wait "tcp://${DB_SOCKET}" -timeout 30s
fi
# Print warning if local data storage is used but no volume is mounted # Print warning if local data storage is used but no volume is mounted
[ "$CMD_IMAGE_UPLOAD_TYPE" = "filesystem" ] && { mountpoint -q ./public/uploads || { [ "$CMD_IMAGE_UPLOAD_TYPE" = "filesystem" ] && { mountpoint -q ./public/uploads || {
echo " echo "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment