mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
Merge branch 'watch-server'
This commit is contained in:
commit
65ea903cd3
|
@ -66,7 +66,8 @@ openjpeg \
|
||||||
tiff \
|
tiff \
|
||||||
tk \
|
tk \
|
||||||
mariadb-dev \
|
mariadb-dev \
|
||||||
libmemcached
|
libmemcached \
|
||||||
|
netcat-openbsd
|
||||||
|
|
||||||
COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub
|
COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub
|
||||||
COPY --from=get /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime
|
COPY --from=get /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime
|
||||||
|
|
|
@ -1,16 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function start_seahub {
|
function init_seahub {
|
||||||
/scripts/create_data_links.sh
|
/scripts/create_data_links.sh
|
||||||
echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" | tee /opt/seafile/conf/admin.txt
|
echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" >/opt/seafile/conf/admin.txt
|
||||||
#/opt/seafile/seafile-server-latest/seahub.sh start
|
|
||||||
python3 /opt/seafile/seafile-server-latest/check_init_admin.py
|
python3 /opt/seafile/seafile-server-latest/check_init_admin.py
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_seahub {
|
||||||
|
echo "Starting seahub..."
|
||||||
python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000
|
python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_socat {
|
function start_socat {
|
||||||
mkdir -p /opt/seafile/seafile-server-latest/runtime
|
mkdir -p /opt/seafile/seafile-server-latest/runtime
|
||||||
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2
|
while true; do
|
||||||
|
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function watch_server {
|
||||||
|
while true; do
|
||||||
|
if ! nc -z seafile-server 8001 2>/dev/null; then
|
||||||
|
echo "Seafile server is unreachable. Stopping seahub..."
|
||||||
|
pkill -f manage.py
|
||||||
|
while ! nc -z seafile-server 8001 2>/dev/null; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
start_seahub &
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function keep_running {
|
function keep_running {
|
||||||
|
@ -20,5 +39,7 @@ function keep_running {
|
||||||
}
|
}
|
||||||
|
|
||||||
start_socat &
|
start_socat &
|
||||||
|
init_seahub
|
||||||
start_seahub &
|
start_seahub &
|
||||||
|
watch_server &
|
||||||
keep_running
|
keep_running
|
Loading…
Reference in a new issue