Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
dbacf11bd3 | |||
fb956cb777 | |||
bee6bd3200 |
@ -2,18 +2,15 @@ pipeline:
|
|||||||
nginx-conf:
|
nginx-conf:
|
||||||
image: nginx:mainline
|
image: nginx:mainline
|
||||||
commands:
|
commands:
|
||||||
- cp nginx.conf /etc/nginx/
|
- cp -r nginx /etc/nginx
|
||||||
- nginx -t
|
- nginx -t
|
||||||
docker:
|
docker:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
repo: repo.shimun.net/shimun/seafile
|
repo: repo.shimun.net/shimun/seafile
|
||||||
tag: alpine-sq
|
|
||||||
registry: repo.shimun.net
|
registry: repo.shimun.net
|
||||||
storage_path: /drone/.docker
|
storage_path: /drone/.docker
|
||||||
secrets: ["docker_username", "docker_password"]
|
secrets: ["docker_username", "docker_password"]
|
||||||
storage_path: /drone/.docker
|
storage_path: /drone/.docker
|
||||||
cache_from: ["repo.shimun.net/shimun/seafile", "repo.shimun.net/shimun/seafile:nginx-deb", "repo.shimun.net/shimun/seafile:alpine"]
|
cache_from: ["repo.shimun.net/shimun/seafile", "repo.shimun.net/shimun/seafile:nginx-deb", "repo.shimun.net/shimun/seafile:alpine"]
|
||||||
use_cache: true
|
use_cache: true
|
||||||
experimental: true
|
|
||||||
squash: true
|
|
||||||
pull_image: false
|
pull_image: false
|
||||||
|
27
Dockerfile
27
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM frolvlad/alpine-glibc
|
FROM nginx:mainline
|
||||||
|
|
||||||
VOLUME /opt/seafile
|
VOLUME /opt/seafile
|
||||||
|
|
||||||
@ -6,37 +6,24 @@ EXPOSE 80 10001 12001 8000 8080 8082
|
|||||||
|
|
||||||
ENV SEAF=/opt/seafile
|
ENV SEAF=/opt/seafile
|
||||||
|
|
||||||
ENV INSTALLPATH=$SEAF/seafile-server-latest
|
|
||||||
|
|
||||||
ENV CCNET_CONF_DIR=$SEAF/ccnet
|
|
||||||
|
|
||||||
ENV SEAFILE_CONF_DIR=$SEAF/seafile-data
|
|
||||||
|
|
||||||
ENV SEAFILE_CENTRAL_CONF_DIR=$SEAF/conf
|
|
||||||
|
|
||||||
ENV PYTHONPATH=/usr/lib/python2.7/site-packages
|
|
||||||
|
|
||||||
COPY requirements.txt /tmp/requirements.txt
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
|
|
||||||
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
|
RUN apt update && apt install locales -y && apt install -y --no-install-recommends procps openssl python2.7 sqlite3 python-mysqldb python-pil curl libjansson4 libfuse2 python-pip python-pip-whl python-setuptools \
|
||||||
&& apk --no-cache add py-pip sqlite-dev py-mysqldb py-imaging py-pillow py-setuptools sqlite zlib curl bash openssl-dev libevent libselinux nginx \
|
&& pip install -r /tmp/requirements.txt && apt remove -y python-pip \
|
||||||
&& pip install -r /tmp/requirements.txt && apk --no-cache del py-pip \
|
&& rm -rf /var/lib/apt/lists/* /tmp/requirements.txt
|
||||||
&& rm -f /tmp/requirements.txt \
|
|
||||||
&& mkdir -p /run/nginx
|
|
||||||
|
|
||||||
COPY conf /opt/seafile/conf
|
COPY conf /opt/seafile/conf
|
||||||
COPY conf /etc/seafile
|
COPY conf /etc/seafile
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx /etc/nginx
|
||||||
COPY scripts/upgrade.py /usr/local/sbin/upgrade
|
COPY scripts/upgrade.py /usr/local/sbin/upgrade
|
||||||
|
COPY scripts/start-nginx.sh /usr/bin/start-nginx
|
||||||
COPY scripts/seafile-server.sh /sbin/seafile-server
|
COPY scripts/seafile-server.sh /sbin/seafile-server
|
||||||
|
|
||||||
RUN ulimit -n 30000 && mkdir -p $SEAF/pids && \
|
RUN ulimit -n 30000 && mkdir -p $SEAF/pids && \
|
||||||
chmod +x /usr/local/sbin/upgrade /sbin/seafile-server
|
chmod +x /usr/local/sbin/upgrade /sbin/seafile-server /usr/bin/start-nginx
|
||||||
|
|
||||||
ENV SEAF_UPGRADE_INTERVAL=3
|
ENV SEAF_UPGRADE_INTERVAL=3
|
||||||
|
|
||||||
WORKDIR $SEAF
|
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/seafile-server"]
|
ENTRYPOINT ["/sbin/seafile-server"]
|
||||||
#Defaults to run-upgrade options include: run, run-upgrade, upgrade, stop, stop-upgrade
|
#Defaults to run-upgrade options include: run, run-upgrade, upgrade, stop, stop-upgrade
|
||||||
CMD ["run-upgrade"]
|
CMD ["run-upgrade"]
|
||||||
|
83
nginx.conf
83
nginx.conf
@ -1,83 +0,0 @@
|
|||||||
events {
|
|
||||||
worker_connections 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
http{
|
|
||||||
|
|
||||||
upstream hub {
|
|
||||||
server 127.0.0.1:8000;
|
|
||||||
keepalive 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream files {
|
|
||||||
server 127.0.0.1:8082;
|
|
||||||
keepalive 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream webdav {
|
|
||||||
server 127.0.0.1:8080;
|
|
||||||
keepalive 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
disable_symlinks off;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
|
|
||||||
error_log /dev/stderr;
|
|
||||||
access_log syslog:server=unix:/dev/log;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://hub;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
|
||||||
proxy_read_timeout 1200s;
|
|
||||||
|
|
||||||
# used for view/edit office file via Office Online Server
|
|
||||||
client_max_body_size 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
location /seafhttp {
|
|
||||||
rewrite ^/seafhttp(.*)$ $1 break;
|
|
||||||
proxy_pass http://files;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
client_max_body_size 0;
|
|
||||||
proxy_connect_timeout 3s;
|
|
||||||
proxy_read_timeout 3600s;
|
|
||||||
proxy_send_timeout 3600s;
|
|
||||||
send_timeout 3600s;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /seafdav {
|
|
||||||
fastcgi_pass webdav;
|
|
||||||
fastcgi_keep_conn on;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_script_name;
|
|
||||||
|
|
||||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
|
||||||
fastcgi_param QUERY_STRING $query_string;
|
|
||||||
fastcgi_param REQUEST_METHOD $request_method;
|
|
||||||
fastcgi_param CONTENT_TYPE $content_type;
|
|
||||||
fastcgi_param CONTENT_LENGTH $content_length;
|
|
||||||
fastcgi_param SERVER_ADDR $server_addr;
|
|
||||||
fastcgi_param SERVER_PORT $server_port;
|
|
||||||
fastcgi_param SERVER_NAME $server_name;
|
|
||||||
|
|
||||||
client_max_body_size 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
location /media {
|
|
||||||
root /opt/seafile/seafile-server-latest/seahub;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
14
nginx/backends.conf
Normal file
14
nginx/backends.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
upstream hub {
|
||||||
|
server 127.0.0.1:8000;
|
||||||
|
keepalive 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream files {
|
||||||
|
server 127.0.0.1:8082;
|
||||||
|
keepalive 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream webdav {
|
||||||
|
server 127.0.0.1:8080;
|
||||||
|
keepalive 2;
|
||||||
|
}
|
0
nginx/extra.conf
Normal file
0
nginx/extra.conf
Normal file
24
nginx/nginx.conf
Normal file
24
nginx/nginx.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
include backends.conf;
|
||||||
|
|
||||||
|
disable_symlinks off;
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
error_log /dev/stderr;
|
||||||
|
|
||||||
|
include seafile/*.conf;
|
||||||
|
|
||||||
|
include realip.conf;
|
||||||
|
|
||||||
|
include extra.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
2
nginx/realip.conf
Normal file
2
nginx/realip.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
real_ip_header X-Forwarded-For;
|
||||||
|
set_real_ip_from 127.0.0.1;
|
3
nginx/seafile/media.conf
Normal file
3
nginx/seafile/media.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
location /media {
|
||||||
|
root /opt/seafile/seafile-server-latest/seahub;
|
||||||
|
}
|
18
nginx/seafile/seafdav.conf
Normal file
18
nginx/seafile/seafdav.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
location /seafdav {
|
||||||
|
fastcgi_pass webdav;
|
||||||
|
fastcgi_keep_conn on;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_script_name;
|
||||||
|
|
||||||
|
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||||
|
fastcgi_param QUERY_STRING $query_string;
|
||||||
|
fastcgi_param REQUEST_METHOD $request_method;
|
||||||
|
fastcgi_param CONTENT_TYPE $content_type;
|
||||||
|
fastcgi_param CONTENT_LENGTH $content_length;
|
||||||
|
fastcgi_param SERVER_ADDR $server_addr;
|
||||||
|
fastcgi_param SERVER_PORT $server_port;
|
||||||
|
fastcgi_param SERVER_NAME $server_name;
|
||||||
|
|
||||||
|
client_max_body_size 0;
|
||||||
|
|
||||||
|
}
|
10
nginx/seafile/seafhttp.conf
Normal file
10
nginx/seafile/seafhttp.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
location /seafhttp {
|
||||||
|
rewrite ^/seafhttp(.*)$ $1 break;
|
||||||
|
proxy_pass http://files;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
client_max_body_size 0;
|
||||||
|
proxy_connect_timeout 3s;
|
||||||
|
proxy_read_timeout 3600s;
|
||||||
|
proxy_send_timeout 3600s;
|
||||||
|
send_timeout 3600s;
|
||||||
|
}
|
14
nginx/seafile/seahub.conf
Normal file
14
nginx/seafile/seahub.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
location / {
|
||||||
|
proxy_pass http://hub;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
proxy_read_timeout 1200s;
|
||||||
|
|
||||||
|
# used for view/edit office file via Office Online Server
|
||||||
|
client_max_body_size 0;
|
||||||
|
|
||||||
|
access_log /dev/stdout;
|
||||||
|
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
LATEST=$SEAF/seafile-server-latest
|
LATEST=$SEAF/seafile-server-latest
|
||||||
PIDS=$SEAF/pids
|
PIDS=$SEAF/pids
|
||||||
PIDFILES=("$PIDS" "$LATEST/runtime" "/var/run/nginx")
|
PIDFILES=("$PIDS" "$LATEST/runtime" "/var/run/nginx")
|
||||||
COMMANDS=("seaf-server $LATEST/seafile.sh start" "seahub $LATEST/seahub.sh ${SEAF_HUB_MODE:-start} 8000" "nginx /usr/sbin/nginx")
|
COMMANDS=("seaf-server $LATEST/seafile.sh start" "seahub $LATEST/seahub.sh ${SEAF_HUB_MODE:-start} 8000" "nginx /usr/bin/start-nginx")
|
||||||
|
|
||||||
function stop {
|
function stop {
|
||||||
#Kill when hitting CTRL+C repeatedly
|
#Kill when hitting CTRL+C repeatedly
|
||||||
|
7
scripts/start-ngix.sh
Normal file
7
scripts/start-ngix.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "$SEAF_FRONTEND" | IFS=';' while read IP; do
|
||||||
|
echo "set_real_ip_from $IP;" >> /etc/nginx/realip.conf
|
||||||
|
done
|
||||||
|
#This script is only supposed to run once
|
||||||
|
rm -f $0 && ln -s /usr/sbin/nginx $0 && /usr/sbin/nginx
|
Reference in New Issue
Block a user