nitter: enable twitter gateway

single-dockerfile
Ubuntu 1 year ago
parent 9679a1f2a4
commit e317ac9b92
  1. 1
      Makefile
  2. 1
      env.production
  3. 43
      nitter.yaml
  4. 10
      nitter/Dockerfile
  5. 33
      nitter/nginx.conf
  6. 45
      nitter/nitter.conf

@ -8,6 +8,7 @@ MODULES += matrix
MODULES += nextcloud
MODULES += mobilizon
MODULES += gitea
MODULES += nitter
#MODULES += pixelfed
include env.production

@ -20,6 +20,7 @@ MATRIX_HOSTNAME=matrix
MOBILIZON_HOSTNAME=events
PIXELFED_HOSTNAME=pixelfed
PROMETHEUS_HOSTNAME=metrics
NITTER_HOSTNAME=nitter
AUTH_URL=https://${KEYCLOAK_HOSTNAME}.${DOMAIN_NAME}/realms/${REALM}/protocol/openid-connect/auth
TOKEN_URL=https://${KEYCLOAK_HOSTNAME}.${DOMAIN_NAME}/realms/${REALM}/protocol/openid-connect/token

@ -0,0 +1,43 @@
version: "3"
services:
nitter:
# image: zedeus/nitter:latest
build:
context: nitter
dockerfile: Dockerfile
container_name: nitter
volumes:
- ./nitter/nitter.conf:/src/nitter.conf.template:ro
depends_on:
- nitter-redis
restart: unless-stopped
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:8080/Jack/status/20 || exit 1
interval: 30s
timeout: 5s
retries: 2
env_file:
- ./env.production
environment:
# - DOMAIN_NAME=${DOMAIN_NAME}
# - NITTER_HOSTNAME=${NITTER_HOSTNAME}
- NITTER_SECRET=${NITTER_CLIENT_SECRET}
nitter-redis:
image: redis:6-alpine
container_name: nitter-redis
command: redis-server --save 60 1 --loglevel warning
volumes:
- ./data/nitter/redis:/data
restart: unless-stopped
healthcheck:
test: redis-cli ping
interval: 30s
timeout: 5s
retries: 2
# add the nitter nginx configuration into the nginx volume
nginx:
volumes:
- ./nitter/nginx.conf:/etc/nginx/templates/nitter.conf.template:ro

@ -0,0 +1,10 @@
#
# Use the official image, but add envsubst so that we can use
# variable names in the configuration file.
#
FROM zedeus/nitter:latest
RUN apk --no-cache add gettext
ENTRYPOINT ["/usr/bin/env"]
CMD ["/bin/sh", "-c", "envsubst < ./nitter.conf.template > ./nitter.conf && exec ./nitter"]
#CMD ["/bin/sh", "-c", "echo hello ; sleep 60" ]

@ -0,0 +1,33 @@
server {
server_name ${NITTER_HOSTNAME} ${NITTER_HOSTNAME}.${DOMAIN_NAME};
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
#include /etc/nginx/mime.types;
#default_type application/octet-stream;
client_max_body_size 160m;
gzip on;
gzip_disable "msie6";
proxy_read_timeout 1800s;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
chunked_transfer_encoding on;
location / {
proxy_pass http://nitter:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/${DOMAIN_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN_NAME}/privkey.pem;
include /etc/nginx/includes/options-ssl-nginx.conf;
include /etc/nginx/includes/challenge.conf;
ssl_dhparam /etc/nginx/includes/ssl-dhparams.pem;
}

@ -0,0 +1,45 @@
[Server]
address = "0.0.0.0"
port = 8080
https = false # disable to enable cookies when not using https
httpMaxConnections = 100
staticDir = "./public"
title = "nitter"
hostname = "${NITTER_HOSTNAME}.${DOMAIN_NAME}"
[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 = "nitter-redis"
redisPort = 6379
redisPassword = ""
redisConnections = 20 # connection pool size
redisMaxConnections = 30
# max, 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 = "${NITTER_SECRET}" # 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
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 187 requests.
# the limit gets reset every 15 minutes, and the pool is filled up so there's
# always at least $tokenCount usable tokens. again, only increase this if
# you receive major bursts all the time
# Change default preferences here, see src/prefs_impl.nim for a complete list
[Preferences]
theme = "Nitter"
replaceTwitter = "${NITTER_HOSTNAME}.${DOMAIN_NAME}"
replaceYouTube = "piped.kavin.rocks"
replaceReddit = "teddit.net"
replaceInstagram = ""
proxyVideos = true
hlsPlayback = false
infiniteScroll = true
Loading…
Cancel
Save