initial commit

This commit is contained in:
appletalk 2022-05-17 19:04:11 -07:00
parent 3a753c5cd2
commit ef30492ca2
5 changed files with 173 additions and 0 deletions

24
.env.sample Normal file
View File

@ -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

View File

@ -1,2 +1,24 @@
# nitter
> A free and open source alternative Twitter front-end focused on privacy and performance.
<!-- metadata -->
* **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
<!-- endmetadata -->
## Quick start
* `abra app new nitter --secrets`
* `abra app config <app-name>`
* `abra app deploy <app-name>`
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).

1
abra.sh Normal file
View File

@ -0,0 +1 @@
export NITTER_CONF_VERSION=v1

81
compose.yml Normal file
View File

@ -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:

45
nitter.conf.tmpl Normal file
View File

@ -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" }}