Coolify
Coolify is an open-source, self-hostable alternative to platforms such as Vercel, Heroku, Netlify, and Railway. It allows you to deploy websites, databases, web applications, and over 280 one-click services directly to your own infrastructure.
Benefits of Using Coolify
- Community-driven, production-ready Docker images
- One-click automatic updates of services
- Built-in GitHub and GitLab integrations and automatic deployment on branch updates
- Notification support (Slack and other channels)
- Stage, UAT, Demo environments
- Clean and intuitive user interface
Installing Coolify
There are two ways to use Coolify:
- Self-hosted on your own VPS
- Coolify Cloud (managed hosting by the Coolify team)
Self-Hosted Setup
If you choose to self-host Coolify, follow the official installation guide:
https://coolify.io/docs/get-started/installation#self-hosted-installation
Before deploying any applications, ensure that you:
- Configure HTTPS for the Coolify dashboard. This video can help
- Enable two-factor authentication (2FA) for added security. Go to Profile on sidebar and scroll to Two-factor Authentication
These steps are strongly recommended for any production environment.
Setting Up AI Agent Starter Kit on Coolify
- Create a new Project on Coolify and set the environment to Production.
- Click Add Resource. You will see a list of available services and databases.
Installing n8n with Redis and PostgreSQL on Coolify
- In the Search field, type
n8n. - Select one of the available n8n service templates.
For high-load scenarios, it is recommended to choose:
n8n with PostgreSQL and Worker
This setup provides better scalability and reliability by separating workers and using a dedicated database.
You will then be redirected to the n8n Configuration page.
- Rename the Service Name to a readable value, for example:
n8n. - Enable Connect to Predefined Network. By default, services are not connected to Coolify’s internal Docker network. Only applications and databases are connected automatically. Enabling this option ensures that the n8n service can communicate with your Laravel application. More details about Coolify networking are covered in the next Destinations section.
- Click Deploy or Start. This will launch the following services: n8n Worker Redis PostgreSQL.
Once deployment is complete, the n8n, PostgreSQL, Redis setup is finished.
Setting Up PostgreSQL for Laravel on Coolify
- Navigate to your Project and click + New Resource.
- Select PostgreSQL.
- In Select a PostgreSQL type, choose the default option.
You will be redirected to the PostgreSQL Configuration page. - Rename the Name to a readable value, for example:
postgresql-for-laravel. - Update the Username, Password, and Initial Database values if required.
- Click Start to launch the database service.
Setting Up Laravel on Coolify
Nixpacks
If you inspect the root directory of the Agent Starter Kit, you will find a nixpacks.toml file. This file contains the build configuration for Nixpacks, the application builder originally developed by Railway. Although Nixpacks is currently in maintenance mode, it supports PHP 8.4 and remains the easiest way to get started.
Alternatively, you can select docker based build of Laravel using our docker-compose (this option will be covered next).
Setup Laravel with Nixpacks:
- In your Coolify Project, add a new Resource.
- Select Git-based Application.
- If your repository is private, choose Private Repository and authenticate using the GitHub App.
- Select the Git branch to deploy.
Once configured, any new commits pushed to the selected branch will automatically trigger:
- A code pull
- A rebuild/restart of the Laravel container
This enables Continuous Deployment with minimal configuration.
Fill Environment variables. Make sure to change QUEUE_CONNECTION to database, APP_ENV to production, APP_DEBUG to false. Also modify all DB_*, STRIPE_*, N8N_URL parameters.
In Coolify, service names used internally (in Docker networks) do not match the names displayed in the Resources page of the UI. When configuring inter-service communication, always use the internal service name, not the UI label. For details on how to identify and use these IDs, refer to the Coolify Destinations section of this documentation.
Laravel with Docker Compose on Coolify
As an ALTERNATIVE to Nixpacks, you can deploy Laravel using the provided
docker-compose.prod.yml, which is production-ready and can be customized to
your requirements.
To deploy only Laravel, you should modify the file and remove
the n8n and pgsql services, as these services are already provisioned
separately using Coolify starters.
- Adjustments of Docker-compose.prod.yml for Laravel Coolify
-
Migrator Service
The
migratorservice is responsible for running database migrations and is intended to run only once per deployment. To prevent Coolify health checks from restarting it, add the following to themigratorservice definition:exclude_from_hc: true
Note: During execution, the migrator enables Laravel’s maintenance mode while applying database migrations.
To run the migrator in Coolify, update the Docker Up Command (available as input field in Docker Compose Configuration page)
docker compose --profile migrate up -dThis is required only on the first deployment or whenever new database migrations are added. After the migrations have completed, remove this command from the Docker Up input field and save the configuration.
-
Docker Network
You can safely remove the custom
networkssection fromdocker-compose.prod.yml. Coolify automatically attaches Docker Compose services to its internal network. More details about Coolify networking are covered in the next Destinations section. -
Nginx Port Mapping
Remove the following port mapping from the
nginxservice:ports:
- "${NGINX_PORT:-80}:80"Coolify uses Traefik as a reverse proxy, so explicit port mapping is not required and may cause conflicts.
This approach provides full control over the container stack while remaining fully compatible with Coolify’s deployment model.
Coolify Destinations (Docker networks)
Coolify is an orchestration layer built on top of Docker. In this context, Coolify Destinations are equivalent to Docker networks.
By default, Coolify creates a destination (network) named coolify. You can verify its existence by opening the Server → Terminal in Coolify and running:
docker network ls
Default Behavior
- All applications and databases created through Coolify are automatically attached to the default
coolifynetwork. - This network acts as an internal private network, allowing services to communicate with each other securely.
If you deploy applications using a custom Docker Compose file or use services (for example, n8n), they are not automatically attached to the default Coolify destination.
In such cases, you must explicitly configure those services to join the coolify network. This is required if you want other applications or services within Coolify to communicate with them.
Connecting to Services Inside the Network
Within the Coolify internal network:
- Services are addressed by their Name ID, not by the display name shown in the Coolify UI.
- The service ID can be found as the last segment of the service URL in the Coolify dashboard.
- You can also verify container name IDs directly from the server by running:
docker ps
Use the service name as the hostname when configuring connections between services.