Add database management recipes for PostgreSQL and MySQL

This commit is contained in:
sHa
2025-09-26 21:57:49 +03:00
parent 897093f744
commit f520996be9
5 changed files with 559 additions and 68 deletions

View File

@@ -8,6 +8,7 @@ This repository contains reusable Just recipes for:
- **Container operations**: start, stop, restart, logs, shell, exec, status
- **Registry authentication**: login, logout, status checks for GitHub Container Registry
- **Image operations**: build, push, pull, tag, test, info, clean
- **Database operations**: PostgreSQL and MySQL database management
## Usage
@@ -21,29 +22,56 @@ Import in your `justfile`:
```bash
# Import universal commands
import 'just-commons/container.just'
import 'just-commons/registry.just'
import 'just-commons/images.just'
import 'just-commons/core.just' # Core utilities
import 'just-commons/container.just' # Container operations
import 'just-commons/registry.just' # Registry authentication
import 'just-commons/images.just' # Image operations
# Your project-specific commands
import 'just/postgres.just'
import 'just/servapp.just'
# Import database commands (optional)
import 'just-commons/postgres.just' # PostgreSQL operations
import 'just-commons/mysql.just' # MySQL operations
```
## Files
### Core Files
- `core.just` - Core utilities (_detect_runtime, _detect_compose, env-check)
- `container.just` - Universal container operations (start, stop, logs, shell, exec, status)
- `registry.just` - GitHub Container Registry authentication
- `images.just` - Universal image build/push/pull operations
- `registry.just` - GitHub Container Registry authentication (registry-login, registry-logout, registry-check)
- `images.just` - Universal image operations (image-build, image-push, image-pull, image-tag, etc.)
### Database Files (Optional)
- `postgres.just` - PostgreSQL operations (postgres-sql, postgres-check, postgres-list-databases, etc.)
- `mysql.just` - MySQL operations (mysql-sql, mysql-check, mysql-list-databases, etc.)
### Command Structure
- **Container commands**: No prefix (start, stop, logs, shell, exec, status, restart)
- **All other commands**: Prefixed by file type (image-*, registry-*, postgres-*, mysql-*)
### Usage Examples
```bash
# Container operations (no prefix)
just start postgres
just logs postgres
just shell postgres
# Image operations (image- prefix)
just image-build postgres
just image-push postgres v1.0.0
# Registry operations (registry- prefix)
just registry-login
just registry-check
# Database operations (database- prefix)
just postgres-sql "SELECT version();"
just postgres-check
just mysql-sql "SELECT VERSION();"
```
## Requirements
- Just command runner
- Docker or Podman
- Git
## Projects Using This
- [servass](https://github.com/shadoll/servass) - Universal container image management
- [servass_sh](https://github.com/shadoll/servass_sh) - Production deployment (SH)
- [servass_ri](https://github.com/shadoll/servass_ri) - Production deployment (RI)