mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 09:01:38 +00:00
Merge branch 'gunicorn'
This commit is contained in:
commit
fbe5cde87f
|
@ -287,6 +287,12 @@ You can schedule a cron job for garbage collection, by adding the following envi
|
|||
```
|
||||
This would run the garbage collection every sunday at 6AM.
|
||||
|
||||
### Access Log
|
||||
In order to make the access log of *seahub* visible through `docker logs` add the following line to the `gunicorn.conf.py`:
|
||||
```
|
||||
accesslog = '/proc/1/fd/1'
|
||||
```
|
||||
|
||||
|
||||
### Docker Swarm
|
||||
|
||||
|
|
|
@ -40,22 +40,6 @@ def watch_controller():
|
|||
print('seafile controller exited unexpectedly.')
|
||||
sys.exit(1)
|
||||
|
||||
# Modifiy gunicorn.conf.py
|
||||
# Make gunicorn bind to "0.0.0.0:8000" instead of "127.0.0.1:8000".
|
||||
# Otherwise external connections will be refused.
|
||||
def fix_gunicorn_bind():
|
||||
if os.path.exists(join(shared_seafiledir, 'conf', 'gunicorn.conf.py')):
|
||||
with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'r') as fp:
|
||||
fp_lines = fp.readlines()
|
||||
if 'bind = "127.0.0.1:8000"\n' in fp_lines:
|
||||
replace_index = fp_lines.index('bind = "127.0.0.1:8000"\n')
|
||||
replace_line = 'bind = "0.0.0.0:8000"\n'
|
||||
fp_lines[replace_index] = replace_line
|
||||
|
||||
with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'w') as fp:
|
||||
fp.writelines(fp_lines)
|
||||
|
||||
|
||||
def main():
|
||||
if not exists(shared_seafiledir):
|
||||
os.mkdir(shared_seafiledir)
|
||||
|
|
|
@ -10,6 +10,8 @@ RUN cd /tmp && \
|
|||
|
||||
RUN sed -i "s@.*INNER_FILE_SERVER_ROOT.*@INNER_FILE_SERVER_ROOT = os.environ.get('INNER_FILE_SERVER_ROOT')@" /tmp/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py
|
||||
|
||||
RUN sed -i '/warning_if_seafile_not_running;/d' /tmp/seafile-server-${SEAFILE_VERSION}/seahub.sh
|
||||
|
||||
FROM alpine:3.13 AS pip
|
||||
|
||||
RUN apk add --no-cache \
|
||||
|
@ -64,9 +66,13 @@ COPY --from=get /tmp/seafile-server*/check_init_admin.py /opt/seafile/seafile-se
|
|||
COPY --from=get /tmp/seafile-server*/seafile/lib64/python3.6/site-packages /opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages
|
||||
COPY --from=pip /usr/lib/python3.8/site-packages /usr/lib/python3.8/site-packages
|
||||
COPY scripts /scripts
|
||||
RUN chmod u+x /scripts/*
|
||||
|
||||
ENV PYTHONPATH=/usr/lib/python3.8/site-packages:/opt/seafile/seafile-server-latest/seahub/thirdpart:/opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages
|
||||
RUN chmod u+x /scripts/*
|
||||
RUN mkdir -p /opt/seafile/logs &&\
|
||||
touch /opt/seafile/logs/seahub.log &&\
|
||||
mkdir -p /opt/seafile/pids
|
||||
|
||||
ENV PYTHONPATH=/usr/lib/python3.8/site-packages:/opt/seafile/seafile-server-latest/seahub/thirdpart:/opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages:/opt/seafile/seafile-server-latest/seahub
|
||||
ENV CCNET_CONF_DIR=/opt/seafile/conf/ccnet
|
||||
ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data
|
||||
ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf
|
||||
|
@ -75,9 +81,7 @@ ENV INNER_FILE_SERVER_ROOT=http://seafile-server:8082
|
|||
ENV SEAHUB_LOG_DIR=/opt/seafile/logs
|
||||
ENV SEAFILE_ADMIN_EMAIL=me@example.com
|
||||
ENV SEAFILE_ADMIN_PASSWORD=asecret
|
||||
|
||||
RUN mkdir -p /opt/seafile/logs &&\
|
||||
touch /opt/seafile/logs/seahub.log
|
||||
ENV PYTHON=python3
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
function init_seahub {
|
||||
/scripts/create_data_links.sh
|
||||
echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" >/opt/seafile/conf/admin.txt
|
||||
python3 /opt/seafile/seafile-server-latest/check_init_admin.py
|
||||
sed -i 's@bind =.*@bind = "0.0.0.0:8000"@' /opt/seafile/conf/gunicorn.conf.py
|
||||
}
|
||||
|
||||
function start_seahub {
|
||||
echo "Starting seahub..."
|
||||
python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000
|
||||
/opt/seafile/seafile-server-latest/seahub.sh start
|
||||
}
|
||||
|
||||
function start_socat {
|
||||
|
@ -26,8 +25,7 @@ function watch_server {
|
|||
while true; do
|
||||
sleep 2
|
||||
if ! nc -z seafile-server 8082 2>/dev/null; then
|
||||
echo "Seafile server is unreachable. Stopping seahub..."
|
||||
pkill -f manage.py
|
||||
/opt/seafile/seafile-server-latest/seahub.sh stop
|
||||
while ! nc -z seafile-server 8082 2>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue