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
This commit is contained in:
Andrew Dolgov 2020-01-19 12:54:24 +03:00
parent 05d341df89
commit 9b0a93677d
4 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,6 @@
# Copy this file to .env before building the container.
# Put any local modifications here.
POSTGRES_USER=postgres POSTGRES_USER=postgres
POSTGRES_PASSWORD=password POSTGRES_PASSWORD=password

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

View File

@ -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 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 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. 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 #### Build and start the container
``docker-compose up`` ``docker-compose up``

View File

@ -48,9 +48,9 @@ elif ! $PSQL -c 'select * from ttrss_version'; then
$PSQL < /var/www/html/tt-rss/schema/ttrss_schema_pgsql.sql $PSQL < /var/www/html/tt-rss/schema/ttrss_schema_pgsql.sql
fi 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 \ sed \
-e "s/define('DB_HOST'.*/define('DB_HOST', '$DB_HOST');/" \ -e "s/define('DB_HOST'.*/define('DB_HOST', '$DB_HOST');/" \
-e "s/define('DB_USER'.*/define('DB_USER', '$DB_USER');/" \ -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 cat >> $DST_DIR/config.php << EOF
define('NGINX_XACCEL_PREFIX', '/tt-rss'); define('NGINX_XACCEL_PREFIX', '/tt-rss');
EOF EOF
else
sed \
-e "s/define('SELF_URL_PATH'.*/define('SELF_URL_PATH','$SELF_URL_PATH');/" \
-i.bak $DST_DIR/config.php
fi fi
crond & crond &