JWizard is an open-source Discord music bot handling audio content from various multimedia sources with innovative web player. This repository contains scripts that automate operations in the CI/CD pipelines of other JWizard projects, as well as standalone scripts used in various JWizard projects.
Name | Description |
---|---|
packages_grabber | Parsing and persisting packages used in all JWizard projects. |
db_migrator | Database migrator framework, modifying structure and data via YAML files with SQL content. |
cache_version | Update deployment cache (project version and time) in DB. |
- Make sure you have at least Python 3 (tested on 3.14) at your machine.
- Clone this repository via:
$ git clone https://github.com/jwizard-bot/jwizard-tools
- Create
.env
file basedexample.env
with following properties:
ENV_VAULT_TOKEN=<token>
- Prepare Python virtual environment via:
$ python -m venv .venv
- Activate environment via:
- for UNIX environments:
$ source .venv/bin/activate
- for Windows environments:
.\.venv\bin\Activate.ps1
NOTE: If you have an execution policy error, try execute
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
in PowerShell.
NOTE: If you don't have
bin
directory, change path to.venv/Scripts/activate
and.\.venv\Scripts\Activate.ps1
for UNIX and Windows environments respectively.
- Install project-related dependencies via:
$ (venv) pip install -r requirements.txt
- Run script via:
$ (venv) python src/<project name>.py <arguments>
Where <project name>
is name of the project (defined in name column in Project modules table).
NOTE: If
python
command not working in UNIX-like shells (ex. ZSH), try run viapython3
command.
Make sure you have required permissions:
$ sudo chmod +x exec/prepare
$ sudo chmod +x exec/run
- Prepare virtual environment and install dependencies via:
$ exec/prepare
- Run via:
$ exec/run <project name> <additional arguments>
Where <project name>
is name of the project (defined in name column in Project modules table).
To create migration template file (in UNIX environments), type:
$ sudo chmod +x exec/create-migration
$ exec/create-migration <migration name> <pipeline> <author>
where:
<migration name>
is the self descriptive name of the migration file,<pipeline>
is one of the migration base directory (see--pipeline
argument fordb_migrator
project),<author
is migration author persisted in DB. By default, gets author from git propertyuser.name
. Not required.
This script will automatically created new migration template with current date, incremented migration number and base
migration script copied from migrations/template.yml
file.
- For
packages_grabber
project:
--repo (required) // Github repository name and organization: owner/name.
- For
db_migrator
project:
--pipeline (required) // Determine from which directory migrator execute migrations (take: 'infra' and 'self').
// Used for separate migration executions for JWizard Tools and JWizard Infra (Core and API).
- For
cache_version
project:
--repo (required) // Github repository name and organization: owner/name.
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.