Merge branch 'clusterV2'

This commit is contained in:
Gerrit Gogel 2021-01-22 23:55:45 +01:00
commit e9e9fc8291
9 changed files with 191 additions and 29 deletions

View file

@ -3,11 +3,11 @@
}
http:// https:// {
reverse_proxy seafile:8000
reverse_proxy seahub:8000
handle_path /seafhttp* {
uri strip_prefix seafhttp
reverse_proxy seafile:8082
reverse_proxy seafile-server:8082
}
reverse_proxy /seafdav/* seafile:8080
reverse_proxy /seafdav/* seafile-server:8080
reverse_proxy /media/* seahub-media:80
}

View file

@ -1,21 +1,33 @@
version: '3.8'
services:
seafile:
image: ggogel/seafile:8.0.2
services:
seafile-server:
image: ggogel/seafile-server:8.0.2
volumes:
- seafile-data:/shared
- seafile-avatars:/seafile/seahub-data/avatars
- seafile-custom:/seafile/seahub-data/custom
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=db_dev
- TIME_ZONE=Europe/Berlin
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
- HTTPS=false # Set this to true if you plan to use a reverse proxy with HTTPS. Can be changed later in the admin settings on the web-ui.
- SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
depends_on:
- db
- memcached
- seafile-caddy
networks:
- seafile-net
seahub:
image: ggogel/seahub:8.0.2
volumes:
- seafile-data:/shared
- seafile-avatars:/shared/seafile/seahub-data/avatars
- seafile-custom:/shared/seafile/seahub-data/custom
depends_on:
- seafile-server
- seafile-caddy
networks:
- seafile-net
@ -24,11 +36,16 @@ services:
volumes:
- seafile-avatars:/usr/share/caddy/media/avatars
- seafile-custom:/usr/share/caddy/media/custom
depends_on:
- seafile-server
- db
- memcached
- seafile-caddy
networks:
- seafile-net
db:
image: mariadb:latest
image: mariadb:10.5.8
environment:
- MYSQL_ROOT_PASSWORD=db_dev
- MYSQL_LOG_CONSOLE=true
@ -38,13 +55,13 @@ services:
- seafile-net
memcached:
image: memcached:latest
image: memcached:1.6.9
entrypoint: memcached -m 1024
networks:
- seafile-net
caddy:
image: ggogel/seafile-caddy
seafile-caddy:
image: ggogel/seafile-caddy:0.1
ports:
- 80:80 # Point your reverse proxy to port 80 of this service
networks:

View file

@ -5,13 +5,18 @@ ENV SEAFILE_SERVER=seafile-server SEAFILE_VERSION=8.0.2
RUN export DEBIAN_FRONTEND=noninteractive
# Package installation
RUN apt-get update --fix-missing && apt-get install -y vim htop net-tools psmisc wget curl git \
RUN apt-get update --fix-missing && apt-get install -y vim htop net-tools psmisc wget curl git socat \
tzdata \
nginx \
python3 python3-pip python3-setuptools \
libmysqlclient-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/seafile/ && cd /opt/seafile/ && \
wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
# Python3
RUN python3.6 -m pip install --upgrade pip \
&& pip3 install --timeout=3600 click termcolor colorlog pymysql \
@ -23,24 +28,12 @@ future mysqlclient \
COPY scripts /scripts
RUN chmod u+x /scripts/*
RUN mkdir -p /etc/my_init.d && \
rm -f /etc/my_init.d/* && \
cp /scripts/create_data_links.sh /etc/my_init.d/01_create_data_links.sh
# Seafile
WORKDIR /opt/seafile
RUN mkdir -p /opt/seafile/ && cd /opt/seafile/ && \
wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
# For using TLS connection to LDAP/AD server with docker-ce.
RUN find /opt/seafile/ \( -name "liblber-*" -o -name "libldap-*" -o -name "libldap_r*" -o -name "libsasl2.so*" \) -delete
EXPOSE 8080 8082 8001
EXPOSE 8000 8080 8082
CMD ["/sbin/my_init", "--", "/scripts/start.py"]
CMD ["/sbin/my_init", "--", "/scripts/start.sh"]

View file

@ -29,7 +29,7 @@ generated_dir = '/bootstrap/generated'
def is_https():
return get_conf('SEAFILE_SERVER_LETSENCRYPT', 'false').lower() == 'true'
return get_conf('HTTPS', 'false').lower() == 'true'
def parse_args():
ap = argparse.ArgumentParser()

View file

@ -81,7 +81,7 @@ def main():
try:
call('{} start'.format(get_script('seafile.sh')))
call('{} start'.format(get_script('seahub.sh')))
#call('{} start'.format(get_script('seahub.sh')))
finally:
if exists(password_file):
os.unlink(password_file)

12
seafile/scripts/start.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/bash
/scripts/create_data_links.sh
python3 /scripts/start.py &
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
echo "Waiting for SeaRPC socket..."
sleep 1
done
socat -v -d -d TCP-LISTEN:8001,fork UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever

84
seahub/Dockerfile Normal file
View file

@ -0,0 +1,84 @@
FROM alpine:3.13 AS get
ENV SEAFILE_SERVER=seafile-server SEAFILE_VERSION=8.0.2
RUN apk add --no-cache wget
RUN cd /tmp && \
wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \
rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
FROM alpine:3.9 AS pip
RUN apk add \
python3-dev \
py3-pip \
py3-setuptools \
mariadb-dev \
build-base \
jpeg-dev \
zlib-dev \
freetype-dev \
lcms2-dev \
openjpeg-dev \
tiff-dev \
tk-dev \
tcl-dev \
libmemcached-dev
RUN python3 -m pip install --upgrade pip &&\
pip3 install --timeout=3600 \
Django==2.2.14 \
future \
captcha \
django-statici18n \
django-post_office==3.3.0 \
django-webpack_loader \
gunicorn \
mysqlclient \
django-picklefield==2.1.1 \
openpyxl \
qrcode \
django-formtools \
django-simple-captcha \
djangorestframework==3.11.1 \
python-dateutil \
requests \
pillow \
pyjwt \
pycryptodome \
requests_oauthlib \
django-pylibmc \
&& rm -r /root/.cache/pip
FROM alpine:3.9
RUN apk add \
bash \
socat \
python3 \
jpeg \
zlib \
freetype \
lcms2 \
openjpeg \
tiff \
tk \
mariadb-dev \
libmemcached
COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub
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.6/site-packages /usr/lib/python3.6/site-packages
COPY scripts /scripts
RUN chmod u+x /scripts/*
ENV PYTHONPATH=/usr/lib/python3.6/site-packages:/opt/seafile/seafile-server-latest/seahub/thirdpart:/opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages
ENV CCNET_CONF_DIR=/opt/seafile/conf/ccnet
ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data
ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf
ENV SEAFILE_RPC_PIPE_PATH=/opt/seafile/seafile-server-latest/runtime
EXPOSE 8000
CMD ["/scripts/start.sh"]

View file

@ -0,0 +1,47 @@
#!/bin/bash
set -e
set -o pipefail
if [[ $SEAFILE_BOOTSRAP != "" ]]; then
exit 0
fi
if [[ $TIME_ZONE != "" ]]; then
time_zone=/usr/share/zoneinfo/$TIME_ZONE
if [[ ! -e $time_zone ]]; then
echo "invalid time zone"
exit 1
else
ln -snf $time_zone /etc/localtime
echo "$TIME_ZONE" > /etc/timezone
fi
fi
dirs=(
conf
ccnet
seafile-data
seahub-data
pro-data
seafile-license.txt
)
for d in ${dirs[*]}; do
src=/shared/seafile/$d
if [[ -e $src ]]; then
rm -rf /opt/seafile/$d && ln -sf $src /opt/seafile
fi
done
if [[ -e /shared/logs/seafile ]]; then
mv /shared/logs/seafile /shared/seafile/logs
rm -rf /opt/seafile/logs && ln -sf /shared/seafile/logs /opt/seafile/
else
mkdir -p /shared/seafile/logs && ln -sf /shared/seafile/logs /opt/seafile/
fi
if [[ ! -e /shared/logs/var-log ]]; then
mkdir -p /shared/logs/ && mv /var/log /shared/logs/var-log
fi
rm -rf /var/log && ln -sf /shared/logs/var-log /var/log

9
seahub/scripts/start.sh Normal file
View file

@ -0,0 +1,9 @@
#!/bin/bash
/scripts/create_data_links.sh
mkdir -p /opt/seafile/seafile-server-latest/runtime
socat -v -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever &
python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000