Docker Deployments: TTRSS

Official Website

Refer: https://ttrss.henry.wang/

Docker Compose Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
version: "3"
services:
service.rss:
image: wangqiru/ttrss:latest
container_name: ttrss-web
ports:
- '10042:80'
environment:
# please change to your own domain
- SELF_URL_PATH=https://ttrss.example.domain/
# use the same password defined in `database.postgres`
- DB_PASS=emmettwoo
# run as root
- PUID=1000
- PGID=1000
volumes:
- feed-icons:/var/www/feed-icons/
networks:
- public_access
- service_only
- database_only
# stdin_open: true
# tty: true
restart: unless-stopped

# set Mercury Parser API endpoint to `service.mercury:3000` on TTRSS plugin setting page
service.mercury:
image: wangqiru/mercury-parser-api:latest
container_name: ttrss-mercury
networks:
- public_access
- service_only
restart: unless-stopped

# set OpenCC API endpoint to `service.opencc:3000` on TTRSS plugin setting page
service.opencc:
image: wangqiru/opencc-api-server:latest
container_name: ttrss-opencc
environment:
- NODE_ENV=production
networks:
- service_only
restart: unless-stopped

database.postgres:
image: postgres:13-alpine
container_name: ttrss-postgres
environment:
# feel free to change the password
- POSTGRES_PASSWORD=emmettwoo
volumes:
# persist postgres data to ~/postgres/data/ on the host
- /home/emmettwoo/data/ttrss/postgresql:/var/lib/postgresql/data
networks:
- database_only
restart: unless-stopped

# utility.watchtower:
# container_name: watchtower
# image: containrrr/watchtower:latest
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
# environment:
# - WATCHTOWER_CLEANUP=true
# - WATCHTOWER_POLL_INTERVAL=86400
# restart: always

volumes:
feed-icons:

networks:
# Provide the access for ttrss UI
public_access:
# Provide the communication network between services only
service_only:
internal: true
# Provide the communication between ttrss and database only
database_only:
internal: true

Nginx Configuration

TTRSS 容器自身不负责使用 HTTPS 加密通信。
参见官方的样例自行配置 Nginx 反向代理。
別忘了同時更新 compose 文件的 SELF_URL_PATH。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
upstream ttrss {
server 127.0.0.1:10042;
}

server
{
listen 80;
listen 443 ssl http2;
server_name ttrss.example.domain;

#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END

#SSL-START
ssl_certificate /etc/nginx/cert/example.domain/fullchain.pem;
ssl_certificate_key /etc/nginx/cert/example.domain/privkey.key;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
#SSL-END

location / {
proxy_redirect off;
proxy_pass http://ttrss;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;

client_max_body_size 100m;
client_body_buffer_size 128k;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}

access_log /var/log/nginx/ttrss.example.domain.log;
error_log /var/log/nginx/ttrss.example.domain.error.log;
}

Data Export & Import

1
2
3
4
5
6
7
8
9
10
11
# Stop containers to prevent data changed.
# sudo docker-compose stop

# Export: 將 postgres 容器中 postgres 用戶的數據 dump 到 ./export.sql
sudo docker exec ttrss-postgres pg_dumpall -c -U postgres > export.sql

# Restart containers
# sudo docker-compose up -d

# Import: 將先前 dump 出來的 sql 放到 postgres 容器中執行
cat export.sql | sudo docker exec -i ttrss-postgres psql -U postgres

Other Deployment Recommandation


Docker Deployments: TTRSS
https://tech.initialize.in/docker_2022/docker_2022_003_Deployments_TTRSS/
作者
Emmett Woo
发布于
2023年8月14日
许可协议