Skip to content

Installation

Tommaso Ornato edited this page Sep 7, 2023 · 3 revisions

Docker (recommended method)

Lemmy deployed on Docker with docker-compose

Add the following lines to your docker-compose.yml, as an additional voice under the services key:

 automod:
    image: ornatot/lemmy-automoderator:latest
    hostname: automod
    environment:
      - LEMMY_USERNAME=AccountUsername
      - LEMMY_PASSWORD=AccountPassword
      - LEMMY_INSTANCE=lemmy.example.com
      - DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/[...]
    restart: always
    logging: *default-logging
    ports:
      - "8000:8080"
    volumes:
      - ./volumes/automoderator:/usr/src/app/database

The environment values will have to be filled with the credentials of the account you'll be using the AutoMod from, as well as your Lemmy instance.
The DISCORD_WEBHOOK_URL is optional and only necessary if you plan on using the Discord webhook administration feature.

Standalone Docker container

Alternatively, it is also possible to run the docker container without docker-compose, by running the following command:

$ docker run 
    -p PORT:8080 
    -e LEMMY_USERNAME=AccountUsername 
    -e LEMMY_PASSWORD=AccountPassword
    -e LEMMY_INSTANCE=lemmy.example.com
    -e DISCORD_WEBHOOK_URL=https://discord.com/api/[...]
    -d ornatot/lemmy-automoderator

The -e values will have to be filled with the credentials of the account you'll be using the AutoMod from, as well as your Lemmy instance.
The DISCORD_WEBHOOK_URL is optional and only necessary if you plan on using the Discord webhook administration feature.

Users will also need to change the value of PORT to an appropriate port number on the host machine.

Node script

Lastly, it is possible to directly run the bot as a Node.js script.

Requirements

  • Node.JS on a version greater than 17.5. Reccomended version: 18.17.1 LTS
  • NPM

Credentials

To run the bot, it will be necessary to create a .env file in the root directory of the project, containing the credentials of the account you'll be using the AutoMod from, as well as your Lemmy instance.
The DISCORD_WEBHOOK_URL is optional and only necessary if you plan on using the Discord webhook administration feature.

LEMMY_USERNAME=AccountUsername
LEMMY_PASSWORD=AccountPassword
LEMMY_INSTANCE=lemmy.example.com
DISCORD_WEBHOOK_URL=https://discord.com/api/[...]

Commands

Run the following commands to compile and run the bot:

npm i to install all dependencies. It might be necessary to also run separately npm i better-sqlite3, to install the appropriate sqlite binaries for your machine.

npm run build to compile the TypeScript code to executable JavaScript.

npm start to start the bot.