initial for mariadb

mariadb-unsupported
Andrew Dolgov 4 years ago
parent f11f02a3ad
commit 0921c53b72

@ -1,68 +1,4 @@
# Dockerized tt-rss using docker-compose This branch uses MySQL (actually, MariaDB).
The idea is to provide tt-rss working (and updating) out of the box with minimal fuss. It's not supported and is only there for development. Don't use it in production. Just don't.
- [TODO](https://git.tt-rss.org/fox/ttrss-docker-compose/wiki/TODO)
- [FAQ](https://git.tt-rss.org/fox/ttrss-docker-compose/wiki#faq)
General outline of the configuration is as follows:
- separate containers (frontend: nginx, database: pgsql, app and updater: php/fpm)
- tt-rss updates from git master repository on container restart
- tt-rss source code is stored on a persistent volume so plugins, etc. could be easily added
- database schema is installed automatically if it is missing
- nginx has its http port exposed to the outside
- optional SSL support via Caddy w/ automatic letsencrypt certificates (deprecated)
- feed updates are handled via update daemon started in a separate container (updater)
- optional backups container which performs tt-rss database backup once a week
### Installation
#### Check out scripts from Git:
```sh
git clone https://git.tt-rss.org/fox/ttrss-docker-compose.git ttrss-docker && cd ttrss-docker
```
#### Edit configuration files:
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.
By default, `web` 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``.
Please don't rename the services inside `docker-compose.yml` unless you know what you're doing. Web container expects application container to be named `app`, if you rename it and it's not accessible via Docker DNS as `http://app` you will run into 502 errors on startup.
Main configuration file (`config.php`) is rewritten on startup, don't edit it manually. Use [environment variables](https://git.tt-rss.org/fox/ttrss-docker-compose/wiki#how-do-i-set-global-configuration-options) or `config.d` snippets to customize it.
#### Build and start the container
```sh
docker-compose up --build -d
```
See docker-compose documentation for more information and available options.
#### Default login credentials
Username: `admin`, password: `password`
### Updating
Restarting the container will update tt-rss from the origin repository. If database needs to be updated,
tt-rss will prompt you to do so on next page refresh.
#### Updating container scripts
1. Stop the containers: ``docker-compose down && docker-compose rm``
2. Update scripts from git: ``git pull origin master`` and apply any necessary modifications to ``.env``, etc.
3. Rebuild and start the containers: ``docker-compose up --build``
### Suggestions / bug reports
- [Forum thread](https://community.tt-rss.org/t/docker-compose-tt-rss/2894)

@ -2,11 +2,11 @@ FROM alpine:3.13
EXPOSE 9000/tcp EXPOSE 9000/tcp
RUN apk add --no-cache dcron php8 php8-fpm \ RUN apk add --no-cache dcron php8 php8-fpm \
php8-pdo php8-gd php8-pgsql php8-pdo_pgsql php8-mbstring \ php8-pdo php8-gd php8-mysqlnd php8-pdo_mysql php8-mbstring \
php8-intl php8-xml php8-curl php8-session \ php8-intl php8-xml php8-curl php8-session \
php8-dom php8-fileinfo php8-json php8-iconv \ php8-dom php8-fileinfo php8-json php8-iconv \
php8-pcntl php8-posix php8-zip php8-openssl \ php8-pcntl php8-posix php8-zip php8-openssl \
git postgresql-client sudo php8-pecl-xdebug git mysql-client sudo php8-pecl-xdebug
ENV SCRIPT_ROOT=/opt/tt-rss ENV SCRIPT_ROOT=/opt/tt-rss
@ -31,9 +31,9 @@ ENV TTRSS_XDEBUG_ENABLED=""
ENV TTRSS_XDEBUG_HOST="" ENV TTRSS_XDEBUG_HOST=""
ENV TTRSS_XDEBUG_PORT="9000" ENV TTRSS_XDEBUG_PORT="9000"
ENV TTRSS_DB_TYPE="pgsql" ENV TTRSS_DB_TYPE="mysql"
ENV TTRSS_DB_HOST="db" ENV TTRSS_DB_HOST="db"
ENV TTRSS_DB_PORT="5432" ENV TTRSS_DB_PORT="3306"
ENV TTRSS_MYSQL_CHARSET="UTF8" ENV TTRSS_MYSQL_CHARSET="UTF8"
ENV TTRSS_PHP_EXECUTABLE="/usr/bin/php8" ENV TTRSS_PHP_EXECUTABLE="/usr/bin/php8"

@ -1,6 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
while ! pg_isready -h $TTRSS_DB_HOST -U $TTRSS_DB_USER; do while ! mysql -h $TTRSS_DB_HOST -u $TTRSS_DB_USER -p$TTRSS_DB_PASS -e "select 1"; do
echo waiting until $TTRSS_DB_HOST is ready... echo waiting until $TTRSS_DB_HOST is ready...
sleep 3 sleep 3
done done
@ -19,11 +19,9 @@ SRC_REPO=https://git.tt-rss.org/fox/tt-rss.git
[ -e $DST_DIR ] && rm -f $DST_DIR/.app_is_ready [ -e $DST_DIR ] && rm -f $DST_DIR/.app_is_ready
export PGPASSWORD=$TTRSS_DB_PASS
[ ! -e /var/www/html/index.php ] && cp ${SCRIPT_ROOT}/index.php /var/www/html [ ! -e /var/www/html/index.php ] && cp ${SCRIPT_ROOT}/index.php /var/www/html
PSQL="psql -q -h $TTRSS_DB_HOST -U $TTRSS_DB_USER $TTRSS_DB_NAME" PSQL="mysql -q -h $TTRSS_DB_HOST -u $TTRSS_DB_USER -p$TTRSS_DB_PASS $TTRSS_DB_NAME"
if [ ! -d $DST_DIR/.git ]; then if [ ! -d $DST_DIR/.git ]; then
mkdir -p $DST_DIR mkdir -p $DST_DIR
@ -65,14 +63,12 @@ for d in cache lock feed-icons; do
find $DST_DIR/$d -type f -exec chmod 666 {} \; find $DST_DIR/$d -type f -exec chmod 666 {} \;
done done
$PSQL -c "create extension if not exists pg_trgm"
RESTORE_SCHEMA=${SCRIPT_ROOT}/restore-schema.sql.gz RESTORE_SCHEMA=${SCRIPT_ROOT}/restore-schema.sql.gz
if [ -r $RESTORE_SCHEMA ]; then if [ -r $RESTORE_SCHEMA ]; then
zcat $RESTORE_SCHEMA | $PSQL zcat $RESTORE_SCHEMA | $PSQL
elif ! $PSQL -c 'select * from ttrss_version'; then elif ! $PSQL -e '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_mysql.sql
fi fi
# this was previously generated # this was previously generated

@ -12,7 +12,7 @@ if ! id app >/dev/null 2>&1; then
adduser -D -h /var/www/html -G app -u $OWNER_UID app adduser -D -h /var/www/html -G app -u $OWNER_UID app
fi fi
while ! pg_isready -h $TTRSS_DB_HOST -U $TTRSS_DB_USER; do while ! mysql -h $TTRSS_DB_HOST -u $TTRSS_DB_USER -p$TTRSS_DB_PASS -e "select 1"; do
echo waiting until $TTRSS_DB_HOST is ready... echo waiting until $TTRSS_DB_HOST is ready...
sleep 3 sleep 3
done done

@ -2,12 +2,13 @@ version: '3'
services: services:
db: db:
image: postgres:12-alpine image: mariadb:10
restart: unless-stopped restart: unless-stopped
environment: environment:
- POSTGRES_USER=${TTRSS_DB_USER} - MYSQL_USER=${TTRSS_DB_USER}
- POSTGRES_PASSWORD=${TTRSS_DB_PASS} - MYSQL_PASSWORD=${TTRSS_DB_PASS}
- POSTGRES_DB=${TTRSS_DB_NAME} - MYSQL_ROOT_PASSWORD=${TTRSS_DB_PASS}
- MYSQL_DATABASE=${TTRSS_DB_NAME}
volumes: volumes:
- db:/var/lib/postgresql/data - db:/var/lib/postgresql/data
@ -38,44 +39,19 @@ services:
- db - db
command: /opt/tt-rss/dcron.sh -f command: /opt/tt-rss/dcron.sh -f
updater: # updater:
build: # build:
context: # context:
./app # ./app
restart: unless-stopped
env_file:
- .env
volumes:
- app:/var/www/html
- ./config.d:/opt/tt-rss/config.d:ro
depends_on:
- app
command: /opt/tt-rss/updater.sh
# web:
# build: ./web
# restart: unless-stopped
# ports:
# - ${HTTP_PORT}:2015
# volumes:
# - app:/var/www/html:ro
# depends_on:
# - app
# web-ssl:
# build: ./web-ssl
# restart: unless-stopped # restart: unless-stopped
# environment: # env_file:
# - CADDYPATH=/certs # - .env
# - HTTP_HOST=${HTTP_HOST}
# ports:
# - 80:80
# - 443:443
# volumes: # volumes:
# - app:/var/www/html:ro # - app:/var/www/html
# - certs:/certs # - ./config.d:/opt/tt-rss/config.d:ro
# depends_on: # depends_on:
# - app # - app
# command: /opt/tt-rss/updater.sh
web-nginx: web-nginx:
build: ./web-nginx build: ./web-nginx

Loading…
Cancel
Save