Skip to content

Conversation

@danthe1st
Copy link
Member

@danthe1st danthe1st commented Nov 12, 2024

This PR is in preparation for relocating the bot / reducing the resources required by the bot.

Changes

  • Use GraalVM's native image tool to generate Dockerfiles. This reduces the amount of resources necessary to run the bot.
    • This introduces a closed world assumption meaning all resources and classes used by reflection, JNI or similar mechanisms need to be specified at compile-time. These hints are specified in a class named RuntimeHintsConfiguration and a file named jni-config.json for JNI hints (necessary for Swing/plotting)
  • Disable JDA's member caching as storing member information for 25k members unnecessarily uses up memory.
    • This requires using retrieve... instead of get operations and getUser instead of getMember (where Discord doesn't provide member information) in some places
    • I used complete() in plotting-related logic but that is executed in the asyncPool so that shouldn't cause any issues.
    • Since members are no longer cached, the users with the QOTW champion role cannot be obtained easily any more. The current QOTW champions are now stored in the DB.
  • Update Spring (Boot)
  • bugfixes
    • The thanking system didn't actually thank the last user for each post because that button isn't disabled at that point
    • fix an issue with the serverlock
    • /tag-admin edit had an unnecessary .deferReply() that caused exceptions. This has been removed.
    • The metrics updater was not reliably registered
  • remove unnecessary DB pooling logs
  • Remove the spam links file since that's loaded automatically

Progress

  • explain the changes here (including docs how to build it)
  • remove first commit because it's from another PR, squash
  • use -O3
  • properly test functionality
    • all commands including autocomplete
    • other systems like help, automod and QOTW, webhook things, API, etc.
    • ensure other current PRs work
  • ensure AJP is working with the API site
  • run it as a systemd service
  • automatically create backups of data
  • actually replace bot keeping the config and DB
    • update config including bot owners and AJP address
  • redirect API to new location (via AJP)
  • run QOTW champion migration
    • ensure current QOTW champions are in DB
  • Change Docker Hub repo and update credentials

Other things noticed:

/db-admin quick-migrate doesn't use transactions properly. This can be implemented in a future PR.

not tested:

Search the web (no token):
If that doesn't work, we can still fix that in the future.

@danthe1st danthe1st marked this pull request as ready for review November 23, 2024 16:53
@danthe1st danthe1st requested a review from a team as a code owner November 23, 2024 16:53
@danthe1st
Copy link
Member Author

We aren't using AJP any more.

@danthe1st danthe1st merged commit 919c061 into Java-Discord:main Nov 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants