Browse Source

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

Andrew Dolgov 6 months ago
parent
commit
9b0a93677d
4 changed files with 21 additions and 5 deletions
  1. 3 0
      .env-dist
  2. 1 0
      .gitignore
  3. 11 2
      README.md
  4. 6 3
      app/startup.sh

+ 3 - 0
.env → .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
 

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.env

+ 11 - 2
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``

+ 6 - 3
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 &