From ef30492ca2e87b7927ef526301932761b2aff0b2 Mon Sep 17 00:00:00 2001 From: appletalk Date: Tue, 17 May 2022 19:04:11 -0700 Subject: [PATCH] initial commit --- .env.sample | 24 ++++++++++++++ README.md | 22 +++++++++++++ abra.sh | 1 + compose.yml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ nitter.conf.tmpl | 45 +++++++++++++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 .env.sample create mode 100644 abra.sh create mode 100644 compose.yml create mode 100644 nitter.conf.tmpl diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..fc45739 --- /dev/null +++ b/.env.sample @@ -0,0 +1,24 @@ +TYPE=nitter + +DOMAIN={{ .Domain }} + +## Domain aliases +#EXTRA_DOMAINS=', `www.nitter.example.com`' + +LETS_ENCRYPT_ENV=production + +NITTER_TITLE=Nitter +NITTER_HOSTNAME=$DOMAIN +#NITTER_BASE64_MEDIA=false +#NITTER_ENABLE_RSS=true +#NITTER_ENABLE_DEBUG=false +#NITTER_THEME=Nitter +#NITTER_REPLACE_TWITTER=nitter.example.com +#NITTER_REPLACE_YOUTUBE=invidious.example.com +#NITTER_REPLACE_REDDIT=libreddit.example.com +#NITTER_REPLACE_INSTAGRAM=bibliogram.example.com +#NITTER_PROXY_VIDEOS=true +#NITTER_HLS_PLAYBACK=false +#NITTER_INFINITE_SCROLL=false + +SECRET_HMAC_KEY_VERSION=v1 # length=64 diff --git a/README.md b/README.md index 637936e..0dd1b0e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ # nitter +> A free and open source alternative Twitter front-end focused on privacy and performance. + + + +* **Category**: Apps +* **Status**: 1, alpha +* **Image**: [`nitter`](https://hub.docker.com/r/nitter), 4, upstream +* **Healthcheck**: Yes +* **Backups**: No +* **Email**: No +* **Tests**: No +* **SSO**: No + + + +## Quick start + +* `abra app new nitter --secrets` +* `abra app config ` +* `abra app deploy ` + +For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..687dcc6 --- /dev/null +++ b/abra.sh @@ -0,0 +1 @@ +export NITTER_CONF_VERSION=v1 diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..31537ef --- /dev/null +++ b/compose.yml @@ -0,0 +1,81 @@ +--- +version: "3.8" + +services: + app: + image: zedeus/nitter:latest + configs: + - source: nitter_conf + target: /src/nitter.conf + secrets: + - hmac_key + environment: + - NITTER_TITLE + - NITTER_HOSTNAME + - NITTER_BASE64_MEDIA=false + - NITTER_ENABLE_RSS=true + - NITTER_ENABLE_DEBUG=false + - NITTER_THEME="Nitter" + - NITTER_REPLACE_TWITTER="" + - NITTER_REPLACE_YOUTUBE="" + - NITTER_REPLACE_REDDIT="" + - NITTER_REPLACE_INSTAGRAM="" + - NITTER_PROXY_VIDEOS=true + - NITTER_HLS_PLAYBACK=false + - NITTER_INFINITE_SCROLL=false + depends_on: + - redis + networks: + - proxy + - internal + volumes: + - config:/src + deploy: + restart_policy: + condition: on-failure + labels: + - "traefik.enable=true" + - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8080" + - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})" + - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" + - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" + ## Redirect from EXTRA_DOMAINS to DOMAIN + #- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect" + #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true" + #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" + - "coop-cloud.${STACK_NAME}.version=" + healthcheck: + test: "wget -nv --tries=1 --spider http://127.0.0.1:8080/Jack/status/20 || exit 1" + interval: 30s + timeout: 10s + retries: 10 + start_period: 1m + + redis: + image: redis:6-alpine + networks: + - internal + deploy: + restart_policy: + condition: on-failure + #healthcheck: + #test: ["CMD", "redis-cli", "ping"] + +networks: + internal: + proxy: + external: true + +configs: + nitter_conf: + name: ${STACK_NAME}_nitter_conf_${NITTER_CONF_VERSION} + file: nitter.conf.tmpl + template_driver: golang + +secrets: + hmac_key: + name: ${STACK_NAME}_hmac_key_${SECRET_HMAC_KEY_VERSION} + external: true + +volumes: + config: diff --git a/nitter.conf.tmpl b/nitter.conf.tmpl new file mode 100644 index 0000000..08613ff --- /dev/null +++ b/nitter.conf.tmpl @@ -0,0 +1,45 @@ +[Server] +address = "0.0.0.0" +port = 8080 +https = true # disable to enable cookies when not using https +httpMaxConnections = 100 +staticDir = "./public" +title = {{ env "NITTER_TITLE" }} +hostname = {{ env "NITTER_HOSTNAME" }} + +[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 = "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 = {{ secret "hmac_key" }} # random key for cryptographic signing of video urls +base64Media = {{ env "NITTER_BASE64_MEDIA" }} # use base64 encoding for proxied media urls +enableRSS = {{ env "NITTER_ENABLE_RSS" }} # set this to false to disable RSS feeds +enableDebug = {{ env "NITTER_ENABLE_DEBUG" }} # 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 = {{ env "NITTER_THEME" }} +replaceTwitter = {{ env "NITTER_REPLACE_TWITTER" }} +replaceYouTube = {{ env "NITTER_REPLACE_YOUTUBE" }} +replaceReddit = {{ env "NITTER_REPLACE_REDDIT" }} +replaceInstagram = {{ env "NITTER_REPLACE_INSTAGRAM" }} +proxyVideos = {{ env "NITTER_PROXY_VIDEOS" }} +hlsPlayback = {{ env "NITTER_HLS_PLAYBACK" }} +infiniteScroll = {{ env "NITTER_INFINITE_SCROLL" }}