Ansible Galaxy Docker Compose

Native Docker Compose configuration for local Galaxy server

PostgreSQL 15 Redis 7 Galaxy NG Material Design

Services

Galaxy Web UI

Web interface at http://localhost:8080

Galaxy API

REST API at http://localhost:8000/api/galaxy/

Galaxy Content

Content service at http://localhost:24816

PostgreSQL

Database at localhost:5432

Redis

Cache at localhost:6379

Galaxy Worker

Background task worker (scalable)

Quick Start

# Clone and setup
git clone https://github.com/AndrewDi/ansible-galaxy-compose.git
cd ansible-galaxy-compose

# Copy environment file
cp .env.example .env

# Create certificates directory
mkdir -p certs
python3 -c "import os; print(os.urandom(32).hex())" > certs/database_fields.symmetric.key
chmod 600 certs/database_fields.symmetric.key

# Start services
docker compose up -d

# Check status
docker compose ps

Default Ports

Service Port URL
Galaxy Web 8080 http://localhost:8080
Galaxy API 8000 http://localhost:8000/api/galaxy/
Galaxy Content 24816 http://localhost:24816/pulp/content/
PostgreSQL 5432 localhost:5432
Redis 6379 localhost:6379

Default Credentials

Username: admin

Password: admin

Configuration Files

Database Settings

POSTGRESQL_USERgalaxyDatabase username
POSTGRESQL_PASSWORDgalaxyDatabase password
POSTGRESQL_DATABASEgalaxyDatabase name
POSTGRESQL_HOSTpostgresDatabase host
POSTGRESQL_PORT5432Database port

Redis Settings

REDIS_HOSTredisRedis host
REDIS_PORT6379Redis port
REDIS_PASSWORDgalaxyRedis password

Galaxy Admin Settings

GALAXY_ADMIN_USERadminAdmin username
GALAXY_ADMIN_PASSWORDadminAdmin password

API Settings

GALAXY_API_HOSTNAMEhttp://galaxy-web.orb.localGalaxy API hostname
GALAXY_CONTENT_HOSTNAMEhttp://galaxy-web.orb.localContent hostname
CONTENT_ORIGINhttp://galaxy-web.orb.localContent origin URL
GALAXY_API_PATH_PREFIXapi/galaxyAPI path prefix

Feature Flags

GALAXY_REQUIRE_CONTENT_APPROVALTrueRequire approval before publishing
GALAXY_ENABLE_ANONYMOUS_ACCESSTrueAllow anonymous access
GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOADTrueAllow anonymous downloads
GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESSTrueAllow anonymous collection access
EE_ENABLEDFalseEnable Execution Environments
GALAXY_ENABLE_LEGACY_ROLESTrueEnable legacy roles support

Worker Scaling

WORKER_REPLICAS1Number of worker replicas

Database (DATABASES)

ENGINEdjango.db.backends.postgresqlDatabase engine
NAMEgalaxyDatabase name
USERgalaxyDatabase user
PASSWORDgalaxyDatabase password
HOSTpostgresDatabase host
PORT5432Database port
CONN_MAX_AGE0Connection lifetime (seconds)

Redis Cache

REDIS_PASSWORDgalaxyRedis password
REDIS_HOSTredisRedis host
REDIS_PORT6379Redis port
CACHE_URLredis://:galaxy@redis:6379/0Redis connection URL

Security

SECRET_KEY(from PULP_SECRET_KEY)Django secret key
ALLOWED_HOSTS*Allowed host patterns

Storage

FILE_UPLOAD_MAX_MEMORY_SIZE104857600 (100MB)Max file size in memory
DATA_UPLOAD_MAX_MEMORY_SIZE524288000 (500MB)Max data upload size

Galaxy Settings

GALAXY_API_DEFAULT_DISTRIBUTION_BASE_PATHpublishedDefault distribution path
GALAXY_API_STAGING_DISTRIBUTION_BASE_PATHstagingStaging distribution path
ANSIBLE_API_HOSTNAME(from GALAXY_API_HOSTNAME)API hostname
X_PULP_CONTENT_HOSTgalaxy-contentContent host
X_PULP_CONTENT_PORT24816Content port

Feature Flags

GALAXY_ENABLE_ANONYMOUS_ACCESSTrueEnable anonymous access
GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOADTrueAllow unauthenticated downloads
GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESSTrueAllow unauthenticated collection access
GALAXY_REQUIRE_CONTENT_APPROVALFalseRequire content approval
GALAXY_ENABLE_LEGACY_ROLESTrueEnable legacy roles
GALAXY_DYNAMIC_SETTINGSTrueEnable dynamic settings
EE_ENABLEDFalseEnable Execution Environments

ansible-galaxy Command Reference

Collection Commands

# Install a collection from Galaxy
ansible-galaxy collection install namespace.collection

# Install specific version
ansible-galaxy collection install namespace.collection:1.0.0

# Install from local file
ansible-galaxy collection install namespace-collection-1.0.0.tar.gz

# Install from custom server
ansible-galaxy collection install namespace.collection --server=http://localhost:8000

# List installed collections
ansible-galaxy collection list

# Build a collection from source
ansible-galaxy collection build

# Publish to Galaxy server
ansible-galaxy collection publish namespace-collection-1.0.0.tar.gz

# Publish to custom server
ansible-galaxy collection publish namespace-collection-1.0.0.tar.gz \
  --server=http://localhost:8000 \
  --api-key=YOUR_API_KEY

Role Commands

# Install a role from Galaxy
ansible-galaxy role install namespace.role_name

# Install specific version
ansible-galaxy role install namespace.role_name,1.2.0

# List installed roles
ansible-galaxy role list

# Remove a role
ansible-galaxy role remove namespace.role_name

Galaxy Server Commands

# Login to Galaxy
ansible-galaxy login

# Display Galaxy server status
ansible-galaxy server status

# List available servers
ansible-galaxy server list

Configuration

# Display current configuration
ansible-galaxy config view

# Get specific config value
ansible-galaxy config server_list

# Set config value (requires Ansible 2.16+)
ansible-galaxy config server_list.test.server_url http://localhost:8000
Example: Full Workflow
# 1. Build collection
ansible-galaxy collection build

# 2. Publish to local Galaxy server
ansible-galaxy collection publish galaxy_service-1.0.0.tar.gz \
  --server=http://localhost:8000 \
  --api-key=YOUR_API_KEY

# 3. Install collection
ansible-galaxy collection install galaxy_service.galaxy_service \
  --server=http://localhost:8000

# 4. Use in playbook
ansible-playbook my_playbook.yml

Storage Volumes

Volume Description
postgres_data PostgreSQL database
galaxy_api_data Galaxy artifacts, uploads, and shared data

GitHub Actions

This project includes automated workflows:

  • CI - Continuous integration testing
  • Release - Build and publish Galaxy collection
  • Scale Test - Test worker scaling capabilities
  • Pages - Deploy documentation