stb
A universal tool for local microservice management
Requirements
Installation
pipx install stb-mnt
Usage
Setup
- To download and setup my_company/backend/service1 microservice as a subdirectory to the current working directory, use:
stb setup my_company/backend/service1
- To download and setup my_company/backend/service1 and my_company/backend/service2 as subdirectories to current working directory, use:
stb setup my_company/backend/service1 my_company/backend/service2
- To setup all backend services, use:
stb setup my_company/backend
Note that if you want to clone repositories, you must first set a git_url using stb config set git_url command
Update
- To update .env file in accordance with .env.example in a microservice:
stb update env
- To synchronize service ports between all installed microservices (you can specify which ones will run locally with the
--localoption):
stb update ports
- To update poetry.lock file, install dependencies, stash current changes, checkout to master, pull from remote, and recreate databases:
stb update package -piucd
or
stb update package --pull --update --checkout --reset-databases
DB
- To upgrade migrations in a microservice:
stb db upgrade
- To create databases and upgrade its migrations in a microservice:
stb db create
- To drop databases in a microservice:
stb db drop
- To drop and recreate databases, and upgrade migrations in a microservice:
stb db reset
- To upgrade migrations in parallel for faster upgrades (useful for large monoliths with multiple databases), you can use the -p (--parallel) option:
stb db create -p
stb db reset -p
- To force dropping of databases in case another program is using them at the same time, you can use the -f (--force) option:
stb db drop -f
stb db reset -f
Use
stb use allows you to take a company private package and install either a cloud version or a local version of it. STB will preserve all extras, automatically set package source, and will gracefully handle any issues that might happen while updating.
- To install a local version of
my_packagethat is located at../my_package:
stb use ../my_package
- To install a local version of
my_packagethat is located at../my_packagein editable mode:
stb use ../my_package --editable
- To install a cloud version of
my_packagewith tag8.3.1:
stb use "my_package==8.3.1"
- To install a cloud version of my_package with tag
8.3.1, my_other_package with any tag higher than1.2.3, and my_third_package with any tag more than or equal to4.5.6and less than5.0.0:
stb use "my_package==8.3.1" "my_other_package>1.2.3" "my_third_package^4.5.6"
Run
- To update and run the select services concurrently:
stb run service1 service2
Config
- To set a git url for cloning:
stb config set git_url git@gitlab.my_company.com
Graph
- To get a dependency graph of your microservices:
stb graph json my_company/backend/ my_company/infrastructure/
- To get a dependency graph of your microservices as an svg image (requires graphviz):
stb graph graphviz my_company/backend/ my_company/infrastructure/
In both commands above, you can use the -i argument to omit some packages and links to them from your graph. For example:
stb graph json my_company/backend/ my_company/infrastructure/ -i my_internal_package -i my_other_package
How directories are selected for update/db
For every update, you can specify:
- A microservice directory, which will cause stb to update only that microservice
- Several microservice directories, which will cause stb to update these microservices and integrate them together (for example,
update portsassigns ports to local microservices and updates their links in other microservices to match the assigned ports) - A directory with multiple microservice subdirectories inside it, which is equivalent to (2) with the list of subdirectories as arguments
- Nothing, which will choose the current working directory as the first argument and will be equivalent to (1) or (3)
Release files for stb-mnt 4.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stb_mnt-4.9.1.tar.gz | 19.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stb_mnt-4.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.1 kB
Release files / stb_mnt-4.9.1.tar.gz
| Download URL | stb_mnt-4.9.1.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7cbda6cce007db0bdccb7e6a31d906bc864f9e3e098d43f709572a1fe091c05
|
|
BLAKE2b-256 checksum How to use checksums |
a4f40c0b47666b3820d1b26658474e593a22f946fe215b257b7f8a0fcfadbc6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.5 Linux/6.0.19-4-MANJARO
|
Release files / stb_mnt-4.9.1-py3-none-any.whl
| Download URL | stb_mnt-4.9.1-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5b3d2af0bc9caa4e83038068e7e7772bd1d508e0b17404674d3690eb7e9a7f4
|
|
BLAKE2b-256 checksum How to use checksums |
884035d66f0511a1ad8d04caac5149d7eee313370d44e0e74204189eb96dc785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.5 Linux/6.0.19-4-MANJARO
|