Fixing docker install. Fixes #163 (#164)

* Fixing docker install. Fixes #163

* Add letsencrypt guide.

---------

Co-authored-by: Nutomic <me@nutomic.com>
This commit is contained in:
Dessalines 2023-04-15 09:23:15 -04:00 committed by GitHub
parent 8ea712e8e4
commit d17fac8083
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,39 +16,35 @@ mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs sudo chown -R 991:991 volumes/pictrs
``` ```
Open up your `docker-compose.yml`, and make sure `LEMMY_EXTERNAL_HOST` for `lemmy-ui` is set to your correct host.
```
- LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_EXTERNAL_HOST=your-domain.com
- LEMMY_HTTPS=false
```
If you'd like a different database password, you should also change it in the `docker-compose.yml` **before** your first run. If you'd like a different database password, you should also change it in the `docker-compose.yml` **before** your first run.
After this, have a look at the [config file](configuration.md) named `lemmy.hjson`, and adjust it, in particular the hostname, and possibly the db password. Then run: After this, have a look at the [config file](configuration.md) named `lemmy.hjson`, and adjust it, in particular the hostname, and possibly the db password. Then run:
`docker-compose up -d` `docker-compose up -d`
You can access the lemmy-ui at `http://localhost:1235` You can access the lemmy-ui at `http://localhost:80`
To make Lemmy available outside the server, you need to setup a reverse proxy, like Nginx. [A sample nginx config](https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/nginx.conf), could be setup with: To make Lemmy available outside the server, you need to setup a reverse proxy, like Nginx. You can use the following simple proxy:
```bash ```
wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/nginx.conf server {
# Replace the {{ vars }} listen 80;
# The default lemmy_port is 8536 server_name my_domain.tld;
# The default lemmy_ui_port is 1235
sudo mv nginx.conf /etc/nginx/sites-enabled/lemmy.conf location / {
proxy_pass http://localhost:LEMMY_PORT;
include proxy_params;
}
}
``` ```
You will also need to setup TLS, for example with [Let's Encrypt](https://letsencrypt.org/). After this you need to restart Nginx to reload the config. You should also setup TLS, for example with [Let's Encrypt](https://letsencrypt.org/). [Here's a guide for setting up letsencrypt on Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04).
## Updating ## Updating
To update to the newest version, you can manually change the version in `docker-compose.yml`. Alternatively, fetch the latest version from our git repo: To update to the newest version, you can manually change the version in `docker-compose.yml`. Alternatively, fetch the latest version from our git repo:
```bash ```bash
wget https://raw.githubusercontent.com/LemmyNet/lemmy/main/docker/prod/docker-compose.yml wget https://raw.githubusercontent.com/LemmyNet/lemmy/main/docker/docker-compose.yml
docker-compose up -d docker-compose up -d
``` ```