rufi-cli
v1.1.3
Published
A command-line tool for managing services, database migrations, and environments in distributed or microservice-based projects.
Downloads
1
Maintainers
Readme
Rufi CLI
Rufi CLI is a command-line interface tool designed to manage and streamline the development of services. It provides commands for managing services, migrations, and database schemas, making it easier to work with distributed systems and microservices.
Features
- Clone and pull services from Git repositories.
- Manage database migrations for individual or all services.
- Reset and initialize the development environment.
- List database schemas and tables.
Installation
npm i rufi-cli -Dor
bun i -d rufi-cliBefore using it
- Make sure your
.envfile looks like this:
# Required to run the CLI (the variable names can be changed in your rufi.config)
POSTGRES_HOST="localhost"
POSTGRES_DATABASE="postgres"
POSTGRES_USER="postgres"
POSTGRES_PORT="5432"
POSTGRES_PASSWORD='super-secret-password'
ENV='development' # any other value will disable dev commands
CORE_SERVICE=core
# Required to use service:* commands
GIT_TOKEN=your-git-token
GIT_USERNAME=username- Your PostgreSQL database is running and accepting connections.
- You’re using
psql(or a Docker container with it). - You have
gitinstalled (duh).
Note: It may fail if:
- The database is not running
- Any credential is incorrect
Usage
Run the CLI commands using the rufi binary.
Initialize Configuration
Create the default configuration files (required before using the CLI):
npx rufi init --with-services [--ts]Note: The TypeScript config file is currently only used during CLI development. There’s no guarantee that it will work properly in your project. Prefer
.jsconfig files.
Clone Services
Clone all services defined in the configuration:
npx rufi service:clone --allPull Updates
Pull updates for a specific service:
npx rufi service:pull <service-name>Apply Migrations
Apply pending migrations for a specific service:
npx rufi migration:up <service-name>Reset Database
Reset the development database by dropping all schemas:
npx rufi db:resetStart Environment
Initialize the environment by cloning all services and applying migrations:
rufi startFor a full list of commands, use:
rufi --help