Previous Page

nihilist - 16 / 07 / 2023

Teddit Setup

In this tutorial we're going to setup Teddit, a privacy front-end for Reddit.

Initial Setup

first install the dependencies


[ nowhere.moe ] [ /dev/pts/2 ] [~]
→ apt install docker.io docker-compose -y
	

Then run it with docker-compose:


[ nowhere.moe ] [ /dev/pts/2 ] [/srv]
→ git clone https://codeberg.org/teddit/teddit
Cloning into 'teddit'...
remote: Enumerating objects: 609, done.
remote: Counting objects: 100% (609/609), done.
remote: Compressing objects: 100% (283/283), done.
remote: Total 6548 (delta 492), reused 324 (delta 324), pack-reused 5939
Receiving objects: 100% (6548/6548), 4.35 MiB | 24.59 MiB/s, done.
Resolving deltas: 100% (3049/3049), done.

[ nowhere.moe ] [ /dev/pts/2 ] [/srv]
→ cd teddit

[ nowhere.moe ] [ /dev/pts/2 ] [/srv/teddit]
→ vim docker-compose.yml

[ nowhere.moe ] [ /dev/pts/2 ] [/srv/teddit]
→ cat docker-compose.yml
# This docker-compose file is made for development purpose and build from source, if you want to use teddit in production, the README contains a production-ready docker-compose setup.

version: "3"

services:

  teddit:
    container_name: teddit
    build: .
    environment:
      - REDIS_HOST=teddit-redis
    ports:
      - "8082:8080"
    networks:
      - teddit_net
    healthcheck:
      test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080/about"]
      interval: 1m
      timeout: 3s
    depends_on:
      - teddit-redis

  teddit-redis:
    container_name: teddit-redis
    image: redis:6.2.5-alpine
    command: redis-server
    environment:
      - REDIS_REPLICATION_MODE=master
    networks:
      - teddit_net

networks:
  teddit_net:

[ nowhere.moe ] [ /dev/pts/2 ] [/srv/teddit]
→ docker-compose up -d
Creating network "teddit_teddit_net" with the default driver
Pulling teddit-redis (redis:6.2.5-alpine)...
6.2.5-alpine: Pulling from library/redis
a0d0a0d46f8b: Pull complete
a04b0375051e: Pull complete
cdc2bb0f9590: Pull complete
8f19735ec10c: Pull complete
ac5156a4c6ca: Pull complete
7b7e1b3fdb00: Pull complete
Digest: sha256:fa785f9bd167b94a6b30210ae32422469f4b0f805f4df12733c2f177f500d1ba
Status: Downloaded newer image for redis:6.2.5-alpine
Building teddit
Step 1/9 : FROM node:slim
slim: Pulling from library/node
faef57eae888: Pull complete
f54b1e40b8eb: Pull complete
36433a2ca875: Pull complete
604c60d297fb: Pull complete
aa860910361c: Pull complete
Digest: sha256:11f66bf5d0842fe1f87457fabe62aa3bbcfbb739d231a39e67597af22d8f5ffd
Status: Downloaded newer image for node:slim
 ---> 9eabbb6ea234
Step 2/9 : RUN apt-get update && apt-get install -y ffmpeg wget

[...]

[ nowhere.moe ] [ /dev/pts/2 ] [/srv/teddit]
→ docker-compose up -d
teddit-redis is up-to-date
Recreating teddit ... done
	

Then from here you need to setup the reverse nginx proxy as follows:


[ nowhere.moe ] [ /dev/pts/2 ] [/etc/nginx/sites-available]
→ vim teddit.nowhere.moe

[ nowhere.moe ] [ /dev/pts/2 ] [/etc/nginx/sites-available]
→ cat teddit.nowhere.moe
server {
        listen 443 ssl;
        server_name teddit.nowhere.moe;

        ssl_certificate /etc/acme/certs/teddit.nowhere.moe/teddit.nowhere.moe.cer;
    ssl_certificate_key /etc/acme/certs/teddit.nowhere.moe/teddit.nowhere.moe.key;

    ######## TOR CHANGES ########
    listen 4443;
    listen [::]:4443;
    server_name teddit.daturab6drmkhyeia4ch5gvfc2f3wgo6bhjrv3pz6n7kxmvoznlkq4yd.onion;
    add_header Onion-Location "http://teddit.daturab6drmkhyeia4ch5gvfc2f3wgo6bhjrv3pz6n7kxmvoznlkq4yd.onion$request_uri" always;
    ######## TOR CHANGES ########

   location / {
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://localhost:8082;
    }

}

[ nowhere.moe ] [ /dev/pts/2 ] [/etc/nginx/sites-available]
→ bash
root@Datura /etc/nginx/sites-available # acme.sh --issue --standalone -d teddit.nowhere.moe -k 4096

root@Datura /etc/nginx/sites-available # ln -s /etc/nginx/sites-available/teddit.nowhere.moe /etc/nginx/sites-enabled/
root@Datura /etc/nginx/sites-available # nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@Datura /etc/nginx/sites-available # systemctl restart nginx
	

Then we can test if the website is reachable:

And also from tor:

Then last step is contributing to the overall list of instances like so:

Then make sure teddit is restarted once every hour:


[ nowhere.moe ] [ /dev/pts/1 ] [/srv/teddit]
→ crontab -e

@hourly docker-compose -f /srv/teddit/docker-compose.yml stop ; git -C /srv/teddit/ pull ;   docker-compose -f /srv/teddit/docker-compose.yml pull ; docker-compose -f /srv/teddit/docker-compose.yml up -d


[ nowhere.moe ] [ /dev/pts/2 ] [~]
→ cronitor select

✔ docker-compose -f /srv/teddit/docker-compose.yml stop ; git -C /srv/teddit/ pull ; docker-compose -f /srv/teddit/docker-compose.yml pull ; docker-compose -f /srv/teddit/docker-compose.yml up -d
----► Running command: docker-compose -f /srv/teddit/docker-compose.yml stop ; git -C /srv/teddit/ pull ; docker-compose -f /srv/teddit/docker-compose.yml pull ; docker-compose -f /srv/teddit/docker-compose.yml up -d

Stopping teddit       ... done
Stopping teddit-redis ... done
Already up to date.
Pulling teddit-redis ... done
Starting teddit-redis ... done
Starting teddit       ... done

----► ✔ Command successful    Elapsed time 14.079s


Nihilism

Until there is Nothing left.



Creative Commons Zero: No Rights Reserved

About nihilist

Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8


Contact: nihilist@contact.nowhere.moe (PGP)