TinyTinyRss–Docker部署

使用RSS来过滤自己的信息源,再信息爆炸的时代可能是很好的一个习惯。这里记录下tinytinyRss 的服务部署,简称 ttrss。是一个开源的RSS的订阅端服务,来把rss来进行汇集,提供web和 移动端使用。

这里记录一下一个玩具级别的一键部署的 docker-compose 的文件,以便后面直接恢复和复用。

代码

docker-compose.yaml

version: '3'

services:
  db:
    image: postgres:12-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${TTRSS_DB_USER}
      - POSTGRES_PASSWORD=${TTRSS_DB_PASS}
      - POSTGRES_DB=${TTRSS_DB_NAME}
    volumes:
      - db:/var/lib/postgresql/data

  app:
    image: cthulhoo/ttrss-fpm-pgsql-static
    restart: unless-stopped
    env_file:
      - stack.env
    volumes:
      - app:/var/www/html
      - config:/opt/tt-rss/config.d:ro
      - themes:/var/www/html/tt-rss/themes.local/
      - plugins:/var/www/html/tt-rss/plugins.local/
    depends_on:
      - db

  backups:
    image: cthulhoo/ttrss-fpm-pgsql-static
    restart: unless-stopped
    env_file:
      - stack.env
    volumes:
      - backups:/backups
      - app:/var/www/html
      - etc:/var/www/html/tt-rss/
    depends_on:
      - db
    command: /opt/tt-rss/dcron.sh -f

  updater:
    image: cthulhoo/ttrss-fpm-pgsql-static
    restart: unless-stopped
    env_file:
      - stack.env
    volumes:
      - app:/var/www/html
      - config:/opt/tt-rss/config.d:ro
      - themes:/var/www/html/tt-rss/themes.local/
      - plugins:/var/www/html/tt-rss/plugins.local/
    depends_on:
      - app
    command: /opt/tt-rss/updater.sh

  web-nginx:
    image: cthulhoo/ttrss-web-nginx
    restart: unless-stopped
    ports:
      - ${HTTP_PORT}:80
    volumes:
      - app:/var/www/html:ro
      - themes:/var/www/html/tt-rss/themes.local/
      - plugins:/var/www/html/tt-rss/plugins.local/
    depends_on:
      - app

  mercury-parser-api:
    image: wangqiru/mercury-parser-api
    restart: unless-stopped
    depends_on:
      - app

volumes:
  db:
  app:
  certs:
  backups:
  etc:
  config:
  plugins:
  themes:

需要注意的是这里的 env_filestack.env,因为这里是使用 portainer 来进行部署的。再下面的配置的环境变量是在上面的compose代码中实现的,如果需要使用 envfile 来导入容器环境的时候就需要 使用 stack 文件来进行配置。这个是portainer 在自己的环境内部自动生成的。

.env

# Copy this file to .env before building the container.
# Put any local modifications here.

# Run under this UID/GID.
# OWNER_UID=1000
# OWNER_GID=1000

# FPM settings.
#PHP_WORKER_MAX_CHILDREN=5
#PHP_WORKER_MEMORY_LIMIT=256M

# ADMIN_USER_* settings are applied on every startup.

# Set admin user password to this value. If not set, random password will be
# generated if default password is being used, look for it in the 'app'
# container logs.
ADMIN_USER_PASS=tmppass

# Sets admin user access level to this value.
# Valid values:
# -2 - forbidden to login
# -1 - readonly
#  0 - default user
# 10 - admin
#ADMIN_USER_ACCESS_LEVEL=

# Auto create another user (in addition to built-in admin) unless it
# already exists.
#AUTO_CREATE_USER=
#AUTO_CREATE_USER_PASS=
#AUTO_CREATE_USER_ACCESS_LEVEL=0

# Default database credentials.
TTRSS_DB_USER=postgres
TTRSS_DB_NAME=postgres
TTRSS_DB_PASS=password

# You will likely need to set this to the correct value, see README.md
# for more information.
TTRSS_SELF_URL_PATH=http://server.me:8280/tt-rss

# You can customize other config.php defines by setting overrides here.
# See app/Dockerfile for complete list. Examples:
# TTRSS_PLUGINS=auth_remote
# TTRSS_SINGLE_USER_MODE=true
# TTRSS_SESSION_COOKIE_LIFETIME=2592000
# TTRSS_FORCE_ARTICLE_PURGE=30
# etc, etc.

# bind exposed port to 127.0.0.1 by default in case reverse proxy is used.
# if you plan to run the container standalone and need origin port exposed
# use next HTTP_PORT definition (or remove "127.0.0.1:").
HTTP_PORT=8280
#HTTP_PORT=8280