Today I decided to get an inexpensive custom domain from Namecheap and try self-hosting Lemmy. A few bucks later I was thinking, “Hey, this is going to be cake.”

I’d read some of the warnings about Oracle Cloud free tier, but figured I’d still give it a shot for hosting. I found a simple how-to for quickly getting an Ubuntu instance spun up with Docker and Portainer. A few minutes later I’m thinking, “This is so easy!”

Then I try to access Portainer using HTTPS and see my first “Your connection is not private,” warning. “No worries,” I think. “Advanced>Proceed. I’m in.”

So I run Lemmy Easy Deploy. “The lights are green, the trap is clean! Boom. Here we go!”

Nothing.

Ports seem to be open on Oracle, but no Lemmy at either 80 or 443.

“Maybe Lemmy is more particular about SSL certificates and such?” I think, for the first time getting worried.

"Err, I think that if I change my nameserver to Cloudflare I can destroy my Lemmy containers, re-run Lemmy Easy Deploy with a Cloudflare API token, and maybe fix it?

Four hours later, after repeatedly starting over, clearing my browser cache every 5 minutes, switching back and forth between nameservers, even deleting the whole Oracle Cloud VM and starting from scratch, I realize that an HTTP connection to port 443 is returning “Client sent an HTTP request to an HTTPS server.”

“Were you there before, message?” I wonder.

Lemmy friends, can you help me? Or am I better off just deleting the VM and giving up the whole idea?

  • Gamera8ID@lemm.eeOP
    link
    fedilink
    English
    arrow-up
    5
    ·
    a year ago

    Lemmy Easy Deploy. I didn’t know where to find any tutorials for using an Oracle Cloud VM. Did the official have that?

        • Rikudou_Sage@lemmings.world
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          a year ago

          Then it should work with this: https://join-lemmy.org/docs/administration/install_docker.html

          Here are the commands, basically:

          Installing docker

          From this doc: https://docs.docker.com/engine/install/ubuntu/

          • for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
          • apt-get update
          • apt-get install ca-certificates curl gnupg
          • install -m 0755 -d /etc/apt/keyrings
          • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
          • chmod a+r /etc/apt/keyrings/docker.gpg
          • echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
          • apt-get update
          • apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose

          This series of commands installed an official docker repository in your system so docker itself is always up-to-date, Ubuntu gets updates like this kinda slowly.

          Installing Lemmy

          From this doc: https://join-lemmy.org/docs/administration/install_docker.html

          • mkdir /opt/lemmy
          • cd /opt/lemmy
          • wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/docker-compose.yml
          • wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/examples/config.hjson -O lemmy.hjson
          • wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/nginx_internal.conf
          • wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/examples/customPostgresql.conf
          • Edit all the downloaded files (for example using nano) and change everything that starts with {{ and ends with }}
          • mkdir -p volumes/pictrs
          • chown -R 991:991 volumes/pictrs
          • docker-compose up -d

          Installing webserver

          I chose Caddy, you can choose a different one but then you’ll have to check on your own.

          From this guide: https://caddyserver.com/docs/install#debian-ubuntu-raspbian

          • apt install -y debian-keyring debian-archive-keyring apt-transport-https
          • curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
          • curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
          • apt update
          • apt install caddy
          • Edit the file /etc/caddy/Caddyfile (for example using nano /etc/caddy/Caddyfile)
          • Paste this content (replace domain.tld with your Lemmy instance domain and the 1236 with the port you have configured in the docker-compose.yml file for {{ lemmy_port }}):
          domain.tld {
                  @http {
                          protocol http
                  }
                  redir @http https://{host}{uri}
                  reverse_proxy localhost:1236
          }
          

          Hope I haven’t forgotten anything, feel free to ask.

          Edit: After all the commands, restart caddy with service caddy restart.