mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2025-09-01 02:09:12 +00:00
Merge branch 'clusterV2'
This commit is contained in:
commit
e9e9fc8291
9 changed files with 191 additions and 29 deletions
|
@ -3,11 +3,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
http:// https:// {
|
http:// https:// {
|
||||||
reverse_proxy seafile:8000
|
reverse_proxy seahub:8000
|
||||||
handle_path /seafhttp* {
|
handle_path /seafhttp* {
|
||||||
uri strip_prefix 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
|
reverse_proxy /media/* seahub-media:80
|
||||||
}
|
}
|
|
@ -1,21 +1,33 @@
|
||||||
version: '3.8'
|
version: '3.8'
|
||||||
services:
|
services:
|
||||||
seafile:
|
seafile-server:
|
||||||
image: ggogel/seafile:8.0.2
|
image: ggogel/seafile-server:8.0.2
|
||||||
volumes:
|
volumes:
|
||||||
- seafile-data:/shared
|
- seafile-data:/shared
|
||||||
- seafile-avatars:/seafile/seahub-data/avatars
|
|
||||||
- seafile-custom:/seafile/seahub-data/custom
|
|
||||||
environment:
|
environment:
|
||||||
- DB_HOST=db
|
- DB_HOST=db
|
||||||
- DB_ROOT_PASSWD=db_dev
|
- DB_ROOT_PASSWD=db_dev
|
||||||
- TIME_ZONE=Europe/Berlin
|
- TIME_ZONE=Europe/Berlin
|
||||||
- SEAFILE_ADMIN_EMAIL=me@example.com
|
- SEAFILE_ADMIN_EMAIL=me@example.com
|
||||||
- SEAFILE_ADMIN_PASSWORD=asecret
|
- 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!
|
- SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- memcached
|
- 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:
|
networks:
|
||||||
- seafile-net
|
- seafile-net
|
||||||
|
|
||||||
|
@ -24,11 +36,16 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- seafile-avatars:/usr/share/caddy/media/avatars
|
- seafile-avatars:/usr/share/caddy/media/avatars
|
||||||
- seafile-custom:/usr/share/caddy/media/custom
|
- seafile-custom:/usr/share/caddy/media/custom
|
||||||
|
depends_on:
|
||||||
|
- seafile-server
|
||||||
|
- db
|
||||||
|
- memcached
|
||||||
|
- seafile-caddy
|
||||||
networks:
|
networks:
|
||||||
- seafile-net
|
- seafile-net
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mariadb:latest
|
image: mariadb:10.5.8
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=db_dev
|
- MYSQL_ROOT_PASSWORD=db_dev
|
||||||
- MYSQL_LOG_CONSOLE=true
|
- MYSQL_LOG_CONSOLE=true
|
||||||
|
@ -38,13 +55,13 @@ services:
|
||||||
- seafile-net
|
- seafile-net
|
||||||
|
|
||||||
memcached:
|
memcached:
|
||||||
image: memcached:latest
|
image: memcached:1.6.9
|
||||||
entrypoint: memcached -m 1024
|
entrypoint: memcached -m 1024
|
||||||
networks:
|
networks:
|
||||||
- seafile-net
|
- seafile-net
|
||||||
|
|
||||||
caddy:
|
seafile-caddy:
|
||||||
image: ggogel/seafile-caddy
|
image: ggogel/seafile-caddy:0.1
|
||||||
ports:
|
ports:
|
||||||
- 80:80 # Point your reverse proxy to port 80 of this service
|
- 80:80 # Point your reverse proxy to port 80 of this service
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -5,13 +5,18 @@ ENV SEAFILE_SERVER=seafile-server SEAFILE_VERSION=8.0.2
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive
|
RUN export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Package installation
|
# 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 \
|
tzdata \
|
||||||
nginx \
|
nginx \
|
||||||
python3 python3-pip python3-setuptools \
|
python3 python3-pip python3-setuptools \
|
||||||
libmysqlclient-dev \
|
libmysqlclient-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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
|
# Python3
|
||||||
RUN python3.6 -m pip install --upgrade pip \
|
RUN python3.6 -m pip install --upgrade pip \
|
||||||
&& pip3 install --timeout=3600 click termcolor colorlog pymysql \
|
&& pip3 install --timeout=3600 click termcolor colorlog pymysql \
|
||||||
|
@ -23,24 +28,12 @@ future mysqlclient \
|
||||||
COPY scripts /scripts
|
COPY scripts /scripts
|
||||||
RUN chmod u+x /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
|
# Seafile
|
||||||
WORKDIR /opt/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.
|
# 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
|
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.sh"]
|
||||||
|
|
||||||
|
|
||||||
CMD ["/sbin/my_init", "--", "/scripts/start.py"]
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ generated_dir = '/bootstrap/generated'
|
||||||
|
|
||||||
|
|
||||||
def is_https():
|
def is_https():
|
||||||
return get_conf('SEAFILE_SERVER_LETSENCRYPT', 'false').lower() == 'true'
|
return get_conf('HTTPS', 'false').lower() == 'true'
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
|
|
|
@ -81,7 +81,7 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
call('{} start'.format(get_script('seafile.sh')))
|
call('{} start'.format(get_script('seafile.sh')))
|
||||||
call('{} start'.format(get_script('seahub.sh')))
|
#call('{} start'.format(get_script('seahub.sh')))
|
||||||
finally:
|
finally:
|
||||||
if exists(password_file):
|
if exists(password_file):
|
||||||
os.unlink(password_file)
|
os.unlink(password_file)
|
||||||
|
|
12
seafile/scripts/start.sh
Normal file
12
seafile/scripts/start.sh
Normal 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
84
seahub/Dockerfile
Normal 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"]
|
47
seahub/scripts/create_data_links.sh
Normal file
47
seahub/scripts/create_data_links.sh
Normal 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
9
seahub/scripts/start.sh
Normal 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue