Skip to content

Commit

Permalink
feat: fly.io vm
Browse files Browse the repository at this point in the history
  • Loading branch information
kristobalus committed Nov 30, 2023
1 parent 80796bb commit a2ec3b9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.fly
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ COPY --from=nim /src/nitter/nitter.example.conf ./nitter.conf
COPY --from=nim /src/nitter/public ./public
EXPOSE 8080
RUN adduser -h /src/ -D -s /bin/sh nitter
RUN chmod +x /src/entrypoint.sh
RUN chown nitter /src/entrypoint.sh
USER nitter
ENTRYPOINT ["/src/entrypoint.sh"]
4 changes: 2 additions & 2 deletions build-image-fly.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Read the version from package.json
VERSION=1.0.6-fly
VERSION=1.0.8-fly
IMAGE=kristobalus/nitter
echo "building image $IMAGE using buildx..."

Expand All @@ -18,4 +18,4 @@ docker buildx build -f ./Dockerfile.fly \
# docker buildx rm buildx_instance
docker tag $IMAGE:$VERSION $IMAGE:latest-fly
docker push $IMAGE:latest-fly
docker image prune -f --filter label=build-tag=build-artifact
# docker image prune -f --filter label=build-tag=build-artifact
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#!/bin/sh

echo "$NITTER_GUEST_ACCOUNTS_URL"
cp /config/nitter.conf /src/nitter.conf
cat /src/nitter.conf
wget -O /src/guest_accounts.json "$NITTER_GUEST_ACCOUNTS_URL"
./nitter
18 changes: 12 additions & 6 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# fly.toml app configuration file generated for api-nitter on 2023-11-30T12:35:49+06:00
# fly.toml app configuration file generated for api-nitter-3 on 2023-11-30T14:40:31+06:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "api-nitter"
app = "api-nitter-3"
primary_region = "waw"

[experimental]
entrypoint = ["/src/entrypoint.sh"]

[build]
image = "kristobalus/nitter:latest"
image = "kristobalus/nitter:1.0.7-fly"

[env]
NITTER_GUEST_ACCOUNTS_URL = "https://guest-keeper.fly.dev/guest-accounts"

[http_service]
internal_port = 8080
Expand All @@ -20,6 +20,12 @@ primary_region = "waw"
min_machines_running = 0
processes = ["app"]

[[files]]
guest_path = "/config/nitter.conf"
local_path = ""
secret_name = ""
raw_value = "[Server]\nhostname = \"nitter.net\" # for generating links, change this to your own domain/ip\ntitle = \"test\"\naddress = \"0.0.0.0\"\nport = 8080\nhttps = false # disable to enable cookies when not using https\nhttpMaxConnections = 100\nstaticDir = \"./public\"\n\n[Cache]\nlistMinutes = 240 # how long to cache list info (not the tweets, so keep it high)\nrssMinutes = 10 # how long to cache rss queries\n# redisHost = \"127.0.0.1\" # Change to \"nitter-redis\" if using docker-compose\nredisHost = \"fly-muddy-feather-6452.upstash.io\"\nredisPort = 6379\nredisPassword = \"79d56a12abd44c33939db0e7e56074dd\"\nredisConnections = 20 # minimum open connections in pool\nredisMaxConnections = 30\n# new connections are opened when none are available, but if the pool size\n# goes above this, they're closed when released. don't worry about this unless\n# you receive tons of requests per second\n\n[Config]\nhmacKey = \"secretkey\" # random key for cryptographic signing of video urls\nbase64Media = false # use base64 encoding for proxied media urls\nenableRSS = true # set this to false to disable RSS feeds\nenableDebug = true # enable request logs and debug endpoints (/.tokens)\nproxy = \"\" # http/https url, SOCKS proxies are not supported\nproxyAuth = \"\"\ntokenCount = 10\n# minimum amount of usable tokens. tokens are used to authorize API requests,\n# but they expire after ~1 hour, and have a limit of 500 requests per endpoint.\n# the limits reset every 15 minutes, and the pool is filled up so there's\n# always at least `tokenCount` usable tokens. only increase this if you receive\n# major bursts all the time and don't have a rate limiting setup via e.g. nginx\n\n# Change default preferences here, see src/prefs_impl.nim for a complete list\n[Preferences]\ntheme = \"Nitter\"\nreplaceTwitter = \"nitter.net\"\nreplaceYouTube = \"piped.video\"\nreplaceReddit = \"teddit.net\"\nproxyVideos = true\nhlsPlayback = false\ninfiniteScroll = false\n"

[[vm]]
cpu_kind = "shared"
cpus = 1
Expand Down
2 changes: 1 addition & 1 deletion nitter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ staticDir = "./public"
listMinutes = 240 # how long to cache list info (not the tweets, so keep it high)
rssMinutes = 10 # how long to cache rss queries
# redisHost = "127.0.0.1" # Change to "nitter-redis" if using docker-compose
redisHost = " fly-api-nitter-redis.upstash.io"
redisHost = "127.0.0.1"
redisPort = 6379
redisPassword = ""
redisConnections = 20 # minimum open connections in pool
Expand Down

0 comments on commit a2ec3b9

Please sign in to comment.