This directory contains the Docker configuration representing a provisioned instance - the state of a VM after provisioning but before configuration in the deployment lifecycle.
This Docker configuration provides an Ubuntu 24.04 container that simulates a freshly provisioned VM:
- SSH Server: For Ansible connectivity (via supervisor)
- Base System: Clean Ubuntu 24.04 LTS installation
- Sudo User:
torrustuser with passwordless sudo access - Network Access: For package downloads during configuration phase
- No App Dependencies: Docker, Docker Compose, etc. not yet installed (that's the configure phase)
Dockerfile: Main container configuration for provisioned instance statesupervisord.conf: Supervisor configuration for SSH service managemententrypoint.sh: Container initialization scriptREADME.md: This documentation file
This container represents the provisioned state in the deployment lifecycle:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Provision │───▶│ Configure │───▶│ Release │───▶│ Run │
│ │ │ │ │ │ │ │
│ • VM Created │ │ • Install Docker│ │ • Deploy Apps │ │ • Start Services│
│ • SSH Ready │ │ • Install Deps │ │ • Config Files │ │ • Validate │
│ • User Setup │ │ • System Config │ │ • Certificates │ │ • Monitor │
└─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
▲
THIS CONTAINER
Future Expansion: Additional containers can represent later phases:
docker/configured-instance/- After Ansible configurationdocker/released-instance/- After application deployment
From the project root directory:
# Build the provisioned instance Docker image
docker build -f docker/provisioned-instance/Dockerfile -t torrust-provisioned-instance:latest .# Run provisioned instance container with SSH access
docker run -d \
--name torrust-provisioned \
-p 2222:22 \
torrust-provisioned-instance:latest# Connect using password authentication (initial setup)
sshpass -p "torrust123" ssh -p 2222 -o StrictHostKeyChecking=no torrust@localhost
# Or copy SSH key and use key authentication
sshpass -p "torrust123" scp -P 2222 -o StrictHostKeyChecking=no fixtures/testing_rsa.pub torrust@localhost:~/.ssh/authorized_keys
ssh -i fixtures/testing_rsa -p 2222 -o StrictHostKeyChecking=no torrust@localhostThe provisioned instance container simulates the state after VM provisioning and is designed for E2E configuration testing:
- Container Lifecycle: Tests manage container creation and cleanup
- SSH Authentication: Initial password authentication (
torrust:torrust123) - SSH Key Setup: Tests copy SSH public key during setup phase
- Port Mapping: SSH port (22) is mapped to host for Ansible connectivity
- Inventory Generation: Container IP is added to Ansible inventory
- Username:
torrust(matches LXD VM configuration) - Password:
torrust123(for initial SSH access) - Groups:
sudo - Shell:
/bin/bash - Sudo: Passwordless sudo access (
NOPASSWD:ALL) - SSH: Password authentication enabled initially, key-based authentication supported
- Port: 22 (standard SSH port)
- Authentication: Password authentication enabled (
torrust123) - Public Key: Key-based authentication supported (tests copy public key)
- Root Login: Disabled
- Process Manager: Supervisor instead of systemd (container-friendly)
- Services: SSH service managed by supervisor
- Logging: Supervisor handles service logging
- No Privileges: No
--privilegedflag required
- Docker installed on the build system
- Project repository with
fixtures/testing_rsa.pubfile
- Docker installed on the system
- No special privileges required (no
--privilegedflag needed) - SSH client for connectivity testing
- Check if Docker daemon is running
- Verify no port conflicts on port 2222
- Check container logs:
docker logs <container-name>
- Verify SSH port mapping:
-p 2222:22 - Test password authentication:
sshpass -p "torrust123" ssh -p 2222 torrust@localhost - Check if SSH service is running inside container
- Verify container is accessible:
docker exec -it <container-name> bash
- Ensure public key is copied correctly to container
- Verify SSH key file permissions (should be 600)
- Check authorized_keys file in container:
~/.ssh/authorized_keys
This container configuration supports the E2E test split architecture:
┌─────────────────────────────────────────┐
│ E2E Config Tests Binary │
│ │
│ ┌─────────────────────────────────────┐│
│ │ Docker Container ││
│ │ ┌─────────────────────────────────┐││
│ │ │ Ubuntu 24.04 LTS │││
│ │ │ - SSH Server (port 22) │││
│ │ │ - Supervisor (process mgmt) │││
│ │ │ - torrust user (sudo access) │││
│ │ │ - Package management (apt) │││
│ │ └─────────────────────────────────┘││
│ └─────────────────────────────────────┘│
│ ▲ │
│ │ SSH (port 2222) │
│ ▼ │
│ ┌─────────────────────────────────────┐│
│ │ Ansible Client ││
│ │ - install-docker.yml ││
│ │ - install-docker-compose.yml ││
│ │ - Dynamic inventory generation ││
│ └─────────────────────────────────────┘│
└─────────────────────────────────────────┘