-
Notifications
You must be signed in to change notification settings - Fork 5
Self Hosting
Self-hosting FBK is much more practical as of version 2.2, but will not be fully supported.
It may be straightforward or have complex issues depending on your knowledge. If you are trying to run your own personal bot and keep it updated to my changes, it is possible that I will break something in the future that requires you to understand the tech.
Basic understanding of git, Terminal, as well as a Docker installation and port forwarding is required to run a fully functional bot. Features such as the Twitter tracker may require additional steps.
I will include what should be all the steps and commands required for a basic self-hosted instance of FBK.
-
Prerequisites:
- Docker installed and functional. I can recommend Docker Desktop for a more friendly Windows installation, especially for viewing logs and attaching to containers, but you will still want to be familiar with executing commands in your terminal.
-
Java JDK 22 set as your primary Java installation or set as
JAVA_HOME
. This is for compiling the bot, so other versions will not work. - Know the basics of your platform's terminal to run the commands listed here. Windows 11: shift + right-click in a folder, "Open in Terminal".
- Text editor to edit config files, such as Notepad++ or Visual Studio Code, to edit the
db_password
andkeys.toml
files. The standard Windows Notepad can do it if desired, but you will need to be more careful with formatting.
-
Clone or otherwise download the FBK GitHub repo into a folder for development.
- Command:
git clone https://github.com/kabiiQ/FBK.git
- Command:
-
From the FBK repo folder, build the Docker image with Gradle (wrapper included, install not needed, but Java version must be set correctly).
- Command:
./gradlew dockerBuildImage
- This will compile the bot from source (thus you can make changes to the code) and build the Docker image. Can download ~2GB to create the environment, especially on first run.
- After building,
docker.kabii.moe/fbk:latest
should be available to your Docker install, which we will run later.
- Command:
-
(Recommended) Create a different directory you want to actually run the bot from.
- Move
compose.yaml
,db_password
files, as well as thefbk/
directory from the repo download to your permanent bot location. - If you move these files out, the FBK repo folder will not be used for the rest of these steps. You will use it in the future if you want to pull changes or make changes to the FBK code yourself, so you can recompile the bot and Docker image in the future (repeat step 2).
- If you do not use a different directory, you may overwrite and lose your bot token file or
keys.toml
when you attempt to update your FBK instance.
- Move
-
Edit
db_password
file with something random. -
Create the actual Discord bot.
- Create a Discord application.
- Take the token from the "Bot" tab and edit
fbk/files/instances/example.json
with your bot token and rename it something better. Leave the id as 1. - While on the Bot tab, enable the Privileged Gateway Intents toggles.
-
Start the Docker container stack from the directory you made which now contains the
compose.yaml
file.- Command:
docker compose up -d
- Will take a few minutes on first startup, as it will download ~9GB of translation models for the internal translator.
- These models will be saved into the bot folder so they are only fully downloaded on first start.
- If you definitely never want this feature and the download time is not worth it for you, you could remove the
libretranslate
service and dependency section fromcompose.yaml
before runningdocker compose up -d
.
- I did encounter some errors when launching the stack on a Linux system, due to more precise handling of host file permissions. I have noted some small changes you may need to make if you are using Linux in comments in
compose.yaml
.
- Command:
From here, the containers should be running and should appear and logs can be viewed in your Docker Desktop installation by clicking the appropriate container.
The FBK "console" can be interacted with by using docker attach fbk
in your terminal, ctrl+p ctrl+q to detach.
This is all you need for a basic instance of FBK. Many services, as noted in the log on startup, will be disabled without credentials provided.
If you are new to Docker: you do not need to be afraid of deleting the FBK container or associated database containers. They can be deleted and re-created at any time. The data is within the folders created alongside the compose.yaml
file, these you do not want to delete.
- (Optional?) Acquire/provide credentials for the external services you want.
- Edit
fbk/keys.toml
. Additional instructions can be found here. - Note the comments in this file will disappear if/when the bot rewrites the file, so you may want to view the original file later.
- Edit
To update your instance of FBK with changes made to the public version in the future:
-
Pull changes from GitHub
- In your FBK repo folder (where you originally ran
git clone
, now containing a.git
folder), run the command:git pull
- Alternatively, grab the source code fresh by running the original step 1 in a new folder.
- In your FBK repo folder (where you originally ran
-
Follow the original steps 2 and 6.
-
Update your
fbk/keys.toml
file if there are new properties added to the repo version.