Skip to content

Automation scripts, statistical analysis. Used in CI/CD pipelines and standalone JWizard runtime environments.

License

Notifications You must be signed in to change notification settings

jwizard-bot/jwizard-tools

Repository files navigation

[About project]

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.

Table of content

Project modules

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.

Clone and install

  1. Make sure you have at least Python 3 (tested on 3.14) at your machine.
  2. Clone this repository via:
$ git clone https://github.com/jwizard-bot/jwizard-tools
  1. Create .env file based example.env with following properties:
ENV_VAULT_TOKEN=<token>
  1. Prepare Python virtual environment via:
$ python -m venv .venv
  1. 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.

  1. Install project-related dependencies via:
$ (venv) pip install -r requirements.txt
  1. 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 via python3 command.

Alternative, only for UNIX environments:

Make sure you have required permissions:

$ sudo chmod +x exec/prepare
$ sudo chmod +x exec/run
  1. Prepare virtual environment and install dependencies via:
$ exec/prepare
  1. Run via:
$ exec/run <project name> <additional arguments>

Where <project name> is name of the project (defined in name column in Project modules table).

Create migration

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 for db_migrator project),
  • <author is migration author persisted in DB. By default, gets author from git property user.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.

Project arguments

  • 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.

License

This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.

About

Automation scripts, statistical analysis. Used in CI/CD pipelines and standalone JWizard runtime environments.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  
  •