Compose Deploy
Docker Compose deployment is ideal for applications that require multiple cooperating services, such as a web app with a database and cache. Simply provide a docker-compose.yml file, and Piora will deploy the entire stack.
Create a Compose Application
Section titled “Create a Compose Application”- Create a new application in the Piora dashboard
- Select “Docker Compose” as the deployment method
- Paste or upload your
docker-compose.yml
Example: Node.js + PostgreSQL + Redis
Section titled “Example: Node.js + PostgreSQL + Redis”version: "3.8"
services: web: image: node:20-alpine working_dir: /app volumes: - ./:/app ports: - "3000:3000" environment: DATABASE_URL: postgresql://piora:secret@db:5432/myapp REDIS_URL: redis://cache:6379 depends_on: - db - cache
db: image: postgres:16-alpine environment: POSTGRES_USER: piora POSTGRES_PASSWORD: secret POSTGRES_DB: myapp volumes: - postgres_data:/var/lib/postgresql/data
cache: image: redis:7-alpine volumes: - redis_data:/data
volumes: postgres_data: redis_data:Compose File Syntax
Section titled “Compose File Syntax”Common Settings
Section titled “Common Settings”| Setting | Description |
|---|---|
image | Docker image name and tag |
build | Build configuration from Dockerfile |
ports | Port mappings |
environment | Environment variables |
volumes | Persistent storage |
depends_on | Service startup order |
restart | Restart policy |
deploy | Deployment settings (replicas, resource limits) |
Resource Limits
Section titled “Resource Limits”You can set resource limits for each service in the Compose file:
services: web: image: node:20-alpine deploy: resources: limits: cpus: "1.0" memory: 512M reservations: cpus: "0.25" memory: 128MEnvironment Variable Management
Section titled “Environment Variable Management”Defined in the Compose File
Section titled “Defined in the Compose File”services: web: environment: - NODE_ENV=production - PORT=3000Using the Piora Dashboard
Section titled “Using the Piora Dashboard”You can also set environment variables in the Piora dashboard, which will override values defined in the Compose file. This is especially useful for sensitive information that varies between environments.
Managing Compose Stacks
Section titled “Managing Compose Stacks”View Service Status
Section titled “View Service Status”The dashboard shows the status, logs, and resource usage of each service in the Compose stack.
Individual Service Operations
Section titled “Individual Service Operations”You can perform operations on individual services within a Compose stack:
- Restart a single service
- View service logs
- Adjust resource allocation
- Access container shell
Update the Stack
Section titled “Update the Stack”After modifying the Compose file, redeploy from the dashboard. Piora intelligently determines which services need updating, minimizing unnecessary restarts.
Common Compose Examples
Section titled “Common Compose Examples”WordPress + MySQL
Section titled “WordPress + MySQL”version: "3.8"services: wordpress: image: wordpress:6-apache ports: - "80:80" environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wp WORDPRESS_DB_PASSWORD: secret WORDPRESS_DB_NAME: wordpress volumes: - wp_data:/var/www/html db: image: mysql:8 environment: MYSQL_ROOT_PASSWORD: rootsecret MYSQL_DATABASE: wordpress MYSQL_USER: wp MYSQL_PASSWORD: secret volumes: - db_data:/var/lib/mysqlvolumes: wp_data: db_data: