# TAK Server Hybrid Docker Container This Docker container combines both the TAK server and PostgreSQL database functionality into a single container. It automatically detects and uses the latest TAK server release from the mounted volume. ## ⚠️ IMPORTANT: TAK Server Files Required **This container does NOT include TAK server files due to licensing restrictions.** You must provide your own TAK server release files obtained through proper channels: 1. Download TAK server files from the official TAK.gov website 2. Obtain through proper military/government channels 3. Purchase through authorized distributors **You must have a valid license to use TAK server software.** ## Prerequisites 1. **Valid TAK Server License**: You must have proper licensing/authorization to use TAK server 2. **TAK Server Files**: Download `takserver-docker-X.Y-RELEASE-Z.zip` from official sources 3. **Docker & Docker Compose**: Installed on your system ## Setup Instructions ### Step 1: Obtain TAK Server Files - Download the TAK server Docker release from official channels - Place the `takserver-docker-X.Y-RELEASE-Z.zip` file in the `takserver-release/` directory - The container will automatically detect and use the latest version ### Step 2: File Structure ``` /docker/services/tak/ ├── Dockerfile # Hybrid container ├── entrypoint.sh # Main container entrypoint ├── scripts/ # Helper scripts │ ├── tak-version.sh # TAK version detection │ ├── db-setup.sh # Database setup │ └── healthcheck.sh # Health monitoring ├── docker-compose.yml # Docker Compose configuration ├── README.md # This documentation ├── build.sh # Build script ├── validate.sh # Setup validation script ├── original-files/ # Original Dockerfile templates └── takserver-release/ # Place your TAK server files here └── takserver-docker-X.Y-RELEASE-Z.zip # Your TAK server files ``` ## Features - **Hybrid Architecture**: Combines TAK server and PostgreSQL database in one container - **Automatic Version Detection**: Finds the latest `takserver-docker-X.Y-RELEASE-Z.zip` file - **Semantic Versioning**: Uses semantic version sorting to determine the latest release - **Complete Setup**: Includes PostGIS extension for spatial data support - **Runtime TAK Setup**: TAK server files are processed at container startup (licensing compliant) - **User-Provided Files**: No TAK server files included in the image ## Usage ### Option 1: Using Docker Compose (Recommended) **First, ensure you have TAK server files in the correct directory:** ```bash # Verify your TAK server files ls -la takserver-release/ # Should show: takserver-docker-X.Y-RELEASE-Z.zip # Build and start the hybrid container docker-compose up -d # View logs to monitor startup docker-compose logs -f tak-hybrid # Stop the container docker-compose down ``` ### Option 2: Using Docker directly ```bash # Build the image docker build -t tak-hybrid . # Run the container (replace /path/to/tak/files with your actual path) docker run -d \ --name tak-hybrid \ -p 5432:5432 \ -p 8080:8080 \ -p 8443:8443 \ -p 8444:8444 \ -v /path/to/tak/files:/takserver-zip:ro \ -v tak-data:/opt/tak/data \ -v tak-logs:/opt/tak/logs \ tak-hybrid ``` ## TAK Server Release Files Place your TAK server release files in the `takserver-release/` directory. The container will automatically detect and use the latest version based on semantic versioning. **Supported filename format**: `takserver-docker-X.Y-RELEASE-Z.zip` Examples: - `takserver-docker-5.4-RELEASE-19.zip` - `takserver-docker-5.5-RELEASE-1.zip` - `takserver-docker-6.0-RELEASE-5.zip` ## Ports - **5432**: PostgreSQL database - **8080**: TAK server web interface (HTTP) - **8443**: TAK server web interface (HTTPS) - **8444**: TAK server certificate enrollment - **8446**: TAK server API ## Database Configuration The container automatically sets up PostgreSQL with: - Database: `cot` - User: `martiuser` - Password: `password` - PostGIS extension enabled ## Environment Variables The following environment variables can be customized in the docker-compose.yml: - `POSTGRES_DB`: Database name (default: cot) - `POSTGRES_USER`: Database user (default: martiuser) - `POSTGRES_PASSWORD`: Database password (default: password) ## Helper Scripts The container includes several helper scripts for management and troubleshooting: ### TAK Version Detection (`/scripts/tak-version.sh`) ```bash # Find latest TAK release docker exec tak-hybrid /scripts/tak-version.sh /takserver-zip latest # List all available releases docker exec tak-hybrid /scripts/tak-version.sh /takserver-zip list # Get version from specific file docker exec tak-hybrid /scripts/tak-version.sh /takserver-zip version /takserver-zip/takserver-docker-5.4-RELEASE-19.zip ``` ### Database Setup (`/scripts/db-setup.sh`) ```bash # Full database setup docker exec tak-hybrid /scripts/db-setup.sh setup # Test database connection docker exec tak-hybrid /scripts/db-setup.sh test # Print database configuration docker exec tak-hybrid /scripts/db-setup.sh config ``` ### Health Monitoring (`/scripts/healthcheck.sh`) ```bash # Run all health checks docker exec tak-hybrid /scripts/healthcheck.sh all # Check specific components docker exec tak-hybrid /scripts/healthcheck.sh postgres docker exec tak-hybrid /scripts/healthcheck.sh database docker exec tak-hybrid /scripts/healthcheck.sh tak-process ``` ## Troubleshooting ### Check container logs ```bash docker-compose logs tak-hybrid ``` ### Access the container shell ```bash docker-compose exec tak-hybrid /bin/bash ``` ### Verify PostgreSQL is running ```bash docker-compose exec tak-hybrid pg_isready -U martiuser -d cot ``` ### Check TAK server status ```bash docker-compose exec tak-hybrid ps aux | grep tak ``` ## Error Handling The container includes comprehensive error checking: ### Missing TAK Server Files ``` ERROR: No TAK server files found! Please mount a directory containing takserver-docker-X.Y-RELEASE-Z.zip files to /takserver-zip ``` **Solution**: Ensure you have properly mounted the directory containing your TAK server files. ### Invalid File Format ``` ERROR: No takserver-docker-X.Y-RELEASE-Z.zip file found in /takserver-zip/ Please ensure you have a file matching the pattern: takserver-docker-X.Y-RELEASE-Z.zip ``` **Solution**: Verify your TAK server file follows the correct naming convention. ### Licensing Compliance This container design ensures license compliance by: - **Not redistributing TAK server files** - **Requiring users to provide their own licensed files** - **Processing files only at runtime** - **Clear documentation of licensing requirements** ## Legal Notice TAK server software is subject to export control regulations and licensing requirements. Users are responsible for: - Obtaining proper licenses/authorization - Compliance with export control laws - Following all applicable regulations - Ensuring authorized use only This container does not include or redistribute any TAK server software files.