diff --git a/Dockerfile b/Dockerfile index 694f376..ab6d9b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.6 +FROM xataz/nginx ENV UID=991 GID=991 diff --git a/rootfs/nginx/sites-enabled/diaspora.conf b/rootfs/nginx/sites-enabled/diaspora.conf new file mode 100644 index 0000000..7e50b76 --- /dev/null +++ b/rootfs/nginx/sites-enabled/diaspora.conf @@ -0,0 +1,38 @@ +http { + gzip_static on; + server { + listen 8080; + root /diaspora/public; + + # Configure maximum picture size + # Note that Diaspora has a client side check set at 4M + client_max_body_size 10M; + client_body_buffer_size 256K; + + # Proxy if requested file not found + try_files $uri @diaspora; + + location /assets/ { + expires max; + add_header Cache-Control public; + } + + location @diaspora { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Host $http_host; + proxy_redirect off; + + proxy_pass http://diaspora_server; + } + } + + # Proxy destination + # Add as many server directives as you want + # Also takes a socket, like unix:/path/to/some/socket.sock + upstream diaspora_server { + server unix:/run/diaspora/diaspora.sock; + + } +} diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup index 48a04b0..124b821 100644 --- a/rootfs/usr/local/bin/startup +++ b/rootfs/usr/local/bin/startup @@ -4,18 +4,18 @@ addgroup -g ${GID} diaspora && adduser -H -s /bin/sh -D -G diaspora -u ${UID} di if [ ! -f /config/database.yml ]; then cp /diaspora/config/database.yml.example /config/database.yml - echo "/config/database.yml not found please configure it and restart your container" - sleep + ln -s /config/database.yml /diaspora/config/database.yml + read -p "/config/database.yml not found please configure it and restart your container" fi if [ ! -f /config/diaspora.yml ]; then cp /diaspora/config/diaspora.yml.example /config/diaspora.yml - echo "/config/diaspora.yml not found please configure it and restart your container" - sleep + ln -s /config/diaspora.yml /diaspora/config/diaspora.yml + read -p "/config/diaspora.yml not found please configure it and restart your container" fi -ln -s /config/database.yml /diaspora/config/database.yml -ln -s /config/diaspora.yml /diaspora/config/diaspora.yml + + chown -R diaspora:diaspora /diaspora cd /diaspora exec su-exec diaspora:diaspora script/configure_bundler