logger icon indicating copy to clipboard operation
logger copied to clipboard

[Tutorial] Running on Docker with Docker-Compose

Open uchihaservice opened this issue 1 year ago • 12 comments

Hey everyone,

Here is a docker compose file.

The bot works perfectly with it. If you want to set it up quickly.

Please create the following folders logger bezerk

Clone logger to /logger/ Clone bezerk to /bezerz/.

After that you can run docker-compose up -d without any problems. Run node src/miscellaneous/generateDB.js before the first start & adjust the .env.

version: "2"
services:
  cache:
    image: redis:6.2-alpine
    restart: always
    command: redis-server --save 20 1 --loglevel warning
    volumes: 
      - ./cache:/data
  node:
    image: "node:18"
    user: "node"
    working_dir: /home/node/app
    environment:
      - NODE_ENV=production
    volumes:
      - ./logger:/home/node/app
    command: "node index.js"
    depends_on:
      - cache
      - node2
      - db
  node2:
    image: "node:18"
    user: "node"
    working_dir: /home/node/app
    environment:
      - NODE_ENV=production
    volumes:
      - ./bezerk:/home/node/app
    command: "node index.js"
  db:
    image: postgres
    restart: always
    shm_size: 128mb
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: "YOurPassWoRd"

uchihaservice avatar Mar 19 '24 12:03 uchihaservice

Sorry to state the obvious - What do you mean by "Bezerk" - I am not fully aware of Github so trying to look where that is.

JasmeowTheCat avatar Mar 26 '24 00:03 JasmeowTheCat

Sorry to state the obvious - What do you mean by "Bezerk" - I am not fully aware of Github so trying to look where that is.

Look at the .env.example Bezerk is following: https://github.com/thesharks/bezerk To run the logger you need that.

uchihaservice avatar Mar 26 '24 07:03 uchihaservice

@uchihaservice to run logger you don't need bezerk, just remove BEZERK_URI and BEZERK_SECRET from the .env file

AFAIK bezerk is only needed for the main Logger / Patron Logger bots, not the selfhosted bots.

If I'm wrong about that then piero can clear it up.

SUPERCHIEFYT avatar Mar 26 '24 13:03 SUPERCHIEFYT

Do you have slash commands? I used the docker setup and only have text commands.

CillyCil avatar Apr 07 '24 00:04 CillyCil

@minecrafterty1 did you use <prefix>setcmd global? (after you use that command restart Discord)

SUPERCHIEFYT avatar Apr 07 '24 00:04 SUPERCHIEFYT

Ah, sorry about that

CillyCil avatar Apr 07 '24 00:04 CillyCil

What sentry URI do I provide it? I've installed Sentry as a docker container, so I just need to give it a URI. I am bit confused what it wants in the env field for RAVEN_URI=

The next question I have is - How do we get the bot dashboard up? I can expose that which isn't difficult, I just need to know what port or configuration I need to do to allow me to view it.

With Bezerk also, I run into the issue with it stating "Error: Cannot find module 'dotenv'" as obviously it needs to NPM I first, but sadly running that as an additional command inside the container will just throw access denied error.

JasmeowTheCat avatar Apr 24 '24 14:04 JasmeowTheCat

@JasmeowTheCat

  • RAVEN_URI= just remove or leave blank.
  • There is no bot dashboard for the development or selfhost branches. There is only a dashboard for the exe branch / version. (exe is outdated)
  • Bezerk isn't needed.

Also for Docker, try to use the selfhost branch on the repo, Curtis/Piero added Docker support in that branch.

Elara-Discord-Bots avatar Apr 24 '24 17:04 Elara-Discord-Bots

@Elara-Discord-Bots

  • Appreciated, but I would like to get the RavenURI working as it complains it would only log messages when I need to log other things.
  • Sad to hear there's no bot dashboard, not to worry though, I can use the slash commands.
  • What does Bezerk do? I thought that was the dashboard hence trying to make it work.

Regarding the patreon additions that existed with this bot, hopefully we can have someone make a pull request or Ill pay for it honestly so they can add the features that are missing.

JasmeowTheCat avatar Apr 24 '24 17:04 JasmeowTheCat

@JasmeowTheCat

  • When RAVEN_URI isn't added it will still log stuff to the console (and to the DISCORD_WEBHOOK_URL)
  • Bezerk is a backend service to fetch info for the dashboard and anything else that needs to get data from any of the bot's shards.
  • And if you're looking for file/attachment logs you could try Tizzy's fork that has it.

Elara-Discord-Bots avatar Apr 24 '24 17:04 Elara-Discord-Bots

  • Bezerk

I'm not sure how to get Bezerk working. The link here is telling me, "The owner has archived this repository on Dec 2, 2019. It is now read-only.".

I don't know what I'm supposed to do here. Can you help me, please? Thank you.

DrMemoryFish avatar Jul 05 '24 00:07 DrMemoryFish

@DrMemoryFish Bezerk isn't needed for selfhosting users, just leave the .env fields blank

Elara-Discord-Bots avatar Jul 05 '24 02:07 Elara-Discord-Bots