mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
Added nginx for serving http.
This commit is contained in:
parent
c64dbb972d
commit
be3bb8d41e
|
@ -4,13 +4,18 @@ FROM phusion/baseimage:0.9.19
|
||||||
ENV UPDATED_AT 20161110
|
ENV UPDATED_AT 20161110
|
||||||
|
|
||||||
RUN apt-get update -qq && apt-get -qq -y install python2.7-dev memcached python-pip \
|
RUN apt-get update -qq && apt-get -qq -y install python2.7-dev memcached python-pip \
|
||||||
python-setuptools python-imaging python-mysqldb python-memcache python-ldap \
|
python-setuptools python-imaging python-mysqldb python-memcache python-ldap \
|
||||||
python-urllib3 sqlite3 nginx \
|
python-urllib3 sqlite3 nginx \
|
||||||
vim htop net-tools psmisc git wget curl
|
vim htop net-tools psmisc git wget curl && \
|
||||||
|
pip install -U wheel && pip install click termcolor prettytable colorlog
|
||||||
|
|
||||||
RUN pip install -U wheel && pip install click termcolor prettytable colorlog
|
COPY services /services
|
||||||
|
|
||||||
RUN mkdir /etc/service/memcached
|
RUN mkdir -p /etc/service/memcached && \
|
||||||
ADD memcached.sh /etc/service/memcached/run
|
mv /services/memcached.sh /etc/service/memcached/run && \
|
||||||
|
mkdir -p /etc/service/nginx && \
|
||||||
|
rm -f /etc/nginx/sites-enabled/* /etc/nginx/conf.d/* && \
|
||||||
|
mv /services/nginx.conf /etc/nginx/nginx.conf && \
|
||||||
|
mv /services/nginx.sh /etc/service/nginx/run
|
||||||
|
|
||||||
CMD ["/sbin/my_init", "--", "bash", "-l"]
|
CMD ["/sbin/my_init", "--", "bash", "-l"]
|
||||||
|
|
26
image/base/services/nginx.conf
Normal file
26
image/base/services/nginx.conf
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
daemon off;
|
||||||
|
user www-data;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 768;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
server_names_hash_bucket_size 256;
|
||||||
|
server_names_hash_max_size 1024;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log info;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/javascript application/json text/javascript;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-enabled/*;
|
||||||
|
}
|
3
image/base/services/nginx.sh
Executable file
3
image/base/services/nginx.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
exec 2>&1
|
||||||
|
exec /usr/sbin/nginx
|
|
@ -11,4 +11,6 @@ RUN mkdir -p /opt/seafile/ && \
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
ADD create_data_links.sh /etc/my_init.d/create_data_links.sh
|
ADD create_data_links.sh /etc/my_init.d/create_data_links.sh
|
||||||
|
|
||||||
|
ADD seafile.nginx.conf /etc/nginx/sites-enabled/seafile.nginx.conf
|
||||||
|
|
||||||
CMD ["/sbin/my_init", "--", "bash", "-l"]
|
CMD ["/sbin/my_init", "--", "bash", "-l"]
|
||||||
|
|
50
image/seafile/seafile.nginx.conf
Normal file
50
image/seafile/seafile.nginx.conf
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _ default_server;
|
||||||
|
|
||||||
|
client_max_body_size 10m;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:8000/;
|
||||||
|
proxy_read_timeout 310s;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /seafhttp {
|
||||||
|
rewrite ^/seafhttp(.*)$ $1 break;
|
||||||
|
proxy_pass http://127.0.0.1:8082;
|
||||||
|
client_max_body_size 0;
|
||||||
|
proxy_connect_timeout 36000s;
|
||||||
|
proxy_read_timeout 36000s;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /seafdav {
|
||||||
|
client_max_body_size 0;
|
||||||
|
fastcgi_pass 127.0.0.1:8080;
|
||||||
|
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;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/seafdav.access.log;
|
||||||
|
error_log /var/log/nginx/seafdav.error.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /media {
|
||||||
|
root /opt/seafile/seafile-server-latest/seahub;
|
||||||
|
autoindex off;
|
||||||
|
}
|
||||||
|
}
|
10
launcher
10
launcher
|
@ -5,7 +5,7 @@ set -o pipefail
|
||||||
|
|
||||||
version=6.0.5
|
version=6.0.5
|
||||||
image=seafileorg/server:$version
|
image=seafileorg/server:$version
|
||||||
dockerdir=$(cd $(dirname $0); pwd -P)
|
dockerdir=$(cd "$(dirname $0)"; pwd -P)
|
||||||
sharedir=$dockerdir/shared
|
sharedir=$dockerdir/shared
|
||||||
installdir=/opt/seafile/seafile-server-$version
|
installdir=/opt/seafile/seafile-server-$version
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ err_and_quit () {
|
||||||
init_shared() {
|
init_shared() {
|
||||||
mkdir -p $sharedir/seafile/
|
mkdir -p $sharedir/seafile/
|
||||||
mkdir -p $sharedir/logs/{seafile,var-log}
|
mkdir -p $sharedir/logs/{seafile,var-log}
|
||||||
|
|
||||||
|
mkdir -p $sharedir/logs/var-log/nginx
|
||||||
touch $sharedir/logs/var-log/syslog
|
touch $sharedir/logs/var-log/syslog
|
||||||
|
|
||||||
local bash_history=$sharedir/.bash_history
|
local bash_history=$sharedir/.bash_history
|
||||||
|
@ -53,13 +55,17 @@ set_volumes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap() {
|
bootstrap() {
|
||||||
|
local bootstrap_conf=$dockerdir/bootstrap/bootstrap.conf
|
||||||
|
if [[ ! -e $bootstrap_conf ]]; then
|
||||||
|
err_and_quit "The file $bootstrap_conf doesn't exist. Have you run seafile-server-setup?"
|
||||||
|
fi
|
||||||
set_volumes
|
set_volumes
|
||||||
docker run --rm -it -e SEAFILE_BOOTSRAP=1 $volumes $image /scripts/bootstrap.py
|
docker run --rm -it -e SEAFILE_BOOTSRAP=1 $volumes $image /scripts/bootstrap.py
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
set_volumes
|
set_volumes
|
||||||
docker run --rm -it $volumes $image /scripts/start.py
|
docker run --rm -it --name seafile $volumes $image # /scripts/start.py
|
||||||
}
|
}
|
||||||
|
|
||||||
enter() {
|
enter() {
|
||||||
|
|
Loading…
Reference in a new issue