2024-09-11 12:31:35 +00:00
# Contributing to Coolify
2024-08-26 12:35:51 +00:00
2024-08-26 12:57:28 +00:00
> "First, thanks for considering contributing to my project. It really means a lot!" - [@andrasbacsai](https://github.com/andrasbacsai)
2024-08-26 12:35:51 +00:00
2024-08-26 19:39:40 +00:00
You can ask for guidance anytime on our [Discord server ](https://coollabs.io/discord ) in the `#contribute` channel.
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
## Table of Contents
2024-08-26 12:57:28 +00:00
2024-09-11 12:31:35 +00:00
1. [Setup Development Environment ](#1-setup-development-environment )
2. [Verify Installation ](#2-verify-installation-optional )
3. [Fork and Setup Local Repository ](#3-fork-and-setup-local-repository )
4. [Set up Environment Variables ](#4-set-up-environment-variables )
5. [Start Coolify ](#5-start-coolify )
6. [Start Development ](#6-start-development )
2024-09-20 23:08:28 +00:00
7. [Create a Pull Request ](#7-create-a-pull-request )
2024-09-23 15:20:31 +00:00
8. [Development Notes ](#development-notes )
9. [Resetting Development Environment ](#resetting-development-environment )
10. [Additional Contribution Guidelines ](#additional-contribution-guidelines )
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
## 1. Setup Development Environment
2024-08-26 12:35:51 +00:00
Follow the steps below for your operating system:
2024-09-11 12:31:35 +00:00
< details >
< summary > < strong > Windows< / strong > < / summary >
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
1. Install `docker-ce` , Docker Desktop (or similar):
- Docker CE (recommended):
2024-09-23 15:20:31 +00:00
- Install Windows Subsystem for Linux v2 (WSL2) by following this guide: [Install WSL ](https://learn.microsoft.com/en-us/windows/wsl/install?ref=coolify )
- After installing WSL2, install Docker CE for your Linux distribution by following this guide: [Install Docker Engine ](https://docs.docker.com/engine/install/?ref=coolify )
2024-08-27 08:57:45 +00:00
- Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide
2024-08-26 19:59:58 +00:00
- Install Docker Desktop (easier):
2024-09-23 15:20:31 +00:00
- Download and install [Docker Desktop for Windows ](https://docs.docker.com/desktop/install/windows-install/?ref=coolify )
2024-08-26 19:59:58 +00:00
- Ensure WSL2 backend is enabled in Docker Desktop settings
2024-08-26 12:35:51 +00:00
2. Install Spin:
2024-09-23 15:20:31 +00:00
- Follow the instructions to install Spin on Windows from the [Spin documentation ](https://serversideup.net/open-source/spin/docs/installation/install-windows#download-and-install-spin-into-wsl2?ref=coolify )
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
< / details >
< details >
< summary > < strong > MacOS< / strong > < / summary >
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
1. Install Orbstack, Docker Desktop (or similar):
- Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop):
2024-09-23 15:20:31 +00:00
- Download and install [Orbstack ](https://docs.orbstack.dev/quick-start#installation?ref=coolify )
2024-08-26 12:35:51 +00:00
- Docker Desktop:
2024-09-23 15:20:31 +00:00
- Download and install [Docker Desktop for Mac ](https://docs.docker.com/desktop/install/mac-install/?ref=coolify )
2024-08-26 12:35:51 +00:00
2. Install Spin:
2024-09-23 15:20:31 +00:00
- Follow the instructions to install Spin on MacOS from the [Spin documentation ](https://serversideup.net/open-source/spin/docs/installation/install-macos/#download-and-install-spin?ref=coolify )
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
< / details >
< details >
< summary > < strong > Linux< / strong > < / summary >
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
1. Install Docker Engine, Docker Desktop (or similar):
- Docker Engine (recommended, as there is no VM overhead):
2024-09-23 15:20:31 +00:00
- Follow the official [Docker Engine installation guide ](https://docs.docker.com/engine/install/?ref=coolify ) for your Linux distribution
2024-08-26 12:35:51 +00:00
- Docker Desktop:
2024-09-23 15:20:31 +00:00
- If you want a GUI, you can use [Docker Desktop for Linux ](https://docs.docker.com/desktop/install/linux-install/?ref=coolify )
2024-08-26 12:35:51 +00:00
2. Install Spin:
2024-09-23 15:20:31 +00:00
- Follow the instructions to install Spin on Linux from the [Spin documentation ](https://serversideup.net/open-source/spin/docs/installation/install-linux#configure-docker-permissions?ref=coolify )
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
< / details >
2024-08-26 12:57:28 +00:00
2024-09-11 12:31:35 +00:00
## 2. Verify Installation (Optional)
2024-08-26 12:35:51 +00:00
After installing Docker (or Orbstack) and Spin, verify the installation:
1. Open a terminal or command prompt
2. Run the following commands:
```bash
docker --version
spin --version
```
You should see version information for both Docker and Spin.
2024-09-11 12:31:35 +00:00
## 3. Fork and Setup Local Repository
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
1. Fork the [Coolify ](https://github.com/coollabsio/coolify ) repository to your GitHub account.
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
2. Install a code editor on your machine (choose one):
2024-08-26 12:35:51 +00:00
2024-09-11 12:31:35 +00:00
| Editor | Platform | Download Link |
|--------|----------|---------------|
2024-09-23 15:20:31 +00:00
| Visual Studio Code (recommended free) | Windows/macOS/Linux | [Download ](https://code.visualstudio.com/download?ref=coolify ) |
| Cursor (recommended but paid) | Windows/macOS/Linux | [Download ](https://www.cursor.com/?ref=coolify ) |
| Zed (very fast) | macOS/Linux | [Download ](https://zed.dev/download?ref=coolify ) |
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
3. Clone the Coolify Repository from your fork to your local machine
2024-09-11 12:31:35 +00:00
- Use `git clone` in the command line, or
2024-08-26 12:35:51 +00:00
- Use GitHub Desktop (recommended):
2024-09-23 15:20:31 +00:00
- Download and install from [https://desktop.github.com/ ](https://desktop.github.com/?ref=coolify )
2024-08-26 19:59:58 +00:00
- Open GitHub Desktop and login with your GitHub account
- Click on `File` -> `Clone Repository` select `github.com` as the repository location, then select your forked Coolify repository, choose the local path and then click `Clone`
2024-08-26 12:57:28 +00:00
4. Open the cloned Coolify Repository in your chosen code editor.
2024-08-26 12:35:51 +00:00
2024-08-26 13:44:30 +00:00
## 4. Set up Environment Variables
2024-08-26 12:35:51 +00:00
2024-08-26 19:59:58 +00:00
1. In the Code Editor, locate the `.env.development.example` file in the root directory of your local Coolify repository.
2024-08-26 19:38:20 +00:00
2. Duplicate the `.env.development.example` file and rename the copy to `.env` .
3. Open the new `.env` file and review its contents. Adjust any environment variables as needed for your development setup.
4. If you encounter errors during database migrations, update the database connection settings in your `.env` file. Use the IP address or hostname of your PostgreSQL database container. You can find this information by running `docker ps` after executing `spin up` .
5. Save the changes to your `.env` file.
2024-08-26 12:35:51 +00:00
2024-08-26 19:38:20 +00:00
## 5. Start Coolify
2024-08-26 12:35:51 +00:00
2024-08-26 20:08:21 +00:00
1. Open a terminal in the local Coolify directory.
2. Run the following command in the terminal (leave that terminal open):
2024-09-11 12:31:35 +00:00
```bash
2024-08-26 12:35:51 +00:00
spin up
```
2024-09-11 12:31:35 +00:00
> [!NOTE]
> You may see some errors, but don't worry; this is expected.
2024-08-26 12:35:51 +00:00
2024-08-26 12:57:28 +00:00
3. If you encounter permission errors, especially on macOS, use:
2024-09-11 12:31:35 +00:00
```bash
2024-08-26 12:35:51 +00:00
sudo spin up
```
2024-09-11 12:31:35 +00:00
> [!NOTE]
> If you change environment variables afterwards or anything seems broken, press Ctrl + C to stop the process and run `spin up` again.
2024-08-26 12:57:28 +00:00
2024-08-26 13:44:30 +00:00
## 6. Start Development
2024-08-26 12:35:51 +00:00
1. Access your Coolify instance:
- URL: `http://localhost:8000`
- Login: `test@example.com`
- Password: `password`
2. Additional development tools:
2024-09-11 12:31:35 +00:00
| Tool | URL | Note |
|------|-----|------|
| Laravel Horizon (scheduler) | `http://localhost:8000/horizon` | Only accessible when logged in as root user |
| Mailpit (email catcher) | `http://localhost:8025` | |
| Telescope (debugging tool) | `http://localhost:8000/telescope` | Disabled by default |
> [!NOTE]
> To enable Telescope, add the following to your `.env` file:
> ```env
> TELESCOPE_ENABLED=true
> ```
2024-08-26 12:57:28 +00:00
2024-09-20 23:08:28 +00:00
## 7. Create a Pull Request
2024-08-29 11:12:34 +00:00
1. After making changes or adding a new service:
- Commit your changes to your forked repository.
- Push the changes to your GitHub account.
2. Creating the Pull Request (PR):
- Navigate to the main Coolify repository on GitHub.
- Click the "Pull requests" tab.
- Click the green "New pull request" button.
- Choose your fork and branch as the compare branch.
- Click "Create pull request".
3. Filling out the PR details:
- Give your PR a descriptive title.
2024-09-23 15:20:31 +00:00
- Use the Pull Request Template provided and fill in the details.
2024-08-29 11:12:34 +00:00
2024-09-11 12:31:35 +00:00
> [!IMPORTANT]
> Always set the base branch for your PR to the `next` branch of the Coolify repository, not the `main` branch.
2024-08-29 11:12:34 +00:00
2024-09-11 12:31:35 +00:00
4. Submit your PR:
2024-08-29 11:12:34 +00:00
- Review your changes one last time.
- Click "Create pull request" to submit.
2024-09-11 12:31:35 +00:00
> [!NOTE]
> Make sure your PR is out of draft mode as soon as it's ready for review. PRs that are in draft mode for a long time may be closed by maintainers.
2024-08-29 11:12:34 +00:00
After submission, maintainers will review your PR and may request changes or provide feedback.
2024-09-11 12:31:35 +00:00
2024-09-20 23:08:28 +00:00
## Development Notes
When working on Coolify, keep the following in mind:
1. **Database Migrations** : After switching branches or making changes to the database structure, always run migrations:
```bash
docker exec -it coolify php artisan migrate
```
2. **Resetting Development Setup** : To reset your development setup to a clean database with default values:
```bash
docker exec -it coolify php artisan migrate:fresh --seed
```
3. **Troubleshooting** : If you encounter unexpected behavior, ensure your database is up-to-date with the latest migrations and if possible reset the development setup to eliminate any environment-specific issues.
> [!IMPORTANT]
> Forgetting to migrate the database can cause problems, so make it a habit to run migrations after pulling changes or switching branches.
## Resetting Development Environment
2024-09-20 23:11:03 +00:00
If you encounter issues or break your database or something else, follow these steps to start from a clean slate (works since `v4.0.0-beta.342` ):
2024-09-20 23:08:28 +00:00
2024-09-20 23:11:03 +00:00
1. Stop all running containers `ctrl + c` .
2024-09-20 23:08:28 +00:00
2. Remove all Coolify containers:
```bash
docker rm coolify coolify-db coolify-redis coolify-realtime coolify-testing-host coolify-minio coolify-vite-1 coolify-mail
```
2024-09-23 15:20:31 +00:00
3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on your machine, in that case remove the prefix from the command):
2024-09-20 23:08:28 +00:00
```bash
2024-09-23 15:33:06 +00:00
docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_coolify_data coolify_dev_minio_data
2024-09-20 23:08:28 +00:00
```
4. Remove unused images:
```bash
docker image prune -a
```
5. Start Coolify again:
```bash
spin up
```
6. Run database migrations and seeders:
```bash
docker exec -it coolify php artisan migrate:fresh --seed
```
After completing these steps, you'll have a fresh development setup.
> [!IMPORTANT]
> Always run database migrations and seeders after switching branches or pulling updates to ensure your local database structure matches the current codebase and includes necessary seed data.
2024-09-11 12:31:35 +00:00
## Additional Contribution Guidelines
### Contributing a New Service
To add a new service to Coolify, please refer to our documentation:
[Adding a New Service ](https://coolify.io/docs/knowledge-base/contribute/service )
### Contributing to Documentation
To contribute to the Coolify documentation, please refer to this guide:
[Contributing to the Coolify Documentation ](https://github.com/coollabsio/documentation-coolify/blob/main/CONTRIBUTING.md )