6 Commits

Author SHA1 Message Date
f993b3dc60 [WIP] 2018-11-10 17:19:30 +01:00
8167148f00 mkdir pkg 2018-11-10 17:06:19 +01:00
fe1b40da97 Merge branch 'master' into alpine 2018-11-10 16:44:46 +01:00
3eaae31aae keep installation package 2018-11-10 16:44:37 +01:00
5e5ee7f181 adapt to alpine 2018-11-10 16:28:01 +01:00
f0a43458e3 another attempt at alpine 2018-11-10 15:49:13 +01:00
13 changed files with 106 additions and 101 deletions

View File

@ -2,11 +2,12 @@ pipeline:
nginx-conf:
image: nginx:mainline
commands:
- cp -r nginx /etc/nginx
- cp nginx.conf /etc/nginx/
- nginx -t
docker:
image: plugins/docker
repo: repo.shimun.net/shimun/seafile
tag: alpine
registry: repo.shimun.net
storage_path: /drone/.docker
secrets: ["docker_username", "docker_password"]

View File

@ -1,4 +1,4 @@
FROM nginx:mainline
FROM frolvlad/alpine-glibc
VOLUME /opt/seafile
@ -6,24 +6,37 @@ EXPOSE 80 10001 12001 8000 8080 8082
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
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 \
&& pip install -r /tmp/requirements.txt && apt remove -y python-pip \
&& rm -rf /var/lib/apt/lists/* /tmp/requirements.txt
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& 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 && apk --no-cache del py-pip \
&& rm -f /tmp/requirements.txt \
&& mkdir -p /run/nginx
COPY conf /opt/seafile/conf
COPY conf /etc/seafile
COPY nginx /etc/nginx
COPY nginx.conf /etc/nginx/nginx.conf
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
RUN ulimit -n 30000 && mkdir -p $SEAF/pids && \
chmod +x /usr/local/sbin/upgrade /sbin/seafile-server /usr/bin/start-nginx
chmod +x /usr/local/sbin/upgrade /sbin/seafile-server
ENV SEAF_UPGRADE_INTERVAL=3
WORKDIR $SEAF
ENTRYPOINT ["/sbin/seafile-server"]
#Defaults to run-upgrade options include: run, run-upgrade, upgrade, stop, stop-upgrade
CMD ["run-upgrade"]

83
nginx.conf Normal file
View File

@ -0,0 +1,83 @@
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;
}
}
}

View File

@ -1,14 +0,0 @@
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;
}

View File

View File

@ -1,24 +0,0 @@
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;
}
}

View File

@ -1,2 +0,0 @@
real_ip_header X-Forwarded-For;
set_real_ip_from 127.0.0.1;

View File

@ -1,3 +0,0 @@
location /media {
root /opt/seafile/seafile-server-latest/seahub;
}

View File

@ -1,18 +0,0 @@
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;
}

View File

@ -1,10 +0,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;
}

View File

@ -1,14 +0,0 @@
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;
}

View File

@ -3,7 +3,7 @@
LATEST=$SEAF/seafile-server-latest
PIDS=$SEAF/pids
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/bin/start-nginx")
COMMANDS=("seaf-server $LATEST/seafile.sh start" "seahub $LATEST/seahub.sh ${SEAF_HUB_MODE:-start} 8000" "nginx /usr/sbin/nginx")
function stop {
#Kill when hitting CTRL+C repeatedly

View File

@ -1,7 +0,0 @@
#!/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