DEPLOYMENT_TESTING.md raw

Deployment Testing

This directory contains tools for testing the ORLY deployment script to ensure it works correctly across different environments.

Test Scripts

Local Testing (Recommended)

./scripts/test-deploy-local.sh

This script tests the deployment functionality locally without requiring Docker. It validates:

Docker Testing

./scripts/test-deploy-docker.sh

This script creates a clean Ubuntu 22.04 container and tests the full deployment process. Requires Docker to be installed and accessible.

If you get permission errors, try:

sudo ./scripts/test-deploy-docker.sh

Or add your user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

Docker Files

scripts/Dockerfile.deploy-test

A comprehensive Docker image that:

.dockerignore

Optimizes Docker builds by excluding unnecessary files like:

Test Coverage

The tests validate all aspects of the deployment script:

  1. Environment Setup

- Go installation detection - Directory creation - Environment file generation - Shell configuration

  1. Dependency Management

- Go download URL validation - Build dependency scripts - Web UI build process

  1. System Integration

- Systemd service creation - Capability setting for port 443 - Binary installation - Security hardening

  1. Error Handling

- Invalid directory detection - Missing file validation - Permission checks - Network accessibility

Usage Examples

Quick Validation

# Test locally (fastest)
./scripts/test-deploy-local.sh

# View the generated report
cat deployment-test-report.txt

Full Environment Testing

# Test in clean Docker environment
./scripts/test-deploy-docker.sh

# Test with different architectures
docker build --platform linux/arm64 -f scripts/Dockerfile.deploy-test -t orly-deploy-test-arm64 .
docker run --rm orly-deploy-test-arm64

CI/CD Integration

# In your CI pipeline
./scripts/test-deploy-local.sh || exit 1
echo "Deployment script validation passed"

Troubleshooting

Docker Permission Issues

# Add user to docker group
sudo usermod -aG docker $USER
newgrp docker

# Or run with sudo
sudo ./scripts/test-deploy-docker.sh

Missing Dependencies

# Install curl for URL testing
sudo apt install curl

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Build Test Failures

The build test may be skipped if:

This is normal for testing environments and doesn't affect deployment validation.

Test Reports

Both test scripts generate detailed reports:

Reports include:

Integration with Deployment

These tests are designed to validate the deployment script before actual deployment:

# 1. Test the deployment script
./scripts/test-deploy-local.sh

# 2. If tests pass, deploy to production
./scripts/deploy.sh

# 3. Configure and start the service
export ORLY_TLS_DOMAINS=relay.example.com
sudo systemctl start orly

The tests ensure that the deployment script will work correctly in production environments.