-
Notifications
You must be signed in to change notification settings - Fork 1
Hosting ClaireBot
ClaireBot is hosted for free by me, and will remain that way for the foreseeable future. However, you may wish to host your own instance of her. Doing so is relatively easy, you will just need to have some basic sysadmin skills.
The following sections are written in the order that makes things as simple as possible. I recommend following it.
First, you'll need to clone the ClaireData repository.
git clone https://github.com/Sidpatchy/ClaireData.git
cd ClaireData/
Next, you'll need to edit the password in the application.yml
file. Be sure to change it to something secure!
nano src/main/resources/application.yml
Then, you'll need to edit the password in the SecurityConfiguration.java
file. Again, change it to something secure!
nano src/main/java/com/sidpatchy/ClaireData/SecurityConfiguration.java
Finally, we'll need to build ClaireData.
./gradlew build
Assuming no errors, you will find a built version of ClaireData in build/libs/
. Make sure you do not choose the file that ends with -plain.jar
, if you're in doubt, choose the bigger file.
The following will demonstrate how to do this using Docker, if you aren't comfortable with that, you may find other resources.
Create and edit a file called docker-compose.yml
nano docker-compose.yml
Set the contents of the file to this, making sure to change the password to whatever you set earlier.
---
version: "2.1"
services:
clairedata-db:
container_name: clairedata-db
image: postgres
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_DB:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: examplePassword
volumes:
- clairedb-data:/var/lib/postgresql/data
Finally run
docker-compose up -d
Start by downloading the latest build of ClaireBot. Note that the link may have changed, if you get an error, check to see if it has changed.
wget https://ci.sidpatchy.com/view/Discord%20Bots/job/ClaireBot/lastStableBuild/artifact/build/libs/ClaireBot-3.0-all.jar
Next, you'll need to run the bot once, the command should be along the lines of:
java -jar java -jar ClaireBot-3.0-all.jar
Then if we run ls
, we'll get a list of files something like this
$ ls
ClaireBot-3.0-all.jar config logs
We're only interested in the file at config/config.yml
nano config/config.yml
You will need to fill in the following categories
# ----------------- MAIN CONFIG ----------------
# General config options
# Discord bot token, get one at https://discord.com/developers/applications
token:
Here, we just need to change the apiPath to our ClaireData instance, as well as the apiPassword to the password we set in the SecurityConfiguration.java
file earlier.
ClaireData is hosted on http://127.0.0.1:8080
if you are just running this on one machine.
# --------------- DATABASE CONFIG --------------
# Config options related to ClaireData.
# https://github.com/Sidpatchy/ClaireData
# ClaireData's login information
apiPath: https://api.example.com/
apiUser: clairedata
apiPassword: examplePassword
Additionally, ClaireBot supports sharding, if you're in doubt, don't touch this.
Just change the current shard, and total shards accordingly.
# ----------------- SHARD CONFIG ---------------
# It is assumed that only one shard will be running by default.
# You probably don't need to change this.
# The shard the bot should log in to
current_shard: 0
# The total number of shards.
total_shards: 1
Now that we have ClaireBot and ClaireData setup, we should be able to start everything.
I like to use Screen but there are a number of options you could use.
Open a screen for ClaireData and start it.
screen -S ClaireData # will open a new screen named ClaireData
java -jar ClaireData-0.0.1-SNAPSHOT.jar
Next, we'll need to open another Screen for ClaireBot.
screen -S ClaireBot
java -jar java -jar ClaireBot-3.0-all.jar
Assuming you've done everything correctly, ClaireBot should now be up and running. Go ahead and run a command to test the database, if there are no errors, you're all set!