Skip to content

Commit

Permalink
Merge pull request clue#2 from jpiron/root_path
Browse files Browse the repository at this point in the history
Add support for a root path
  • Loading branch information
fischerman authored Feb 8, 2017
2 parents 0edfae2 + c2f8078 commit cbc91e6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ ENV AUTH_METHOD internal
# always re-configure database with current ENV when RUNning container, then monitor all services
ADD configure-db.php /configure-db.php
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD php /configure-db.php && supervisord -c /etc/supervisor/conf.d/supervisord.conf
ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
19 changes: 19 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e

# remove trailing / if any.
SELF_URL_PATH=${SELF_URL_PATH/%\//}

# extract the root path from SELF_URL_PATH (i.e http://domain.tld/<root_path>).
ROOT_PATH=${SELF_URL_PATH/#http*\:\/\/*\//}
if [ "${ROOT_PATH}" == "${SELF_URL_PATH}" ]; then
# no root path in SELF_URL_PATH.
mkdir -p /var/tmp
ln -sf "/var/www" "/var/tmp/www"
else
mkdir -p /var/tmp/www
ln -sf "/var/www" "/var/tmp/www/${ROOT_PATH}"
fi

php /configure-db.php
exec supervisord -c /etc/supervisor/conf.d/supervisord.conf
3 changes: 1 addition & 2 deletions ttrss.nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
root /var/www;
root /var/tmp/www;

index index.php index.html;

Expand All @@ -15,4 +15,3 @@ server {
include fastcgi_params;
}
}

0 comments on commit cbc91e6

Please sign in to comment.