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 |
|---|---|
| cache_version | Update deployment cache (project version and time) in DB. |
| db_migrator | Database migrator framework, modifying structure and data via YAML files with SQL content. |
| packages_grabber | Parsing and persisting packages used in all JWizard projects. |
| project_analyzer | Statistical analysis of repo (count of files, count of all lines, etc.). |
| remote_invoker | Deploy, spawn/kill processes on remote hosts (used in CI/CD pipelines). |
- 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
.envfile basedexample.envwith following properties:
JWIZARD_VAULT_TOKEN=<token>
JWIZARD_PROXY_VERIFICATION_TOKEN=<proxy server verification token (prevent JS challenge)>
# only for remote_invoker.py script
JWIZARD_SSH_HOST=<SSH host (or ip address)>
JWIZARD_SSH_PORT=<SSH port>
JWIZARD_SSH_USERNAME=<SSH username>
JWIZARD_SSH_KEY=<SSH private key, as raw string without any \n or \r characters>
JWIZARD_SSH_PASSPHRASE=<SSH key passphrase (required keys with passphrase)>
JWIZARD_SSH_OUTPUT_PATH_PREFIX=<prefix, where located artifacts on remote server>
JWIZARD_APP_CONFIG_FILE_CONTENT=<optional, config file content adding to executable process>- 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.ps1Tip
If you have an execution policy error, try to execute
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser in PowerShell.
Tip
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).
Tip
If python command not working in UNIX-like shells (ex. ZSH), try run via python3 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--pipelineargument fordb_migratorproject),<authoris 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_grabberproject:
--repo (required) // Github repository name and organization: owner/name.
--dir (not required) // Running repository directory (by default "/" - root directory)
- For
db_migratorproject:
--pipeline (required) // Determine from which directory migrator execute migrations (take:
// 'infra', 'self' and 'management'). Used for separate migration
// executions for JWizard Tools, JWizard Infra (Core and API) and JWizard
// management.
- For
cache_versionproject:
--repo (required) // Github repository name and organization: owner/name.
- For
project_analyzerproject:
--repo (required) // Github repository name and organization: owner/name.
- For
remote_invokerproject:
--name (required) // Project identificator (without "jwizard" prefix).
--inputDir (required) // Input directory with pre-compiled files.
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.