main
### Added
- **List Mode**: New `list` command to display all pods with their containers, status, and images
- Shows both expected and actual container images
- Displays real-time pod and container status from Podman
- Provides comprehensive overview of deployment state
- **Prune Mode**: New `prune` command for image cleanup
- Uses `podman image prune -a` to remove all unused images
- Helps maintain clean container environment
- Optimizes disk space usage
### Improved
- **Code Optimization**
- Consolidated duplicate container argument building logic into reusable `build_container_args` function
- Optimized string operations in `generate_pod_command` using format! and push_str
- Removed unused description parameters from command execution functions
- Improved memory efficiency by reducing string allocations
- **Upgrade Intelligence**
- Enhanced image comparison logic with registry prefix normalization
- Handles docker.io/library/ and docker.io/ prefixes automatically
- Skips unnecessary upgrades when container images are already up-to-date
- Improved upgrade detection accuracy
- **Performance Enhancements**
- Streamlined command generation functions
- Reduced redundant string operations
- Optimized container creation workflow
- More efficient error handling patterns
### Fixed
- Container image inspection now uses correct format template `{{.Config.Image}}`
- Improved image tag comparison for upgrade decisions
- Better handling of registry prefix variations in image names
### Documentation
- Updated README.md with complete mode documentation including new `list` and `prune` commands
- Corrected command syntax examples to reflect actual usage
- Added comprehensive examples for all available modes
- Enhanced feature descriptions and usage guidelines
Podman Deploy
A Rust-based deployment tool for managing Podman containers and pods with configuration-driven setup.
Features
- Automated Podman Installation: Automatically detects and installs Podman on Ubuntu/Debian, Fedora/RedHat, and ArchLinux systems
- Configuration-Driven: Use YAML configuration files to define applications, pods, containers, and their properties
- Private Registry Support: Built-in support for private container registries with authentication
- Pod Management: Create, start, stop, and manage Podman pods with multiple containers
- Container Lifecycle: Full container lifecycle management including upgrades and image pulling
- Mount Management: Automatic creation of host mount directories and files
- Port Mapping: Configure port exposures at the pod level
- Flexible Configuration: Support for custom configuration file locations
Installation
Prerequisites
- Rust (latest stable version)
- Linux operating system (Ubuntu/Debian, Fedora/RedHat, or ArchLinux)
- sudo privileges (for Podman installation)
Building from Source
git clone <repository-url>
cd podman_deploy
cargo build --release
The binary will be available at target/release/podman_deploy.
Usage
Basic Syntax
podman_deploy <mode> [container_name/pod_name]
Modes
setup: Install podman, create directories, create pods, pull images, and stop containers/podslist: List all pods with their containers, status, and imagesprune: Prune unused and untagged imagesupgrade: Check container image versions and upgrade if needed for all containersupgrade <container_name>: Check and upgrade specific container if neededstart: Start all podsstart <pod>: Start specific podstop: Stop all podsstop <pod>: Stop specific pod
Examples
# Initial setup
podman_deploy setup
# List all pods and containers with status
podman_deploy list
# Prune unused images
podman_deploy prune
# Start all pods
podman_deploy start
# Start specific pod
podman_deploy start web-pod
# Stop all pods
podman_deploy stop
# Stop specific pod
podman_deploy stop database-pod
# Upgrade all containers
podman_deploy upgrade
# Upgrade specific container
podman_deploy upgrade nginx-container
Configuration
Config File Locations
The application searches for configuration files in the following order:
- Custom path specified with
--configoption ~/.config/podman_deploy/config.yaml/etc/podman_deploy/config.yaml./config.yaml(current directory)
Configuration Format
application_name: "My Podman Application"
is_podman_installed: false
data_path: "./podman-data"
pods:
- name: "web-pod"
containers:
- name: "nginx-container"
image: "nginx:1.21"
mounts:
- "/var/www/html:/usr/share/nginx/html"
- "/var/log/nginx:/var/log/nginx"
env_vars:
NGINX_HOST: "localhost"
NGINX_PORT: "80"
ports:
- "80:80"
- "443:443"
private_registry: "registry.example.com:5000"
registry_username: "myuser"
registry_password: "mypassword"
Configuration Parameters
application_name: Name of your applicationis_podman_installed: Boolean flag indicating if Podman is installeddata_path: Directory where container data will be storedpods: Array of pod definitionsname: Pod namecontainers: Array of container definitionsname: Container nameimage: Container image (e.g., "nginx:1.21")mounts: Array of mount strings in format "host_path:container_path"env_vars: Key-value pairs of environment variablesports: Array of port mappings in format "host_port:container_port"
private_registry: Optional private registry URLregistry_username: Optional registry usernameregistry_password: Optional registry password
Data Management
The application automatically creates the data directory structure based on your configuration. All host mount paths are created within the data_path directory, ensuring organized data storage.
Mount Path Creation
- Directories are created for mount paths that don't contain file extensions
- Empty files are created for mount paths that appear to be files (contain extensions like .conf, .log, etc.)
- All paths are prefixed with the
data_pathconfiguration value
Private Registry Support
If a private registry is configured, the application will:
- Check if you're already logged in to the registry
- Attempt automatic login using provided credentials
- Display manual login instructions if credentials are not provided
Error Handling
The application provides comprehensive error handling with descriptive messages for:
- Missing or invalid configuration files
- Podman installation failures
- Pod and container creation issues
- Image pulling problems
- Registry authentication failures
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
For issues and questions, please open an issue in the project repository.
Description
Install podman, create pods, containers. Help is start, stop, and upgrade of containers
Langue
Rust
100%