I have tried the docker, ansible, and scratch methods. I have been troubleshooting for a month now. I have gotten nowhere. I need someone to help walk me through how to deploy a lemmy server because the guides are absolute trash.
Please help. I’m wasting money running this VPS and for literally nothing.
Edit: So, I’ve tried the ansible method, but I can’t access my server this way. It just keeps saying “UNREACHABLE”. I have generated a dozen keys, none of them work. I have NO PROBLEMS with ssh in Putty. I can use Putty all day. Putty works fine using my ssh key. Ansible does not. No amount of new keys has made any difference. I have countless keys in my stupid droplet because of this hacky garbage.
No problem at all. Thanks for getting back to me. I really do appreciate it!!! I have a busy day today too but I’ll try to be vigilant about responding.
So, here’s something that might work. I tested it on my local machine, up to Caddy but without HTTPS, but I’m confident it’ll work once deployed on a server.
Prerequisites:
Setup
First, create a folder and download the following files:
nginx.conf
Then, generate passwords for PostgreSQL and your admin user, store them somewhere safe.
Config changes
lemmy.hjson
You’ll want to change the
admin_username
,admin_password
andsite_name
to match your primary user’s credentials and the name you want to give your instance.Then, change
hostname
to match your domain name: if it issub.domain.tld
then it should readhostname: "sub.domain.tld"
.The base config file does not have proper configuration for the database, so you’ll have to edit the
database
field as follows with the password you previously created:database: { host: postgres database: "lemmy" user: "lemmy" password: "POSTGRES_PWD" # Change for your password }
Additionally, if you want to send emails for registration confirmation and password resets, add the following before the closing
}
and change to match your email provider configuration.email: { # Hostname and port of the smtp server smtp_server: "SMTP_SERVER" # Login name for smtp server smtp_login: "SMTP_LOGIN" # Password to login to the smtp server smtp_password: "SMTP_PASSWORD" # Address to send emails from, eg "noreply@your-instance.com" smtp_from_address: "SMTP_LOGIN" # Whether or not smtp connections should use tls. Can be none, tls, or starttls tls_type: "starttls" }
docker-compose.yml
By default the compose file is meant to build a development version of Lemmy, we will change this by removing the blocks with
build
and uncomment those withimage
. Note: think to update the images to0.18.2
since it fixes some vulnerabilities.Also, since we will use a reverse proxy and I don’t now if your server has a firewall, we should remove the
ports
blocks which are used to expose the services’ ports on the host.Finally, make sure to change the
POSTGRES_PASSWORD
field to match the PostgreSQL password you set inlemmy.hjson
.It should look something like that:
Reverse-proxy
For the final touch, we are going to setup Caddy, a reverse proxy with HTTPS support out of the box. You could use pretty much any reverse proxy you want, but I chose Caddy for its easy setup.
First, create a file nammed
Caddyfile
and write the following in it:Make sure to match your actual domain name.
Finally, update the
docker-compose.yml
file to add the following at the end (make sure that it’s correctly tabulated)Launching the instance
Before starting the stack, we have a few things left to do:
mkdir -p volumes/postgres volumes/pictrs
volumes/pictrs
:sudo chown -R 991:991 pictrs
Finally, to start everything:
docker compose up -d
Weird, my comment does not seem to be picked up by lemmy.world, even after deleting and re-submitting it 🤔
https://lemmy.blackeco.com/comment/150520
So, here’s something that might work. I tested it on my local machine, up to Caddy but without HTTPS, but I’m confident it’ll work once deployed on a server.
Prerequisites:
Setup
First, create a folder and download the following files:
nginx.conf
Then, generate passwords for PostgreSQL and your admin user, store them somewhere safe.
Config changes
lemmy.hjson
You’ll want to change the
admin_username
,admin_password
andsite_name
to match your primary user’s credentials and the name you want to give your instance.Then, change
hostname
to match your domain name: if it issub.domain.tld
then it should readhostname: "sub.domain.tld"
.The base config file does not have proper configuration for the database, so you’ll have to edit the
database
field as follows with the password you previously created:database: { host: postgres database: "lemmy" user: "lemmy" password: "POSTGRES_PWD" # Change for your password }
Additionally, if you want to send emails for registration confirmation and password resets, add the following before the closing
}
and change to match your email provider configuration.email: { # Hostname and port of the smtp server smtp_server: "SMTP_SERVER" # Login name for smtp server smtp_login: "SMTP_LOGIN" # Password to login to the smtp server smtp_password: "SMTP_PASSWORD" # Address to send emails from, eg "noreply@your-instance.com" smtp_from_address: "SMTP_LOGIN" # Whether or not smtp connections should use tls. Can be none, tls, or starttls tls_type: "starttls" }
docker-compose.yml
By default the compose file is meant to build a development version of Lemmy, we will change this by removing the blocks with
build
and uncomment those withimage
. Note: think to update the images to0.18.2
since it fixes some vulnerabilities.Also, since we will use a reverse proxy and I don’t now if your server has a firewall, we should remove the
ports
blocks which are used to expose the services’ ports on the host.Finally, make sure to change the
POSTGRES_PASSWORD
field to match the PostgreSQL password you set inlemmy.hjson
.It should look something like that:
Reverse-proxy
For the final touch, we are going to setup Caddy, a reverse proxy with HTTPS support out of the box. You could use pretty much any reverse proxy you want, but I chose Caddy for its easy setup.
First, create a file nammed
Caddyfile
and write the following in it:Make sure to match your actual domain name.
Finally, update the
docker-compose.yml
file to add the following at the end (make sure that it’s correctly tabulated)Launching the instance
Before starting the stack, we have a few things left to do:
mkdir -p volumes/postgres volumes/pictrs
volumes/pictrs
:sudo chown -R 991:991 pictrs
Finally, to start everything:
docker compose up -d