JWizard is an open-source Discord music bot handling audio content from various multimedia sources with innovative web player. This repository contains a library that shares code between the JWizard Core and JWizard API projects. It includes additional helper classes for logging, database handling, and communication protocols based on AMQP and WebSockets.
- Make sure you have at least JDK 17 and Kotlin 2.0.
- Clone this repository via:
$ git clone https://github.com/jwizard-bot/jwizard-lib
- To package library to maven local, type:
- for UNIX based systems:
$ ./gradlew clean
$ ./gradlew publishToMavenLocal
- for Windows systems:
.\gradlew clean
.\gradlew publishToMavenLocal
- Before run containers, create
.env
file basedexample.env
and fill with below schema:
# core instances
JWIZARD_JDA_SECRET_1_INSTANCE=<JDA application secret (first instance)>
JWIZARD_JDA_SECRET_2_INSTANCE=<JDA application secret (second instance)>
JWIZARD_REST_API_TOKEN=<Rest API token used in communication between JWizard API and Core instances>
# discord oidc (oauth2)
JWIZARD_OIDC_APP_ID=<OAuth2 application identifier>
JWIZARD_OIDC_SECRET=<OAuth2 application secret>
# github
JWIZARD_GITHUB_TOKEN=<GitHub personal token (used for GitHub API calls)>
# vault
JWIZARD_VAULT_ROOT_TOKEN=<Vault root token (used in .env files in other JWizard projects>
# mysql
JWIZARD_MYSQL_USERNAME=<MySQL database username, by default root>
JWIZARD_MYSQL_PASSWORD=<MySQL database password>
JWIZARD_MYSQL_DB_NAME=<MySQL database name, by default jwizard-db>
# lavalink
JWIZARD_AUDIO_NODE_TOKEN=<Authentication token for development Lavalink nodes (all)>
JWIZARD_AUDIO_YT_SOURCE_VERSION=<yt source version>
JWIZARD_AUDIO_YT_PO_TOKEN=<proof of origin token>
JWIZARD_AUDIO_YT_PO_VISITOR_DATA=<proof of origin visitor data>
# ports (leave unchanged)
JWIZARD_VAULT_PORT=8761
JWIZARD_MYSQL_PORT=8762
JWIZARD_AUDIO_NODE_1_PORT=8766
JWIZARD_AUDIO_NODE_2_PORT=8767
JWIZARD_CORE_INSTANCE_1_PORT=8768
JWIZARD_CORE_INSTANCE_2_PORT=8769
- To run all docker containers for this project, type:
$ docker compose up -D
This command will create and run following containers:
Name | Port(s) | Description |
---|---|---|
jwizard-vault | 8761 | Secret keys storage service. |
jwizard-mysql-db | 8762 | MySQL database. |
jwizard-lava-node-1 | 8766 | Lavalink #1 node. |
jwizard-lava-node-2 | 8767 | Lavalink #2 node. |
NOTE: Alternatively, you can run single Lavalink node, but in
docker-compose.yml
file you must remove second Lavalink node declaration. Running 2 nodes are useful for checking load-balancer in performance tests.
AD: Alternatively you can run containers separately via:
$ docker compose up -D <container name>
where <container name>
is the name of the container (available container you will find above in
the table).
- Apply database migrations:
- Clone
jwizard-tools
repository via:
$ git clone https://github.com/jwizard-bot/jwizard-tools
- Set-up Python environment (see
README.md
file in jwizard-tools repository), - Run migrations for
self
andinfra
via:
$ (venv) python src/db_migrator.py --pipeline infra
$ (venv) python src/db_migrator.py --pipeline self
NOTE: More information about JWizard Python migrator you could find in jwizard-tools repository.
We welcome contributions from the community! Please read our CONTRIBUTING file for guidelines on how to get involved.
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.