Downloads

Download Docker Compose Template for ColdFusion + MySQL + Nginx

This downloadable package is a production-ready Docker Compose template that wires up ColdFusion (CFML), MySQL, and Nginx into a cohesive, containerized stack. It’s designed to help developers get a fast, secure, and maintainable application environment running in minutes—ideal for local development, staging, demos, and even small-scale production deployments.


Overview

The template combines three services: a CFML application server, a MySQL 8 database, and Nginx as a Reverse proxy and static asset accelerator. It provides sane defaults for Security, Performance, and maintainability, and includes environment-based Configuration so you can adjust settings without editing the core compose file. You’ll find optional Features for HTTPS/SSL, health checks, persistent volumes, and tunable parameters that work across Linux, macOS, and Windows (including WSL2).


What You’ll Get

  • Core files:
    • docker-compose.yml: Orchestrates ColdFusion (default: Lucee via CommandBox), MySQL 8, and Nginx.
    • .env.example: Environment variables for secrets and Configuration (copy to .env).
    • nginx/conf.d/site.conf: Reverse proxy, gzip, caching, and Security headers.
    • app/: Sample CFML app skeleton (webroot, Application.cfc, health endpoint).
    • db/init/: Optional SQL init scripts for schema and seed data.
    • scripts/: Helper scripts for backups, restore, and permissions.
  • Optional variants and examples:
    • Commented service for Adobe ColdFusion (swap if you have a license).
    • certbot add-on instructions for Let’s Encrypt SSL/TLS.
    • Healthcheck examples for app and DB.
  • Documentation:
    • Quick-start README with step-by-step setup.
    • Configuration notes: environment variables, ports, volumes, and Scaling tips.

Included code examples are ready to run, with inline comments to guide you as you adapt the stack to your project.

See also  Download ColdFusion Dockerfile and CommandBox Starter Pack

Supported Environments and Requirements

  • Operating systems:
    • Linux, macOS, Windows 10/11 (with Docker Desktop; WSL2 recommended on Windows).
  • Prerequisites:
    • Docker Engine 20+ and Docker Compose v2.
    • 4 GB RAM minimum recommended for comfortable local use.
    • Open ports: 80/443 for HTTP/HTTPS; 3306 if you access MySQL directly.
  • CFML engines:
    • Default: Lucee via CommandBox (open-source, fast startup).
    • Optional: Adobe ColdFusion images (licensed; uncomment in compose file).

Benefits

  • Rapid setup: From Download to running stack in minutes—no manual web server or DB installs.
  • Reproducible environments: Unified configuration via docker-compose.yml and .env.
  • Performance: Nginx reverse proxy, connection pooling, gzip, and optional caching.
  • Security-first defaults: Strong MySQL credentials, non-root containers, and TLS option.
  • Portability: Works for local development, staging servers, and CI/CD pipelines.

How to Use

1) Download and Unpack

  • Download the ZIP archive named: coldfusion-mysql-nginx-compose.zip.
  • Extract to a project folder, for example: my-cfml-stack/.

2) Configure Environment Variables

  • Copy .env.example to .env and set values:
    • MYSQL_ROOT_PASSWORD=strong-root-password
    • MYSQL_DATABASE=appdb
    • MYSQL_USER=appuser
    • MYSQL_PASSWORD=strong-user-password
    • CF_ADMIN_PASSWORD=strong-cfml-admin-pass
    • VIRTUAL_HOST=your-domain.com (if using HTTPS/production)
  • Tip: Keep the .env file out of Version control. Use Docker secrets or your CI/CD vault for production secrets.

3) Review docker-compose.yml (Highlights)

The compose file defines three main services:

  • db (MySQL 8)
    • Persists data to a named volume (db_data).
    • Health check ensures app waits for DB readiness.
  • app (CFML server)
    • Default engine: Lucee via CommandBox on port 8080.
    • Shares application files via volume mount ./app.
    • Reads DB credentials from environment variables.
  • web (Nginx)
    • Listens on ports 80 (and optionally 443).
    • Proxies dynamic requests to app:8080.
    • Serves static assets with caching and gzip where applicable.

Note: The compose includes a commented adobe-cf service. Replace or uncomment if you prefer Adobe ColdFusion.


4) Configure Nginx

  • Edit nginx/conf.d/site.conf to align with your domain and desired caching rules.
  • Out of the box:
    • Static assets (css/js/images/fonts) are cached.
    • Security headers (X-Frame-Options, X-Content-Type-Options) are preconfigured.
    • Proxy timeouts and buffers are tuned for CFML responses.

5) Initialize the Database (Optional)

  • Place any SQL scripts in db/init/. MySQL will execute them at first run.
  • To seed data later: docker exec -i mysql -uappuser -p$MYSQL_PASSWORD appdb < seed.sql
See also  Download ColdFusion Datasource Templates (MySQL SQL Server PostgreSQL)

6) Start the Stack

  • From the project root:
    • docker compose up -d
  • Verify containers:
    • docker compose ps
    • docker compose logs -f app
  • Access your app:
    • http://localhost (or your server IP)
    • Nginx proxies to the CFML server at app:8080

7) ColdFusion/Lucee Administration

Security note: For production, restrict or disable public access to the admin endpoints and use IP whitelisting or container-level network isolation.


8) Enable HTTPS (Optional)

  • Option A: Self-signed certificates
    • Place cert and key in nginx/certs/, update site.conf, and expose port 443.
  • Option B: Let’s Encrypt (certbot)
    • Use the provided instructions to run a certbot sidecar or integrate an automated certificate renewal workflow.
    • Update Nginx config to point to the issued certificates.
  • Always redirect HTTP to HTTPS for public deployments.

9) Stopping, Rebuilding, and Updating

  • Stop: docker compose down
  • Rebuild after changes: docker compose up -d –build
  • Clean volumes (careful: removes data): docker compose down -v
  • Update images: docker compose pull && docker compose up -d

Best practices

  • Use persistent volumes for MySQL and application assets.
  • Keep .env private; inject secrets via CI/CD or Docker secrets in production.
  • Configure healthchecks so services start in the correct order.
  • Tune MySQL (InnoDB buffers, connection limits) for workload patterns.
  • Employ Nginx caching for static files and enable gzip/brotli where suitable.
  • Set CFML server memory (JAVA_OPTS) and enable application caching for ORM or frequently used queries.
  • Monitor with container logs and optionally add Prometheus/Grafana for metrics.
  • For Scaling, use multiple app replicas behind Nginx and sticky sessions or session storage (Redis) if needed.

Benefits and Use Cases

  • Rapid Prototyping: Spin up a containerized ColdFusion stack in minutes.
  • Team Onboarding: Standardized Docker Compose workflow reduces “works on my machine” issues.
  • Staging and demos: Match production-like Infrastructure for realistic testing.
  • CI/CD pipelines: Compose files integrate cleanly with GitHub Actions, GitLab CI, or Jenkins.
  • Performance and stability: Offload static content to Nginx, keep MySQL data persistent, and manage the CFML server lifecycle predictably.
See also  Download CFImage Watermark & Thumbnail Scripts for ColdFusion

This resource saves time by eliminating manual Server setup, reduces configuration drift via code-as-Infrastructure, and improves performance with a properly tuned reverse proxy and database baseline.


Key Takeaways

  • A ready-to-run Docker Compose template for ColdFusion (Lucee or Adobe CF), MySQL 8, and Nginx.
  • Secure by default with environment variables, health checks, and persistent volumes.
  • Flexible: supports HTTPS, initialization scripts, and production-friendly tuning.
  • Ideal for local dev, staging, and small production environments where reproducibility matters.

FAQ

How do I switch from Lucee to Adobe ColdFusion?

Uncomment the adobe-cf service in docker-compose.yml and comment out the default app service. Provide any required Adobe CF environment variables (admin password, license key if needed). Rebuild with docker compose up -d –build. Update Nginx upstream if the internal port differs.

Can I scale the CFML app horizontally?

Yes. Use docker compose up -d –scale app=3 and configure Nginx to load-balance to the app service upstream. For session persistence, enable sticky sessions at Nginx or use centralized session storage (e.g., Redis) to avoid user session loss during failover.

How do I enable HTTPS with Let’s Encrypt?

Add the certbot container (instructions included in the package), validate domain ownership, and mount the issued certificates into the Nginx container. Update nginx/conf.d/site.conf to reference the cert and key paths, and redirect HTTP to HTTPS.

Will my MySQL data persist across container rebuilds?

Yes, the MySQL service uses a named volume (db_data). This volume persists data across restarts and rebuilds. Only docker compose down -v or explicit volume removal will delete the data. Always back up before destructive operations.

Is this template compatible with Windows and WSL2?

Absolutely. It works on Windows via Docker Desktop and is optimized for WSL2. For best file I/O performance, keep the project inside the Linux filesystem (e.g., /home//projects) rather than the Windows-mounted drive.

About the author

Aaron Longnion

Aaron Longnion

Hey there! I'm Aaron Longnion — an Internet technologist, web software engineer, and ColdFusion expert with more than 24 years of experience. Over the years, I've had the privilege of working with some of the most exciting and fast-growing companies out there, including lynda.com, HomeAway, landsofamerica.com (CoStar Group), and Adobe.com.

I'm a full-stack developer at heart, but what really drives me is designing and building internet architectures that are highly scalable, cost-effective, and fault-tolerant — solutions built to handle rapid growth and stay ahead of the curve.