Quickly setting up a local Tiny Tiny RSS instance with Docker
I’ve been manufacturing scenarios to test Docker lately and one which came to mind is setting up a local RSS reader instance. It took me a while to parse all the necessary config but the result is very satisfying. You’ll need Docker and Docker Compose to run the below. The below creates two Docker instances, […]
3 January 2019

I’ve been manufacturing scenarios to test Docker lately and one which came to mind is setting up a local RSS reader instance. It took me a while to parse all the necessary config but the result is very satisfying. You’ll need Docker and Docker Compose to run the below.

The below creates two Docker instances, one for the database, one for Apache + PHP upon which Tiny Tiny RSS runs.

This assumes also that you already have something running on the :80 and :443 ports so we’ll forward them to a different port.

Create the volume for the Postgres container.

$ mkdir -p ~/docker/rss
$ cd ~/docker/rss
$ mkdir database_vol

Create the Dockerfile for the web frontend.

# Dockerfile-web
FROM php:7.2-apache
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y libpq-dev git libpng-dev libfreetype6-dev libjpeg62-turbo-dev libxml2-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include
RUN docker-php-ext-configure xml --with-libxml-dir=/usr/include
RUN docker-php-ext-install pdo_pgsql mbstring json gd xml opcache pgsql intl
RUN docker-php-ext-enable opcache
RUN git clone https://tt-rss.org/git/tt-rss.git ./
RUN chown -R www-data:www-data /var/www/html
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

Now create the docker compose file to bundle the containers together.

# docker-compose.yml
version: "2"
services:
database:
image: postgres
volumes:
- /var/lib/postgresql
environment:
POSTGRES_USER: docker
POSTGRES_PASSWORD: docker
networks:
- net-backend

web:
build:
context: ./
dockerfile: Dockerfile-web
networks:
- net-backend
volumes:
- /var/www/html
ports:
- "8080:80"
depends_on:
- database

networks:
net-backend:
driver: bridge

Now we can start the Docker containers and access it at http://<docker host>:8080/install

$ docker-compose -f docker-compose.yml up -d web

In the configuration page, enter the following for the database information:
Database type: PostgreSQL
Username: docker
Password: docker
Database name: docker
Host name: database
Port: 5432

Then copy the provided config into /var/html/www/config.php file.

You’re all set. Want to get started quickly? Clone my git repository that has the files already created.

$ git clone https://github.com/xocite/docker-ex-ttrss