https://github.com/jwizard-bot/jwizard-lib
Library providing common configurations and classes for JWizard Core and JWizard API projects.
https://github.com/jwizard-bot/jwizard-lib
gradle-dsl javalin jvm jwizard-bot kotlin kotlin-library
Last synced: about 1 month ago
JSON representation
Library providing common configurations and classes for JWizard Core and JWizard API projects.
- Host: GitHub
- URL: https://github.com/jwizard-bot/jwizard-lib
- Owner: jwizard-bot
- License: agpl-3.0
- Created: 2024-10-22T23:12:48.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-06T19:40:30.000Z (about 1 year ago)
- Last Synced: 2025-03-06T20:29:12.661Z (about 1 year ago)
- Topics: gradle-dsl, javalin, jvm, jwizard-bot, kotlin, kotlin-library
- Language: Kotlin
- Homepage: https://jwizard.pl
- Size: 607 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README

[[About project](https://jwizard.pl/about)]
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.
## Table of content
* [Clone and install](#clone-and-install)
* [Package on local environments](#package-on-local-environments)
* [Docker containers](#docker-containers)
* [Contributing](#contributing)
* [License](#license)
## Clone and install
1. Make sure you have at least JDK 21 and Kotlin 2.2.
2. Clone this repository via:
```shell
$ git clone https://github.com/jwizard-bot/jwizard-lib
```
## Package on local environments
1. To package library to maven local, type:
- for UNIX based systems:
```bash
$ ./gradlew clean
$ ./gradlew publishToMavenLocal
```
- for Windows systems:
```bash
.\gradlew clean
.\gradlew publishToMavenLocal
```
## Docker containers
1. Before run containers, create `.env` file based `example.env` and fill with below schema:
```properties
# core instances
JWIZARD_JDA_SECRET_1_INSTANCE=
JWIZARD_JDA_SECRET_2_INSTANCE=
JWIZARD_REST_API_TOKEN=
# discord oidc (oauth2)
JWIZARD_OIDC_APP_ID=
JWIZARD_OIDC_SECRET=
# server (api)
JWIZARD_GITHUB_TOKEN=
# vault
JWIZARD_VAULT_ROOT_TOKEN=
# mysql
JWIZARD_MYSQL_USERNAME=
JWIZARD_MYSQL_PASSWORD=
JWIZARD_MYSQL_DB_NAME=
# rabbitmq
JWIZARD_RABBITMQ_USERNAME=
JWIZARD_RABBITMQ_PASSWORD=
# management
JWIZARD_MANAGEMENT_DEFAULT_ADMIN_LOGIN=
JWIZARD_MANAGEMENT_CF_CAPTCHA_SECRET_KEY=1x0000000000000000000000000000000AA
# common
JWIZARD_GEOLOCATION_API_KEY=
JWIZARD_AES_SECRET_KEY=<16 bytes of AES-128 secret value>
# lavalink
JWIZARD_AUDIO_NODE_TOKEN=
JWIZARD_AUDIO_YT_SOURCE_VERSION=
JWIZARD_AUDIO_YT_PO_TOKEN=
JWIZARD_AUDIO_YT_PO_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
```
2. To run all docker containers for this project, type:
```bash
$ 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 | 8767 | Lavalink #1 node. |
| jwizard-lava-node-2 | 8768 | Lavalink #2 node. |
| jwizard-rabbitmq | 8771, 8772 | RabbitMQ server and management panel. |
> [!TIP]
> 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:
```bash
$ docker compose up -D
```
where `` is the name of the container (available container you will find above in
the table).
3. Apply database migrations:
* Clone `jwizard-tools` repository via:
```bash
$ git clone https://github.com/jwizard-bot/jwizard-tools
```
* Set-up Python environment (see `README.md` file
in [jwizard-tools](https://github.com/jwizard-bot/jwizard-tools) repository),
* Run migrations for `self` and `infra` via:
```bash
$ (venv) python src/db_migrator.py --pipeline infra
$ (venv) python src/db_migrator.py --pipeline self
```
> [!TIP]
> More information about JWizard Python migrator you could find in
> [jwizard-tools](https://github.com/jwizard-bot/jwizard-tools) repository.
## Contributing
We welcome contributions from the community! Please read our [CONTRIBUTING](./CONTRIBUTING.md) file
for guidelines on how to get involved.
## License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.