我的做法不同處在於使用了外部的redis伺服器,而不是為nitter特定起一個專用的,這樣可以節省資源。
Redis架設篇
架設redis的教學MariusHosting也有,請參考這篇,下面是我的指令腳本,PORT我特地設16379和18001,以避免偶機會跟群暉自帶或其他容易的redis服務衝突:
docker run -d --name=redis \
-v /volume1/docker/redis:/data \
-p 16379:6379 \
-p 18001:8001 \
--net=host \
--restart always \
redis/redis-stack
redis-stack這個docker會一併建立web監控畫面,可以透過https://nasip:8001來查看你的redis使用情形
Nitter架設篇
登入DSM,在docker目錄下新建目錄nitter
在nitter目錄下新增一個文件,命名nitter.conf
[Server]
hostname = "demo.com" # 請取代為你的nitter網站之IP或網域
title = "Nitter"
address = "0.0.0.0"
port = 8080
https = false # disable to enable cookies when not using https
httpMaxConnections = 100
staticDir = "./public"
[Cache]
listMinutes = 240 # how long to cache list info (not the tweets, so keep it high)
rssMinutes = 10 # how long to cache rss queries
redisHost = "x.x.x.x" # 取代為NAS 區網的IP
redisPort = 6379
redisPassword = ""
redisConnections = 20 # minimum open connections in pool
redisMaxConnections = 30
# new connections are opened when none are available, but if the pool size
# goes above this, they're closed when released. don't worry about this unless
# you receive tons of requests per second
[Config]
hmacKey = "b8f8b0740845c87916f" # random key for cryptographic signing of video urls
base64Media = false # use base64 encoding for proxied media urls
enableRSS = true # set this to false to disable RSS feeds
enableDebug = false # enable request logs and debug endpoints (/.tokens)
proxy = "" # http/https url, SOCKS proxies are not supported
proxyAuth = ""
tokenCount = 10
# minimum amount of usable tokens. tokens are used to authorize API requests,
# but they expire after ~1 hour, and have a limit of 500 requests per endpoint.
# the limits reset every 15 minutes, and the pool is filled up so there's
# always at least `tokenCount` usable tokens. only increase this if you receive
# major bursts all the time and don't have a rate limiting setup via e.g. nginx
# Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences]
theme = "Nitter"
replaceTwitter = "nitter.net"
replaceYouTube = "piped.video"
replaceReddit = "teddit.net"
proxyVideos = true
hlsPlayback = false
infiniteScroll = false
登入portainer,新增stack
version: "3.9"
services:
nitter:
image: zedeus/nitter:latest
container_name: Nitter
hostname: nitter
mem_limit: 512m
cpu_shares: 512
security_opt:
- no-new-privileges:true
read_only: true
user: 1026:100
healthcheck:
test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080"]
interval: 1m
timeout: 3s
ports:
- 9765:8080
volumes:
- /volume1/docker/nitter/nitter.conf:/src/nitter.conf:ro
restart: on-failure:5
佈署完畢後,如果DOCKER沒有瘋狂重啟代表正常,開始體驗乾淨、去隱私追蹤的推特吧