diff --git a/CloudronManifest.json b/CloudronManifest.json
index 63ff035..9f7b95e 100644
--- a/CloudronManifest.json
+++ b/CloudronManifest.json
@@ -6,8 +6,8 @@
"changelog": "file://CHANGELOG",
"tagline": "Decentralized file synchronization",
"version": "0.5.0",
- "healthCheckPath": "/check",
- "httpPort": 3000,
+ "healthCheckPath": "/healthcheck",
+ "httpPort": 8000,
"addons": {
"localstorage": {}
},
diff --git a/Dockerfile b/Dockerfile
index ec350bb..182b99a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,6 +9,11 @@ RUN mkdir -p /app/code \
WORKDIR /app/code
+# add supervisor configs
+ADD supervisor/* /etc/supervisor/conf.d/
+RUN ln -sf /run/syncthing/supervisord.log /var/log/supervisor/supervisord.log
+
+ADD nginx.conf /app/code/nginx.conf
ADD start.sh /app/code/start.sh
CMD [ "/app/code/start.sh" ]
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..7292982
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,41 @@
+user cloudron;
+
+worker_processes 1;
+pid /run/nginx.pid;
+daemon off;
+
+# Send logs to stderr
+error_log /dev/stderr warn;
+
+events {
+ worker_connections 768;
+}
+
+http {
+ error_log /dev/stderr warn;
+ log_format simple '$remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer"';
+ access_log /dev/stdout simple;
+ include /etc/nginx/mime.types;
+ client_body_temp_path /tmp/client_body 1 2;
+ proxy_temp_path /tmp/proxy_temp 1 2;
+ fastcgi_temp_path /tmp/fastcgi_temp 1 2;
+ uwsgi_temp_path /tmp/uwsgi_temp 1 2;
+ scgi_temp_path /tmp/scgi_temp 1 2;
+ proxy_buffering off;
+ proxy_cache_path /tmp/proxy_cache levels=1:2 keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off;
+ proxy_cache my_cache;
+
+ server {
+ error_log /dev/stderr warn;
+ listen 8000 default_server;
+ server_name _;
+ proxy_read_timeout 120s;
+ location /healthcheck {
+ return 200;
+ }
+ location / {
+ proxy_pass http://localhost:3000;
+ }
+ }
+}
+
diff --git a/start.sh b/start.sh
index 3d57266..7af5356 100755
--- a/start.sh
+++ b/start.sh
@@ -2,7 +2,7 @@
set -eu
-mkdir -p /app/data/config /app/data/folders
+mkdir -p /app/data/config /app/data/folders /run/syncthing
# if this if the first run, generate a useful config
if [ ! -f /app/data/config/config.xml ]; then
@@ -21,10 +21,7 @@ fi
sed -e "s,.*,tcp://:${SYNC_PORT}," -i /app/data/config/config.xml
sed -e 's,,,' -i /app/data/config/config.xml
-chown -R cloudron:cloudron /app/data/config /app/data
-
-# -no-browser opens up the browser (for desktop app preumably)
-# auditfile "-" means log to stdout
-echo "=> Starting syncthing"
-STNOUPGRADE=1 exec /usr/local/bin/gosu cloudron:cloudron /app/code/syncthing -gui-address=0.0.0.0:3000 -home=/app/data/config -no-browser -auditfile=-
+chown -R cloudron:cloudron /app/data /run/syncthing
+echo "Starting supervisor"
+exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i GitLab
diff --git a/supervisor/nginx.conf b/supervisor/nginx.conf
new file mode 100644
index 0000000..4781db3
--- /dev/null
+++ b/supervisor/nginx.conf
@@ -0,0 +1,12 @@
+[program:nginx]
+priority=100
+directory=/tmp
+command=/usr/sbin/nginx -c /app/code/nginx.conf
+user=root
+autostart=true
+autorestart=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+stderr_logfile=/dev/stderr
+stderr_logfile_maxbytes=0
+
diff --git a/supervisor/syncthing.conf b/supervisor/syncthing.conf
new file mode 100644
index 0000000..64237ee
--- /dev/null
+++ b/supervisor/syncthing.conf
@@ -0,0 +1,14 @@
+[program:syncthing]
+priority=20
+environment=HOME=/app/data/folders,STNOUPGRADE=1
+; -no-browser opens up the browser (for desktop app preumably)
+; auditfile "-" means log to stdout
+command=/app/code/syncthing -gui-address=127.0.0.1:3000 -home=/app/data/config -no-browser -auditfile=-
+user=cloudron
+autostart=true
+autorestart=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+stderr_logfile=/dev/stderr
+stderr_logfile_maxbytes=0
+