From 9b0a93677dd11ff5e9c17924afc12f90c88b63c9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 19 Jan 2020 12:54:24 +0300 Subject: [PATCH] 1. move .env to .env-dist so local customization is not clashing with the repo 2. rewrite SELF_URL_PATH based on configured value even if config.php exists 3. update README --- .env => .env-dist | 3 +++ .gitignore | 1 + README.md | 13 +++++++++++-- app/startup.sh | 9 ++++++--- 4 files changed, 21 insertions(+), 5 deletions(-) rename .env => .env-dist (79%) create mode 100644 .gitignore diff --git a/.env b/.env-dist similarity index 79% rename from .env rename to .env-dist index 3672da8..b56ad10 100644 --- a/.env +++ b/.env-dist @@ -1,3 +1,6 @@ +# Copy this file to .env before building the container. +# Put any local modifications here. + POSTGRES_USER=postgres POSTGRES_PASSWORD=password diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/README.md b/README.md index 91df6a5..870ee7c 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,21 @@ The general outline of the configuration is as follows: git clone https://git.tt-rss.org/fox/ttrss-docker-compose.git ttrss-docker && cd ttrss-docker ``` -#### Edit ``.env`` and/or ``docker-compose.yml`` if necessary +#### Edit configuration files: -You will probably have to edit ``SELF_URL_PATH`` which should equal fully qualified tt-rss +Copy ``.env-dist`` to ``.env`` and edit any relevant variables you need changed. + +* You will likely have to change ``SELF_URL_PATH`` which should equal fully qualified tt-rss URL as seen when opening it in your web browser. If this field is set incorrectly, you will likely see the correct value in the tt-rss fatal error message. +Note: ``SELF_URL_PATH`` is updated in generated tt-rss ``config.php`` automatically on container +restart. + +* By default, container binds to **localhost** port **8280**. If you want the container to be +accessible on the net, without using a reverse proxy sharing same host, you will need to +remove ``127.0.0.1:`` from ``HTTP_PORT`` variable in ``.env``. + #### Build and start the container ``docker-compose up`` diff --git a/app/startup.sh b/app/startup.sh index 85cd456..a56143e 100755 --- a/app/startup.sh +++ b/app/startup.sh @@ -48,9 +48,9 @@ elif ! $PSQL -c 'select * from ttrss_version'; then $PSQL < /var/www/html/tt-rss/schema/ttrss_schema_pgsql.sql fi -if [ ! -s $DST_DIR/config.php ]; then - SELF_URL_PATH=$(echo $SELF_URL_PATH | sed -e 's/[\/&]/\\&/g') +SELF_URL_PATH=$(echo $SELF_URL_PATH | sed -e 's/[\/&]/\\&/g') +if [ ! -s $DST_DIR/config.php ]; then sed \ -e "s/define('DB_HOST'.*/define('DB_HOST', '$DB_HOST');/" \ -e "s/define('DB_USER'.*/define('DB_USER', '$DB_USER');/" \ @@ -63,7 +63,10 @@ if [ ! -s $DST_DIR/config.php ]; then cat >> $DST_DIR/config.php << EOF define('NGINX_XACCEL_PREFIX', '/tt-rss'); EOF - +else + sed \ + -e "s/define('SELF_URL_PATH'.*/define('SELF_URL_PATH','$SELF_URL_PATH');/" \ + -i.bak $DST_DIR/config.php fi crond &