Commit graph

711 commits

Author SHA1 Message Date
Andras Bacsai
e930005a50 fix: handle existing webhook_notification_settings table in migration
Similar to cloud_init_scripts, this migration was renamed from 120000 to
120002 between v444 and v445, causing "duplicate table" errors for users
upgrading who already have the webhook_notification_settings table created.

Added table existence check before creation for idempotency.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 15:12:14 +01:00
Andras Bacsai
2335bfad8f fix: handle existing cloud_init_scripts table in migration
The migration file was renamed from 120000 to 120002 between v444 and v445,
causing "duplicate table" errors for users upgrading from v444 who already
have the cloud_init_scripts table created.

This fix adds a table existence check before creation, making the migration
idempotent and safe for both fresh installations and upgrades.

Fixes the error: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation
"cloud_init_scripts" already exists

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 15:08:41 +01:00
Andras Bacsai
a552cbf4de feat: auto-create MinIO bucket and validate storage in development
Add a separate minio-init container that automatically creates the 'local'
bucket when MinIO starts in development. Mark the seeded S3Storage as usable
by default so developers can use MinIO without manual validation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 17:23:00 +01:00
Andras Bacsai
6fc8570551 refactor(migration): remove unnecessary index on team_id in cloud_init_scripts table 2025-11-18 12:27:22 +01:00
Andras Bacsai
36d2c02498 refactor: move buildpack cleanup logic to model lifecycle hooks
Move buildpack switching cleanup from Livewire component to Application model's boot lifecycle. This improves separation of concerns and ensures cleanup happens consistently regardless of how the buildpack change is triggered. Also clears Dockerfile-specific data when switching away from dockerfile buildpack.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 10:29:08 +01:00
Andras Bacsai
1270136da9 merge: merge next branch into feat-traefik-version-checker
Merged latest changes from the next branch to keep the feature branch
up to date. No conflicts were encountered during the merge.

Changes from next branch:
- Updated application deployment job error logging
- Updated server manager job and instance settings
- Removed PullHelperImageJob in favor of updated approach
- Database migration refinements
- Updated versions.json with latest component versions

All automatic merges were successful and no manual conflict resolution
was required.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:56:24 +01:00
Andras Bacsai
5d73b76a44 refactor(proxy): implement centralized caching for versions.json and improve UX
This commit introduces several improvements to the Traefik version tracking
feature and proxy configuration UI:

## Caching Improvements

1. **New centralized helper functions** (bootstrap/helpers/versions.php):
   - `get_versions_data()`: Redis-cached access to versions.json (1 hour TTL)
   - `get_traefik_versions()`: Extract Traefik versions from cached data
   - `invalidate_versions_cache()`: Clear cache when file is updated

2. **Performance optimization**:
   - Single Redis cache key: `coolify:versions:all`
   - Eliminates 2-4 file reads per page load
   - 95-97.5% reduction in disk I/O time
   - Shared cache across all servers in distributed setup

3. **Updated all consumers to use cached helpers**:
   - CheckTraefikVersionJob: Use get_traefik_versions()
   - Server/Proxy: Two-level caching (Redis + in-memory per-request)
   - CheckForUpdatesJob: Auto-invalidate cache after updating file
   - bootstrap/helpers/shared.php: Use cached data for Coolify version

## UI/UX Improvements

1. **Navbar warning indicator**:
   - Added yellow warning triangle icon next to "Proxy" menu item
   - Appears when server has outdated Traefik version
   - Uses existing traefik_outdated_info data for instant checks
   - Provides at-a-glance visibility of version issues

2. **Proxy sidebar persistence**:
   - Fixed sidebar disappearing when clicking "Switch Proxy"
   - Configuration link now always visible (needed for proxy selection)
   - Dynamic Configurations and Logs only show when proxy is configured
   - Better navigation context during proxy switching workflow

## Code Quality

- Added comprehensive PHPDoc for Server::$traefik_outdated_info property
- Improved code organization with centralized helper approach
- All changes formatted with Laravel Pint
- Maintains backward compatibility

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:53:28 +01:00
Andras Bacsai
028e7cb35e fix: remove unnecessary table existence checks in migration files 2025-11-17 14:28:28 +01:00
Andras Bacsai
60ef63de54 fix: resolve duplicate migration timestamps and add idempotency guards
Two migrations had identical timestamps (2025_10_10_120000), causing non-deterministic execution order and "table already exists" errors during instance startup. Renamed webhook_notification_settings migration to 120002 and added Schema::hasTable() guards to both migrations for idempotency.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:26:42 +01:00
Andras Bacsai
6593b2a553 feat(proxy): enhance Traefik version notifications to show patch and minor upgrades
- Store both patch update and newer minor version information simultaneously
- Display patch update availability alongside minor version upgrades in notifications
- Add newer_branch_target and newer_branch_latest fields to traefik_outdated_info
- Update all notification channels (Discord, Telegram, Slack, Pushover, Email, Webhook)
- Show minor version in format (e.g., v3.6) for upgrade targets instead of patch version
- Enhance UI callouts with clearer messaging about available upgrades
- Remove verbose logging in favor of cleaner code structure
- Handle edge case where SSH command returns empty response

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 09:59:17 +01:00
Andras Bacsai
8c77c63043 feat(proxy): add Traefik version tracking with notifications and dismissible UI warnings
- Add automated Traefik version checking job running weekly on Sundays
- Implement version detection from running containers and comparison with versions.json
- Add notifications across all channels (Email, Discord, Slack, Telegram, Pushover, Webhook) for outdated versions
- Create dismissible callout component with localStorage persistence
- Display cross-branch upgrade warnings (e.g., v3.5 -> v3.6) with changelog links
- Show patch update notifications within same branch
- Add warning icon that appears when callouts are dismissed
- Prevent duplicate notifications during proxy restart by adding restarting parameter
- Fix notification spam with transition-based logic for status changes
- Enable system email settings by default in development mode
- Track last saved/applied proxy settings to detect configuration drift
2025-11-14 11:35:22 +01:00
Andras Bacsai
71c89d9ba8
Merge branch 'next' into improve-scheduled-tasks 2025-11-10 14:21:03 +01:00
Andras Bacsai
68a9f2ca77 feat: add container restart tracking and crash loop detection
Track container restart counts from Docker and detect crash loops to provide better visibility into application health issues.

- Add restart_count, last_restart_at, and last_restart_type columns to applications table
- Detect restart count increases from Docker inspect data and send notifications
- Show restart count badge in UI with warning icon on Logs navigation
- Distinguish between crash restarts and manual restarts
- Implement 30-second grace period to prevent false "exited" status during crash loops
- Reset restart count on manual stop, restart, and redeploy actions
- Add unit tests for restart count tracking logic

This helps users quickly identify when containers are in crash loops and need attention, even when the container status flickers between states during Docker's restart backoff period.
2025-11-10 13:04:31 +01:00
Andras Bacsai
b22e79caec feat(jobs): improve scheduled tasks with retry logic and queue cleanup
- Add retry configuration to CoolifyTask (3 tries, 600s timeout)
- Add retry configuration to ScheduledTaskJob (3 tries, configurable timeout)
- Add retry configuration to DatabaseBackupJob (2 tries)
- Implement exponential backoff for all jobs (30s, 60s, 120s intervals)
- Add failed() handlers with comprehensive error logging to scheduled-errors channel
- Add execution tracking: started_at, retry_count, duration (decimal), error_details
- Add configurable timeout field to scheduled tasks (60-3600s, default 300s)
- Update UI to include timeout configuration in task creation/editing forms
- Increase ScheduledJobManager lock expiration from 60s to 90s for high-load environments
- Implement safe queue cleanup with restart vs runtime modes
  - Restart mode: aggressive cleanup (marks all processing jobs as failed)
  - Runtime mode: conservative cleanup (only marks jobs >12h as failed, skips deployments)
- Add cleanup:redis --restart flag for system startup
- Integrate cleanup into Dev.php init() for development environment
- Increase scheduled-errors log retention from 7 to 14 days
- Create comprehensive test suite (unit and feature tests)
- Add TESTING_GUIDE.md with manual testing instructions

Fixes issues with jobs failing after single attempt and "attempted too many times" errors
2025-11-10 11:11:18 +01:00
Andras Bacsai
f315e4bd9c feat: add dev_helper_version to instance settings and update related functionality 2025-11-03 08:38:43 +01:00
Andras Bacsai
bf6a109e56 Changes auto-committed by Conductor 2025-10-16 13:45:49 +02:00
Andras Bacsai
d2ca20ccde Enable API by default in development mode
- API is now enabled by default when running in development mode
- Production instances keep API disabled by default (existing behavior)
- Uses isDev() helper to determine environment

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 21:34:44 +02:00
Andras Bacsai
635af44539
Merge pull request #6837 from coollabsio/andrasbacsai/custom-webhooks
feat: add custom webhook notification support
2025-10-12 10:57:47 +02:00
Andras Bacsai
95fe04c484
Merge pull request #6817 from coollabsio/hetzner-do
Hetzner integration
2025-10-11 19:23:19 +02:00
Andras Bacsai
6c0840d4e0 refactor: improve cloud-init script UX and remove description field
Changes:
1. Remove description field from cloud-init scripts
   - Updated migration to remove description column
   - Updated model to remove description from fillable array

2. Redesign script name input layout
   - Move script name input next to checkbox (always visible)
   - Remove conditional rendering - input always shown
   - Use placeholder instead of label for cleaner look

3. Fix dropdown type error
   - Replace wire:change event with wire:model.live
   - Use updatedSelectedCloudInitScriptId() lifecycle hook
   - Add "disabled" attribute to placeholder option
   - Properly handle empty string vs null in type casting

4. Improve validation
   - Require both script content AND name for saving
   - Remove description validation rule
   - Add selected_cloud_init_script_id validation

5. Auto-populate name when loading saved script
   - When user selects saved script, auto-fill the name field

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-11 11:16:28 +02:00
Andras Bacsai
7061eacfa5 feat: add cloud-init script support for Hetzner server creation
This commit adds the ability to use cloud-init scripts when creating Hetzner servers through the integration. Users can write custom scripts that will be executed during server initialization, and optionally save these scripts at the team level for future reuse.

Key features:
- Textarea field for entering cloud-init scripts (bash or cloud-config YAML)
- Checkbox to save scripts for later use at team level
- Dropdown to load previously saved scripts
- Scripts are encrypted in the database
- Full validation and authorization checks
- Comprehensive unit and feature tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 19:37:16 +02:00
Andras Bacsai
36573ecbf0 fix: use correct property declaration for withinTransaction
The parent Migration class defines $withinTransaction without a type
hint. Setting it without redeclaring (no "bool" type) avoids the PHP
8.4 error: "Type of Migration::$withinTransaction must not be defined"

This is the proper Laravel way to disable transactions for migrations
that need to run CREATE INDEX CONCURRENTLY in PostgreSQL.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 18:41:33 +02:00
Andras Bacsai
e256e765e7 fix: properly handle transaction for concurrent index operations
Instead of redefining the $withinTransaction property (which causes
a type error), we now manually commit the transaction before running
CREATE INDEX CONCURRENTLY and begin a new transaction afterward.

This ensures PostgreSQL can execute the concurrent index operations
while maintaining transaction safety for subsequent migrations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 18:39:40 +02:00
Andras Bacsai
9c2ef0aa21 fix(migration): disable transaction for concurrent index creation
PostgreSQL does not allow CREATE INDEX CONCURRENTLY to run inside a
transaction block. This migration now sets $withinTransaction = false
to allow the concurrent index creation to succeed.

Fixes the error: "CREATE INDEX CONCURRENTLY cannot run inside a
transaction block" when running migrations in dev environment.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 18:31:39 +02:00
Andras Bacsai
22ef6c8c9a fix: add missing server_patch_webhook_notifications field
Add the server_patch_webhook_notifications column to both
the create and populate migrations to match the model and
Livewire component expectations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 17:52:07 +02:00
Andras Bacsai
53d1ad48cd fix: populate webhook notification settings for existing teams
Add migration to create webhook notification settings records
for all existing teams. This fixes the "unauthorized" error when
accessing the webhook notifications page for teams that existed
before the webhook feature was added.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 17:47:26 +02:00
Andras Bacsai
27879377a0 feat: add custom webhook notification support
Add basic infrastructure for custom webhook notifications:
- Create webhook_notification_settings table with event toggles
- Add WebhookNotificationSettings model with encrypted URL
- Integrate webhook settings into Team model and HasNotificationSettings trait
- Create Livewire component and Blade view for webhook configuration
- Add webhook navigation route and UI

This provides the foundation for sending webhook notifications to custom HTTP/HTTPS endpoints when events occur in Coolify.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 15:37:00 +02:00
Andras Bacsai
f4e5c195fe refactor: replace direct SslCertificate queries with server relationship methods for consistency 2025-10-09 17:00:05 +02:00
Andras Bacsai
bf5c08d071 work work on hetzner integration 2025-10-09 16:54:13 +02:00
Andras Bacsai
704ddf2968 improved hetzner features 2025-10-09 12:53:57 +02:00
Andras Bacsai
215301fa8f basics of adding / removing hetzner servers 2025-10-09 10:41:29 +02:00
Andras Bacsai
c1bcc41546 init of cloud providers 2025-10-08 20:47:50 +02:00
Andras Bacsai
2c64136503 feat(backup): enhance backup job with S3 upload handling and notifications
- Introduced a new notification class, BackupSuccessWithS3Warning, to alert users when local backups succeed but S3 uploads fail.
- Updated DatabaseBackupJob to track local backup success and handle S3 upload errors, improving error reporting and user notifications.
- Modified ScheduledDatabaseBackupExecution model to include a new s3_uploaded boolean field for tracking S3 upload status.
- Adjusted views and validation logic to reflect changes in backup execution status and S3 handling.
- Added tests to ensure the new s3_uploaded column is correctly implemented and validated.
2025-10-07 15:02:23 +02:00
Darren Sisson
fb7af48b10
update bitnami to bitnamilegacy 2025-10-03 15:48:11 +01:00
Andras Bacsai
a03c1b3b4b refactor(dashboard): remove deployment loading logic and introduce DeploymentsIndicator component for better UI management 2025-09-30 11:43:30 +02:00
Andras Bacsai
bfd5e56cc8 feat(dev-seeders): add PersonalAccessTokenSeeder to create development API tokens 2025-09-26 09:03:24 +02:00
Andras Bacsai
3f71f7becf
Merge pull request #6628 from heavygee/fix/team-invitation-email-case-sensitivity
Fix team invitation email case sensitivity bug
2025-09-25 09:29:24 +02:00
Andras Bacsai
f33df13c4e feat(environment): replace is_buildtime_only with is_runtime and is_buildtime flags for environment variables, updating related logic and views 2025-09-18 18:14:54 +02:00
Andras Bacsai
c1bee32f09 feat(deployment): introduce 'use_build_secrets' setting for enhanced security during Docker builds and update related logic in deployment process 2025-09-17 10:34:38 +02:00
GitHub Actions
c1c149968e Fix team invitation email case sensitivity bug
- Add email normalization to TeamInvitation model using setEmailAttribute()
- Add HasFactory trait to Team model for testing support
- Create TeamFactory for testing
- Add tests to verify email normalization works correctly
- Fixes issue where mixed case emails in invitations would cause lookup failures
- Resolves #6291

The bug occurred because:
1. User model normalizes emails to lowercase
2. TeamInvitation model did not normalize emails
3. When invitation was created with mixed case, it was stored as-is
4. User lookup failed due to case mismatch during invitation acceptance
5. This caused users to not be able to see teams they were invited to

This fix ensures both models normalize emails consistently.
2025-09-16 15:31:48 +01:00
Andras Bacsai
20ad2165e7 feat(environment): introduce 'is_buildtime_only' attribute to environment variables for improved build-time configuration 2025-09-11 17:38:16 +02:00
Andras Bacsai
5b3b4bbc43 refactor(environment): remove 'is_build_time' attribute from environment variable handling across the application to simplify configuration 2025-09-11 16:51:56 +02:00
Andras Bacsai
d9ebf3b142 refactor(webhook): remove Webhook model and related logic; add migrations to drop webhooks and kubernetes tables 2025-09-10 19:35:53 +02:00
Andras Bacsai
339118558c feat(settings): add option to restrict PR deployments to repository members and contributors 2025-09-05 14:30:51 +02:00
Andras Bacsai
a6fc39e798 feat(git-settings): add support for shallow cloning in application settings
- Introduced a new boolean setting `is_git_shallow_clone_enabled` to the application settings model.
- Updated the `Advanced` component to include a checkbox for enabling shallow cloning.
- Modified the `setGitImportSettings` and `generateGitImportCommands` methods to handle shallow clone logic.
- Created a migration to add the new setting to the database schema.
- Enhanced the deployment process to utilize shallow cloning for improved performance.
2025-08-21 10:16:57 +02:00
peaklabs-dev
e2fd1f4507
fix: disable env sorting by default
- this is a better default
2025-08-18 17:47:21 +02:00
Andras Bacsai
ee502b9f76 feat(email): implement email change request and verification process
- Added functionality for users to request an email change, including generating a verification code and setting an expiration time.
- Implemented methods in the User model to handle email change requests, code validation, and confirmation.
- Created a new job to update the user's email in Stripe after confirmation.
- Introduced rate limiting for email change requests and verification attempts to prevent abuse.
- Added a new notification for email change verification.
- Updated the profile component to manage email change requests and verification UI.
2025-08-18 14:54:08 +02:00
Andras Bacsai
0dada987a2 feat(backup): add disable local backup option and related logic for S3 uploads 2025-08-17 12:34:20 +02:00
Andras Bacsai
a2ef545b6b feat(changelog): implement automated changelog fetching from GitHub and enhance changelog read tracking 2025-08-12 10:07:11 +02:00
Andras Bacsai
0e7cc988a6 feat(user): add changelog read tracking and unread count method 2025-08-12 10:06:19 +02:00