• 10 Posts
  • 51 Comments
Joined 1 year ago
cake
Cake day: June 9th, 2023

help-circle








  • I learned about this http response code too late. About 4 years ago I was working at a startup and I was the “lead engineer” (aka only engineer) on a project where I had to design and implement an entire REST API. I really wish I would have put this in somewhere, since we weren’t doing code review (because it was literally only me).



  • The only thing I changed from the nginx_internal.conf that is here is that I added ssl. But with no changes (aside from the required changes described in the instructions) to this file or docker-compose.yml, you should be able to access it using curl http://localhost:8536. I am not using a reverse proxy, as I am not hosting anything other webservers on my server at the moment, so I actually changed the exposed port in docker-compose.yml to map 443 to 8536 so I can serve https on the default port directly from the nginx container. Oh, and I had to add a mounted volume to the nginx container in docker-compose.yml for my ssl certificates for https.

    Here’s what I added:

    docker-compose.yml: (under services -> proxy -> volumes) - /path/to/ssl/certs/on/host/:/path/to/ssl/certs/in/container/ (under service -> proxy -> ports) - "443:8536"

    nginx_internal.conf: (under http -> server)

            ssl_certificate /path/to/ssl/certs/in/container/fullchain.pem;
            ssl_certificate_key /path/to/ssl/certs/in/container/privkey.pem;
            ssl_protocols TLSv1.3;
            ssl_ciphers HIGH:!aNULL:!MD5; # Full disclosure, I'm not 100% if this is the best option to put here
    
            # this is the port inside docker, not the public one yet
            listen 1236;
            listen 8536 ssl; # I had to add "ssl" here to serve https
            # change if needed, this is facing the public web
            server_name yourdomain.tld;
    

    If you wanted to skip https for now and just get it up, replace 443 with 80, and don’t make any changes to nginx_internal.conf.

    So, from what I have gathered, the lemmy-ui conatiner contains the html/js, and the lemmy container is the backend. Not 100% sure on that, but I believe that’s what it is. When trying to set up 0.17.4, I was able to access the UI by adding the lemmy-ui container to the lemmyexternalproxy network and mapping port 0.0.0.0:80 to lemmy-ui:1234.

    Ports aren’t usually exposed from the container directly. All ports are shared between containers on the lemmyinternal network. Only the nginx container is on the lemmyexternalproxy network, which is the one that can map ports to the host. So basically, your lemmy-ui container is exposing port 1234 to the nginx container through the lemmyinternal network, and nginx container is mapping that port on the lemmyinternal network to the lemmyexternalproxy on port 8536, and then docker is mapping port 8536 from the nginx container to 8536 (or whatever port you set it to. In my case, 443) on 0.0.0.0 (the host and the world).

    I hope that I worded that last part in a way that makes sense 😅.








  • I’m a software engineer, I have taken classes on docker, I host my own web pages, etc. and I STILL can’t get it my own instance of Lemmy running. The instructions are unclear. They have bugs in their docker-compose.yml file. It’s really bad. I have been working on it after work each day for the past 4 days. So far I got the UI working, but i can’t log in or create an account. And I had to disable logging to get it running because I was getting an error with how the logger was defined in the yml file.

    And because I was frustrated, even though I really, really didn’t want to, I tried using their ansible setup. It still didn’t work, and it completely fucked my server. It took me a few hours to undo all the shit it did.

    It’s not in a good state right now. Hopefully they fix it soon.