LemmyNet / lemmy-docs

Documentation for Lemmy
https://join-lemmy.org/docs/en/index.html
GNU Affero General Public License v3.0
75 stars 89 forks source link

From scratch installation instructions not working #281

Closed danielkrajnik closed 3 months ago

danielkrajnik commented 1 year ago

Requirements

Summary

Follow all the steps in the official lemmy documentation to install the server via docker.

run docker compose up -d

error: parsing /home/user/lemmy/docker-compose.yml: yaml: line 32: found character that cannot start any token

line 32 is: 32 │ {% if lemmy_env_vars is defined and lemmy_env_vars|length > 0 %}

Debian 12

danielkrajnik commented 1 year ago

Wait... are these files just copy-pasted from ansible? Are they just dropped "raw" and users are expected to figure out how to edit them on our own? lol, they are... that's what "manual" installation with docker referred to? That's soo lazy... I'm going to try Lemmy-Easy-Deploy

Nutomic commented 1 year ago

Yes this could be clarified in the instructions. Or link to a specific commit for these files to avoid pulling in unexpected changes. Improvements welcome.

mgamsjager commented 8 months ago

So any updates on this?

Nutomic commented 8 months ago

You need to remove those lines manually. Pull request welcome to improve the docs.

qiancsff commented 3 months ago

root@iZj6c5rwn5vqye6a5aty2uZ:~/lemmy# docker compose up -d yaml: line 28: found character that cannot start any token

dessalines commented 3 months ago

Not the right repo, this one doesn't even have a Dockerfile.

Are you talking about join-lemmy? lemmy-ansible? Which one?

Also this is almost certainly a docker-compose version issue, make sure you're on the most updated version of docker and docker-compose.

qiancsff commented 3 months ago

不是正确的存储库,这个甚至没有 Dockerfile。

你说的是 join-lemmy 吗?lemmy-ansible?哪一个?

此外,这几乎可以肯定是 docker-compose 版本问题,请确保您使用的是 docker 和 docker-compose 的最新版本。

Docker Installation

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 and dessalines/lemmy-ui:VERSION

Tracking Issue: 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.

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/files/proxy_params

qiancsff commented 3 months ago

![Uploading 1.png…]()

qiancsff commented 3 months ago

root@debian:~# docker version Client: Docker Engine - Community Version: 27.0.3 API version: 1.46 Go version: go1.21.11 Git commit: 7d4bcd8 Built: Sat Jun 29 00:03:03 2024 OS/Arch: linux/amd64 Context: default

Server: Docker Engine - Community Engine: Version: 27.0.3 API version: 1.46 (minimum version 1.24) Go version: go1.21.11 Git commit: 662f78c Built: Sat Jun 29 00:03:03 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.18 GitCommit: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e runc: Version: 1.7.18 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0 root@debian:~# docker -v Docker version 27.0.3, build 7d4bcd8 root@debian:~# docker-compose -v docker-compose version 1.25.0, build unknown root@debian:~#

Nutomic commented 3 months ago

You must be talking about this file. What you have to do is remove the entire first environment block and replace the second block with this:

environment:
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST=your-domain.com
- LEMMY_UI_HTTPS=true

We really need to link a working docker-compose file.

bat0nas commented 3 months ago

Could anybody share a working Lemmy docker-compose and Lemmy config file? Thanks!!!

It's a shame there's still no tutorial which would just work :)

kamlendras commented 3 months ago

You must be talking about this file. What you have to do is remove the entire first environment block and replace the second block with this:

environment:
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST=your-domain.com
- LEMMY_UI_HTTPS=true

We really need to link a working docker-compose file.

I followed your steps, Still did't works

x-logging: &default-logging
  driver: "json-file"
  options:
    max-size: "50m"
    max-file: "4"

services:
  proxy:
    image: docker.io/library/nginx 
    ports:
      # Note, change lemmy_port in vars.yml if it is already in use on your system
      - "127.0.0.1:{{ lemmy_port }}: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: {{ lemmy_docker_image }}
    hostname: lemmy
    restart: always
    logging: *default-logging
    volumes:
      - ./lemmy.hjson:/config/config.hjson:Z
    depends_on:
      - postgres
      - pictrs

  lemmy-ui:
    image: {{ lemmy_docker_ui_image }}
    environment:
    - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
   - LEMMY_UI_LEMMY_EXTERNAL_HOST=your-domain.com
   - LEMMY_UI_HTTPS=true
    volumes:
      - ./volumes/lemmy-ui/extra_themes:/app/extra_themes:Z
    depends_on:
      - lemmy
    restart: always
    logging: *default-logging

  pictrs:
    image: docker.io/asonix/pictrs:0.5
    # 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:
{% if pictrs_env_vars is defined and pictrs_env_vars|length > 0 %}
{% for item in pictrs_env_vars %}
{% for key, value in item.items() %}
      - {{ key }}={{ value }}
{% endfor %}
{% endfor %}
{% endif %}
{% if pictrs_safety is defined and pictrs_safety|bool == true %}
      - PICTRS__MEDIA__EXTERNAL_VALIDATION=http://{{ domain }}:14051/api/v1/scan/IPADDR
{% endif %}
    user: 991:991
    volumes:
      - ./volumes/pictrs:/mnt:Z
    restart: always
    logging: *default-logging

  postgres:
    image: docker.io/postgres:16-alpine
    hostname: postgres
    environment:
{% if postgres_env_vars is defined and postgres_env_vars|length > 0 %}
{% for item in postgres_env_vars %}
{% for key, value in item.items() %}
      - {{ key }}={{ value }}
{% endfor %}
{% endfor %}
{% endif %}
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data:Z
      - ./customPostgresql.conf:/etc/postgresql.conf:Z
    restart: always
    command: postgres -c config_file=/etc/postgresql.conf
    shm_size: {{ postgres_shm }}
    logging: *default-logging

  postfix:
    image: docker.io/mwader/postfix-relay
    environment:
{% if postfix_env_vars is defined and postfix_env_vars|length > 0 %}
{% for item in postfix_env_vars %}
{% for key, value in item.items() %}
      - {{ key }}={{ value }}
{% endfor %}
{% endfor %}
{% endif %}
    restart: "always"
    logging: *default-logging

{% if pictrs_safety is defined and pictrs_safety|bool == true %}
  pictrs-safety:
    image: ghcr.io/db0/pictrs-safety:v1.2.2
    hostname: pictrs-safety
    environment:
{% if pictrs_safety_env_vars is defined and pictrs_safety_env_vars|length > 0 %}
{% for item in pictrs_safety_env_vars %}
{% for key, value in item.items() %}
      - {{ key }}={{ value }}
{% endfor %}
{% endfor %}
{% endif %}
    ports:
      - "14051:14051"
    user: 991:991
    restart: always
    logging: *default-logging
    depends_on:
      - pictrs
{% endif %}
dessalines commented 3 months ago

We recently merged this docker-compose.yml file here: https://github.com/LemmyNet/lemmy-docs/blob/main/assets/docker-compose.yml

dessalines commented 3 months ago

@bat0nas Install instructions here: https://join-lemmy.org/docs/administration/install_docker.html

bat0nas commented 3 months ago

@bat0nas Install instructions here: https://join-lemmy.org/docs/administration/install_docker.html

Thanks @dessalines . Somehow my containers were not able to communicate with each other. I had to add ports for each container in docker compose file. Otherwise nothing worked.

Anyway.. looks like my Lemmy project is up and running. Still many things needs to be tweaked (proxy, pictrs etc.). But the core - is up.

Nutomic commented 3 months ago

You can make a pull request if anything is still missing from the docs. Anyway this issue should be resolved.