Cloudflare Tunnel and Gotosocial

· #selfhosted #cloudflare #gotosocial

Table of Contents

I’m still on my college holiday and I want to try something.

cloudflare tunnel

Now, we can expose our localhost service to the public without a public IP or router setting with Cloudflare Zero Trust and it’s completely free. You need a credit card for registration.

I’m not explaining how to register zero trust, and you can read the documentation on the Cloudflare website .

We need CloudFlared, a lightweight server-side daemon, to connect a tunnel between the localhost and the CloudFlare server. You can download it as a Debian package, RPM, Docker, Mac, or Windows. Also, it has different architectures, like 64-bit, 32-bit, arm64-bit, and arm32-bit.

For Debian,

curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb

Then, install the Cloudflare service with your token.

sudo cloudflared service install xxx

Go to the Public Hostname menu and click “Add a public hostname”.

Choose which domain you are using and the port of service. Example: I set localhost:8080 because port 8080 will be a Gotosocial service port.

gotosocial

Fediverse is not just a mastodon, but more than that, one of them is gotosocial.

According to the project github, GoToSocial is a fast and lightweight activitypub social network server written in Golang. Gotosocial does not have a frontend and you have to use another client, like Tusky, Semaphore, and the others. Don’t worry, you will have the same experience: post, read, and follow other accounts.

I like to install Gotosocial via Docker Composer because I just paste the script and start the service.

Create docker-compose.yml for gotosocial.

version: "3.3"

services:
  gts:
    image: superseriousbusiness/gotosocial:latest
    container_name: gts
    user: 1000:1000
    hostname: gts 
    environment:
      GTS_HOST: domain.tld
      GTS_DB_TYPE: sqlite
      GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db
      GTS_LETSENCRYPT_ENABLED: "false"
      GTS_LETSENCRYPT_EMAIL_ADDRESS: ""
      GTS_ADVANCED_RATE_LIMIT_REQUESTS: 0
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./:/gotosocial/storage     
    restart: "always"

You can change settings using environment variables .

Start the service

$ docker-compose up -d

You should be able to see your instance in the browser.

More information about creating an admin and user is there .

Enjoyed the post?

You can support this blog with donate ❤️

Questions or comments? email me.