mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 09:01:38 +00:00
change hostname environment variable names
This commit is contained in:
parent
03fd6e2980
commit
8ebb42472b
|
@ -3,27 +3,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
http:// https:// {
|
http:// https:// {
|
||||||
reverse_proxy {$SEAHUB_SERVER_HOST}:8000 {
|
reverse_proxy {$SEAHUB_HOSTNAME}:8000 {
|
||||||
lb_policy header X-Forwarded-For
|
lb_policy header X-Forwarded-For
|
||||||
trusted_proxies private_ranges
|
trusted_proxies private_ranges
|
||||||
}
|
}
|
||||||
reverse_proxy /seafdav* {$SEAFILE_SERVER_HOST}:8080 {
|
reverse_proxy /seafdav* {$SEAFILE_SERVER_HOSTNAME}:8080 {
|
||||||
header_up Destination https:// http://
|
header_up Destination https:// http://
|
||||||
trusted_proxies private_ranges
|
trusted_proxies private_ranges
|
||||||
}
|
}
|
||||||
handle_path /seafhttp* {
|
handle_path /seafhttp* {
|
||||||
uri strip_prefix seafhttp
|
uri strip_prefix seafhttp
|
||||||
reverse_proxy {$SEAFILE_SERVER_HOST}:8082 {
|
reverse_proxy {$SEAFILE_SERVER_HOSTNAME}:8082 {
|
||||||
trusted_proxies private_ranges
|
trusted_proxies private_ranges
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle_path /notification* {
|
handle_path /notification* {
|
||||||
uri strip_prefix notification
|
uri strip_prefix notification
|
||||||
reverse_proxy {$SEAFILE_SERVER_HOST}:8083 {
|
reverse_proxy {$SEAFILE_SERVER_HOSTNAME}:8083 {
|
||||||
trusted_proxies private_ranges
|
trusted_proxies private_ranges
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reverse_proxy /media/* {$SEAHUB_MEDIA_SERVER_HOST}:80 {
|
reverse_proxy /media/* {$SEAHUB_MEDIA_HOSTNAME}:80 {
|
||||||
lb_policy header X-Forwarded-For
|
lb_policy header X-Forwarded-For
|
||||||
trusted_proxies private_ranges
|
trusted_proxies private_ranges
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ COPY Caddyfile /etc/caddy/Caddyfile
|
||||||
COPY scripts /scripts
|
COPY scripts /scripts
|
||||||
RUN chmod u+x /scripts/*
|
RUN chmod u+x /scripts/*
|
||||||
|
|
||||||
ENV SEAFILE_SERVER_HOST=seafile-server
|
ENV SEAFILE_SERVER_HOSTNAME=seafile-server
|
||||||
ENV SEAHUB_SERVER_HOST=seahub
|
ENV SEAHUB_HOSTNAME=seahub
|
||||||
ENV SEAHUB_MEDIA_SERVER_HOST=seahub-media
|
ENV SEAHUB_MEDIA_HOSTNAME=seahub-media
|
||||||
|
|
||||||
CMD ["/scripts/start.sh"]
|
CMD ["/scripts/start.sh"]
|
||||||
|
|
|
@ -6,13 +6,13 @@ if [ "$SWARM_DNS" = true ]; then
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
SEAHUB_IPS=$(dig +short $SEAHUB_SERVER_HOST | sed -e 's/$/:8000/' | tr ' ' '\n' | sort | tr '\n' ' ')
|
SEAHUB_IPS=$(dig +short $SEAHUB_HOSTNAME | sed -e 's/$/:8000/' | tr ' ' '\n' | sort | tr '\n' ' ')
|
||||||
SEAHUB_MEDIA_IPS=$(dig +short $SEAHUB_MEDIA_SERVER_HOST | sed -e 's/$/:80/' | tr ' ' '\n' | sort | tr '\n' ' ')
|
SEAHUB_MEDIA_IPS=$(dig +short $SEAHUB_MEDIA_HOSTNAME | sed -e 's/$/:80/' | tr ' ' '\n' | sort | tr '\n' ' ')
|
||||||
|
|
||||||
cp /etc/caddy/Caddyfile.default /etc/caddy/Caddyfile.tmp
|
cp /etc/caddy/Caddyfile.default /etc/caddy/Caddyfile.tmp
|
||||||
|
|
||||||
sed -i "s/$SEAHUB_SERVER_HOST:8000/$(echo $SEAHUB_IPS)/g" /etc/caddy/Caddyfile.tmp
|
sed -i "s/$SEAHUB_HOSTNAME:8000/$(echo $SEAHUB_IPS)/g" /etc/caddy/Caddyfile.tmp
|
||||||
sed -i "s/$SEAHUB_MEDIA_SERVER_HOST:80/$(echo $SEAHUB_MEDIA_IPS)/g" /etc/caddy/Caddyfile.tmp
|
sed -i "s/$SEAHUB_MEDIA_HOSTNAME:80/$(echo $SEAHUB_MEDIA_IPS)/g" /etc/caddy/Caddyfile.tmp
|
||||||
|
|
||||||
if ! diff -q "/etc/caddy/Caddyfile" "/etc/caddy/Caddyfile.tmp"; then
|
if ! diff -q "/etc/caddy/Caddyfile" "/etc/caddy/Caddyfile.tmp"; then
|
||||||
rm -f /etc/caddy/Caddyfile
|
rm -f /etc/caddy/Caddyfile
|
||||||
|
|
|
@ -89,7 +89,7 @@ ENV INNER_FILE_SERVER_ROOT=http://seafile-server:8082
|
||||||
ENV SEAHUB_LOG_DIR=/opt/seafile/logs
|
ENV SEAHUB_LOG_DIR=/opt/seafile/logs
|
||||||
ENV SEAFILE_ADMIN_EMAIL=me@example.com
|
ENV SEAFILE_ADMIN_EMAIL=me@example.com
|
||||||
ENV SEAFILE_ADMIN_PASSWORD=asecret
|
ENV SEAFILE_ADMIN_PASSWORD=asecret
|
||||||
ENV SEAFILE_SERVER_HOST=seafile-server
|
ENV SEAFILE_SERVER_HOSTNAME=seafile-server
|
||||||
ENV PYTHON=python3
|
ENV PYTHON=python3
|
||||||
ENV SEAHUB_DIR=/opt/seafile/seafile-server-latest/seahub
|
ENV SEAHUB_DIR=/opt/seafile/seafile-server-latest/seahub
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,20 @@ function start_seahub {
|
||||||
function start_socat {
|
function start_socat {
|
||||||
mkdir -p /opt/seafile/seafile-server-latest/runtime
|
mkdir -p /opt/seafile/seafile-server-latest/runtime
|
||||||
while true; do
|
while true; do
|
||||||
while ! nc -z ${SEAFILE_SERVER_HOST} 8001 2>/dev/null; do
|
while ! nc -z ${SEAFILE_SERVER_HOSTNAME} 8001 2>/dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo "Starting socat..."
|
echo "Starting socat..."
|
||||||
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork,unlink-early TCP:${SEAFILE_SERVER_HOST}:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2
|
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork,unlink-early TCP:${SEAFILE_SERVER_HOSTNAME}:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function watch_server {
|
function watch_server {
|
||||||
while true; do
|
while true; do
|
||||||
sleep 2
|
sleep 2
|
||||||
if ! nc -z ${SEAFILE_SERVER_HOST} 8082 2>/dev/null; then
|
if ! nc -z ${SEAFILE_SERVER_HOSTNAME} 8082 2>/dev/null; then
|
||||||
/opt/seafile/seafile-server-latest/seahub.sh stop
|
/opt/seafile/seafile-server-latest/seahub.sh stop
|
||||||
while ! nc -z ${SEAFILE_SERVER_HOST} 8082 2>/dev/null; do
|
while ! nc -z ${SEAFILE_SERVER_HOSTNAME} 8082 2>/dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
start_seahub &
|
start_seahub &
|
||||||
|
|
Loading…
Reference in a new issue