diff --git a/assets/docker-compose.yml b/assets/docker-compose.yml new file mode 100644 index 0000000..14dee53 --- /dev/null +++ b/assets/docker-compose.yml @@ -0,0 +1,88 @@ +x-logging: &default-logging + driver: "json-file" + options: + max-size: "50m" + max-file: "4" + +services: + proxy: + image: nginx:1-alpine + ports: + # Listen for outside connections on port 10633. You can freely change the left-side + # number to a different port, eg using port 80 if you don't need a reverse proxy. + - "10633:8536" + volumes: + - ./nginx_internal.conf:/etc/nginx/nginx.conf:ro,Z + - ./proxy_params:/etc/nginx/proxy_params:ro,Z + restart: always + logging: *default-logging + depends_on: + - pictrs + - lemmy-ui + + lemmy: + image: dessalines/lemmy:0.19.5 + hostname: lemmy + restart: always + logging: *default-logging + environment: + - RUST_LOG="warn" + volumes: + - ./lemmy.hjson:/config/config.hjson:Z + depends_on: + - postgres + - pictrs + + lemmy-ui: + image: dessalines/lemmy-ui:0.19.5 + environment: + - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 + - LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy.ml + - LEMMY_UI_HTTPS=true + volumes: + - ./volumes/lemmy-ui/extra_themes:/app/extra_themes + depends_on: + - lemmy + restart: always + logging: *default-logging + + pictrs: + image: asonix/pictrs:0.5.16 + # this needs to match the pictrs url in lemmy.hjson + hostname: pictrs + # we can set options to pictrs like this, here we set max. image size and forced format for conversion + # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp + environment: + - PICTRS_OPENTELEMETRY_URL=http://otel:4137 + - PICTRS__SERVER__API_KEY={{ postgres_password }} + - RUST_BACKTRACE=full + - PICTRS__MEDIA__VIDEO__VIDEO_CODEC=vp9 + - PICTRS__MEDIA__ANIMATION__MAX_WIDTH=256 + - PICTRS__MEDIA__ANIMATION__MAX_HEIGHT=256 + - PICTRS__MEDIA__ANIMATION__MAX_FRAME_COUNT=400 + user: 991:991 + volumes: + - ./volumes/pictrs:/mnt:Z + restart: always + logging: *default-logging + + postgres: + image: pgautoupgrade/pgautoupgrade:16-alpine + hostname: postgres + environment: + - POSTGRES_USER=lemmy + - POSTGRES_PASSWORD={{ postgres_password }} + - POSTGRES_DB=lemmy + shm_size: 1g + volumes: + - ./volumes/postgres:/var/lib/postgresql/data:Z + - ./customPostgresql.conf:/etc/postgresql.conf + restart: always + logging: *default-logging + + postfix: + image: mwader/postfix-relay + environment: + - POSTFIX_myhostname={{ domain }} + restart: "always" + logging: *default-logging diff --git a/src/administration/administration.md b/src/administration/administration.md index 6469f59..a72b866 100644 --- a/src/administration/administration.md +++ b/src/administration/administration.md @@ -2,7 +2,7 @@ Information for Lemmy instance admins, and those who want to run a server. -If you have any problems in the installation, you can ask for help in [!lemmy_support](https://lemmy.ml/c/lemmy_support). Do not use Github for support. +If you have any problems in the installation, you can ask for help in [!lemmy_support](https://lemmy.ml/c/lemmy_support) or [Matrix](https://matrix.to/#/#lemmy-support-general:discuss.online). Do not open Github issues for support. ## Install diff --git a/src/administration/install_docker.md b/src/administration/install_docker.md index 1e7c527..6b35d71 100644 --- a/src/administration/install_docker.md +++ b/src/administration/install_docker.md @@ -1,30 +1,25 @@ # Docker Installation -Make sure you have both docker and docker-compose(>=`2.0`) installed. On Ubuntu, just run `apt install docker-compose-v2 docker.io`. On Debian, you need to install Docker [using their official installation instructions and custom `apt` repo](https://docs.docker.com/engine/install/debian/). Next, +Make sure you have both docker and docker-compose(>=`2.0`) installed. On Ubuntu, just run `apt install docker-compose-v2 docker.io`. On Debian, you need to install Docker [using their official installation instructions and custom `apt` repo](https://docs.docker.com/engine/install/debian/). + +Create a folder for the lemmy files. the location doesnt matter. You can put this anywhere you want, for example under `/srv/`: ```bash -# Create a folder for the lemmy files. the location doesnt matter, you can put this anywhere you want mkdir lemmy cd lemmy ``` -## Download default config files - -These files contain `{{ }}` braces for variables, such as passwords and your domain. - -Edit them before starting up lemmy for the first time. - -The images will likely be: [dessalines/lemmy:VERSION](https://hub.docker.com/r/dessalines/lemmy) and [dessalines/lemmy-ui:VERSION](https://hub.docker.com/r/dessalines/lemmy-ui) - -[Tracking Issue](https://github.com/LemmyNet/lemmy/issues/3996): For now, using `latest` is not advisable as changes can break your instance. Make sure you are using a specific version number. This is temporary and will be fixed. +Then download default config files: ```bash -wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/docker-compose.yml +wget https://raw.githubusercontent.com/LemmyNet/lemmy-docs/main/assets/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/files/proxy_params ``` +Edit `docker-compose.yml` and `lemmy.hjson` to replace all occurrences of `{{ domain }}` with your actual Lemmy domain, `{{ postgres_password }}` with a random password and `{{lemmy_port}}` with `10633`. + If you'd like further customization, have a look at the [config file](configuration.md) named `lemmy.hjson`, and adjust it accordingly. ## Database tweaks @@ -72,10 +67,9 @@ For federation to work, it is important that you do not change any headers that # Updating -To update to the newest version, you can manually change the version in `docker-compose.yml`. Alternatively, fetch the latest version from our [lemmy-ansible](https://github.com/LemmyNet/lemmy-ansible) repo: +To update to the newest version, it is usually enough to change the version numbers in `docker-compose.yml`, eg `dessalines/lemmy:0.19.4` to `dessalines/lemmy:0.19.5`. If additional steps are required, these are explained in the respective release announcement. After changing the versions, run these commands: ```bash -wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/docker-compose.yml -# Then replace the {{ }} vars again +docker compose pull docker compose up -d ```