This is a simple redc compose orchestration example for deploying ECS instances on both Alibaba Cloud and Volcengine simultaneously.
Configuration file location: ~/redc/config.yaml
providers:
aliyun:
ALICLOUD_ACCESS_KEY: "Your Alibaba Cloud AccessKey"
ALICLOUD_SECRET_KEY: "Your Alibaba Cloud SecretKey"
region: "cn-hangzhou"
volcengine:
VOLCENGINE_ACCESS_KEY: "Your Volcengine AccessKey"
VOLCENGINE_SECRET_KEY: "Your Volcengine SecretKey"
region: "cn-beijing"# Download Alibaba Cloud ECS template
redc pull aliyun/ecs
# Download Volcengine ECS template (if available)
redc pull volcengine/ecs
# Initialize templates
redc initModify the following in redc-compose.yaml according to your needs:
- Instance password (
password) - Instance type (
instance_type) - Image ID (
image_id) - Region (
region)
Before actual deployment, preview the orchestration plan:
redc compose config redc-compose.yamlThis will display:
- List of services to be created
- Configuration variables for each service
- Dependencies
- Post-deployment tasks
# Execute in the directory containing redc-compose.yaml
redc compose up redc-compose.yamlExecution process:
- Create Alibaba Cloud ECS instance
- Create Volcengine ECS instance
- Wait for instances to start
- Execute initialization commands within instances
- Execute setup post-deployment tasks
# View all instance status
redc ps# Connect to Alibaba Cloud instance
redc exec <aliyun_caseid> -t bash
# Connect to Volcengine instance
redc exec <volcengine_caseid> -t bash# Execute command on Alibaba Cloud instance
redc exec <aliyun_caseid> "whoami"
# Execute command on Volcengine instance
redc exec <volcengine_caseid> "uname -a"# Destroy all instances
redc compose down redc-compose.yamlProfiles provide a service grouping/environment filtering mechanism that allows you to define multiple groups of services in a single compose file and selectively deploy them as needed.
How it works:
- Each service can be tagged with one or more groups via the
profilesfield (e.g.,prod,dev,attack) - When running
compose upwith-p <profile>, only services belonging to that profile will be deployed - Services without a
profilesfield are considered default services and will be deployed when no profile is specified - When no
-pargument is provided, all services without aprofilesfield are started
Example use cases:
| Scenario | Description |
|---|---|
| Multi-environment isolation | Define prod and dev servers in the same file, deploy one group at a time |
| On-demand scaling | Tag stress-test nodes with an attack profile, start them only when needed |
| Progressive deployment | Deploy base infrastructure first, then app layer |
Tip: If all your services should be deployed together, you don't need to set the
profilesfield or specify-p. This feature can be safely ignored. In the GUI's Compose Management page, this option is located inside the "Advanced Options" panel.
Modify the configuration file to add profiles to services:
services:
aliyun_server:
profiles:
- prod
- dev
# ... other configurations
volcengine_server:
profiles:
- prod
# ... other configurations
monitor_server:
# No profiles field → deployed by default when no -p is specified
image: ./templates/monitorStart specific environments only:
# Start only prod environment services (aliyun_server + volcengine_server)
redc compose up -f redc-compose.yaml -p prod
# Start only dev environment services (aliyun_server)
redc compose up -f redc-compose.yaml -p dev
# No profile specified, deploy all services without profiles field (monitor_server)
redc compose up -f redc-compose.yamlAdd volumes to service configuration:
services:
aliyun_server:
volumes:
- ./scripts/init.sh:/root/init.sh
- ./config/app.conf:/etc/app/config.conf
command: |
chmod +x /root/init.sh
bash /root/init.shAdd downloads to service configuration:
services:
aliyun_server:
downloads:
- /var/log/app.log:./logs/aliyun_app.log
- /root/.ssh/id_rsa.pub:./keys/aliyun_key.pubservices:
database:
image: aliyun/ecs
# ... configuration
app_server:
image: volcengine/ecs
depends_on:
- database
environment:
- db_host=${database.outputs.private_ip}
# ... configurationservices:
worker_nodes:
image: aliyun/ecs
deploy:
replicas: 3 # Create 3 instances
# ... configurationThis will automatically create: worker_nodes_1, worker_nodes_2, worker_nodes_3
Ensure templates are downloaded and initialized:
redc pull aliyun/ecs
redc pull volcengine/ecs
redc initCheck if AccessKey and SecretKey in ~/redc/config.yaml are correct.
Add --debug parameter:
redc compose up -f redc-compose.yaml --debug- Check if instance type is available in the selected region
- Check if image ID is correct
- Check if account balance is sufficient
- Use
redc compose configto preview configuration