Andras Bacsai 7ceb124e9b feat: add validation for YAML parsing, integer parameters, and Docker Compose custom fields
This commit adds comprehensive validation improvements and DRY principles for handling Coolify's custom Docker Compose extensions.

## Changes

### 1. Created Reusable stripCoolifyCustomFields() Function
- Added shared helper in bootstrap/helpers/docker.php
- Removes all Coolify custom fields (exclude_from_hc, content, isDirectory, is_directory)
- Handles both long syntax (arrays) and short syntax (strings) for volumes
- Well-documented with comprehensive docblock
- Follows DRY principle for consistent field stripping

### 2. Fixed Docker Compose Modal Validation
- Updated validateComposeFile() to use stripCoolifyCustomFields()
- Now removes ALL custom fields before Docker validation (previously only removed content)
- Fixes validation errors when using templates with custom fields (e.g., traccar.yaml)
- Users can now validate compose files with Coolify extensions in UI

### 3. Enhanced YAML Validation in CalculatesExcludedStatus
- Added proper exception handling with ParseException vs generic Exception
- Added structure validation (checks if parsed result and services are arrays)
- Comprehensive logging with context (error message, line number, snippet)
- Maintains safe fallback behavior (returns empty collection on error)

### 4. Added Integer Validation to ContainerStatusAggregator
- Validates maxRestartCount parameter in both aggregateFromStrings() and aggregateFromContainers()
- Corrects negative values to 0 with warning log
- Logs warnings for suspiciously high values (> 1000)
- Prevents logic errors in crash loop detection

### 5. Comprehensive Unit Tests
- tests/Unit/StripCoolifyCustomFieldsTest.php (NEW) - 9 tests, 43 assertions
- tests/Unit/ContainerStatusAggregatorTest.php - Added 6 tests for integer validation
- tests/Unit/ExcludeFromHealthCheckTest.php - Added 4 tests for YAML validation
- All tests passing with proper Log facade mocking

### 6. Documentation
- Added comprehensive Docker Compose extensions documentation to .ai/core/deployment-architecture.md
- Documents all custom fields: exclude_from_hc, content, isDirectory/is_directory
- Includes examples, use cases, implementation details, and test references
- Updated .ai/README.md with navigation links to new documentation

## Benefits
- Better UX: Users can validate compose files with custom fields
- Better Debugging: Comprehensive logging for errors
- Better Code Quality: DRY principle with reusable validation
- Better Reliability: Prevents logic errors from invalid parameters
- Better Maintainability: Easy to add new custom fields in future

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 18:34:49 +01:00
2025-10-16 17:03:38 +02:00
2024-10-17 10:04:49 +02:00
2023-04-03 09:31:04 +01:00
2024-12-11 08:26:36 +01:00
2023-03-17 15:33:48 +01:00
2024-10-17 21:15:48 +02:00
2024-10-17 21:15:48 +02:00
2024-11-14 11:11:55 +01:00
2025-09-15 11:50:41 +02:00
2023-03-17 15:33:48 +01:00
2025-11-05 08:12:54 +00:00
2022-08-30 14:43:54 +02:00
2024-11-11 14:54:04 +01:00
2025-11-07 14:33:32 +01:00
2025-04-24 20:48:54 +02:00
2023-04-03 09:31:04 +01:00
2025-11-18 10:35:50 +01:00
2025-01-07 15:31:43 +01:00
2024-11-11 13:47:31 +01:00
2025-01-22 19:57:30 +01:00

Coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.

Latest Release Version Bounty Issues

About the Project

Coolify is an open-source & self-hostable alternative to Heroku / Netlify / Vercel / etc.

It helps you manage your servers, applications, and databases on your own hardware; you only need an SSH connection. You can manage VPS, Bare Metal, Raspberry PIs, and anything else.

Imagine having the ease of a cloud but with your own servers. That is Coolify.

No vendor lock-in, which means that all the configurations for your applications/databases/etc are saved to your server. So, if you decide to stop using Coolify (oh nooo), you could still manage your running resources. You lose the automations and all the magic. 🪄

For more information, take a look at our landing page at coolify.io.

Installation

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

You can find the installation script source here.

Note

Please refer to the docs for more information about the installation.

Support

Contact us at coolify.io/docs/contact.

Cloud

If you do not want to self-host Coolify, there is a paid cloud version available: app.coolify.io

For more information & pricing, take a look at our landing page coolify.io.

Why should I use the Cloud version?

The recommended way to use Coolify is to have one server for Coolify and one (or more) for the resources you are deploying. A server is around 4-5$/month.

By subscribing to the cloud version, you get the Coolify server for the same price, but with:

  • High-availability
  • Free email notifications
  • Better support
  • Less maintenance for you

Donations

To stay completely free and open-source, with no feature behind the paywall and evolve the project, we need your help. If you like Coolify, please consider donating to help us fund the project's future development.

coolify.io/sponsorships

Thank you so much!

Big Sponsors

  • 23M - Your experts for high-availability hosting solutions!
  • Algora - Open source contribution platform
  • American Cloud - US-based cloud infrastructure services
  • Arcjet - Advanced web security and performance solutions
  • BC Direct - Your trusted technology consulting partner
  • Blacksmith - Infrastructure automation platform
  • Brand.dev - API to personalize your product with logos, colors, and company info from any domain
  • ByteBase - Database CI/CD and Security at Scale
  • CodeRabbit - Cut Code Review Time & Bugs in Half
  • COMIT - New York Times awardwinning contractor
  • CompAI - Open source compliance automation platform
  • Convex - Open-source reactive database for web app developers
  • CubePath - Dedicated Servers & Instant Deploy
  • Dade2 - IT Consulting, Cloud Solutions & System Integration
  • Formbricks - The open source feedback platform
  • GoldenVM - Premium virtual machine hosting solutions
  • Hetzner - Server, cloud, hosting, and data center solutions
  • Hostinger - Web hosting and VPS solutions
  • JobsCollider - 30,000+ remote jobs for developers
  • Juxtdigital - Digital PR & AI Authority Building Agency
  • LiquidWeb - Premium managed hosting solutions
  • Logto - The better identity infrastructure for developers
  • Macarne - Best IP Transit & Carrier Ethernet Solutions for Simplified Network Connectivity
  • Mobb - Secure Your AI-Generated Code to Unlock Dev Productivity
  • PFGLabs - Build Real Projects with Golang
  • Ramnode - High Performance Cloud VPS Hosting
  • SaasyKit - Complete SaaS starter kit for developers
  • SupaGuide - Your comprehensive guide to Supabase
  • Supadata AI - Scrape YouTube, web, and files. Get AI-ready, clean data
  • Syntax.fm - Podcast for web developers
  • Tigris - Modern developer data platform
  • Tolgee - The open source localization platform
  • Ubicloud - Open source cloud infrastructure platform

Small Sponsors

OpenElements XamanApp UXWizz Evercam Imre Ujlaki jyc.dev TheRealJP 360Creators NiftyCo Dry Software Lightspeed.run LinkDr Gravity Wiz BitLaunch Best for Android Ilias Ism Formbricks Server Searcher Reshot Cirun Typebot Creating Coding Careers Internet Garden Web3 Jobs Codext Michael Mazurczak Fider Flint Paweł Pierścionek RunPod DartNode Tyler Whitesides SerpAPI Aquarela Crypto Jobs List Alfred Nutile Startup Fame Younes Barrad Jonas Jaeger Pixel Infinito Corentin Clichy Thompson Edolo Devhuset Arvensis Systems Niklas Lausch Cap-go InterviewPal

...and many more at GitHub Sponsors

Recognitions

Featured on Hacker News

Coolify - An open-source & self-hostable Heroku, Netlify alternative | Product Hunt

coollabsio%2Fcoolify | Trendshift

Core Maintainers

Andras Bacsai 🏔️ Peak
Andras Bacsai peaklabs-dev

Repo Activity

Alt

Star History

Star History Chart

Description
An open-source & self-hostable Heroku / Netlify / Vercel alternative.
Readme Apache-2.0 57 MiB
Languages
JavaScript 56.7%
PHP 32.8%
Blade 9.6%
Shell 0.7%
CSS 0.1%