Skip to content

Commit 7645047

Browse files
authored
Merge branch 'next' into next
2 parents b417565 + c6df243 commit 7645047

File tree

151 files changed

+6307
-2423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+6307
-2423
lines changed

CONTRIBUTING.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Contributing
2+
3+
> "First, thanks for considering contributing to my project. It really means a lot!" - [@andrasbacsai](https://github.com/andrasbacsai)
4+
5+
You can ask for guidance anytime on our [Discord server](https://coollabs.io/discord) in the `#contribute` channel.
6+
7+
8+
## Code Contribution
9+
10+
## 1. Setup your development environment
11+
12+
Follow the steps below for your operating system:
13+
14+
### Windows
15+
16+
1. Install `docker-ce`, Docker Desktop (or similar):
17+
- Docker CE (recommended):
18+
- Install Windows Subsystem for Linux v2 (WSL2) by following this guide: [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install)
19+
- After installing WSL2, install Docker CE for your Linux distribution by following this guide: [Install Docker Engine](https://docs.docker.com/engine/install/)
20+
- Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide
21+
- Install Docker Desktop (easier):
22+
- Download and install [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/)
23+
- Ensure WSL2 backend is enabled in Docker Desktop settings
24+
25+
2. Install Spin:
26+
- 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)
27+
28+
### MacOS
29+
30+
1. Install Orbstack, Docker Desktop (or similar):
31+
- Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop):
32+
- Download and install [Orbstack](https://docs.orbstack.dev/quick-start#installation)
33+
- Docker Desktop:
34+
- Download and install [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/)
35+
36+
2. Install Spin:
37+
- 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)
38+
39+
### Linux
40+
41+
1. Install Docker Engine, Docker Desktop (or similar):
42+
- Docker Engine (recommended, as there is no VM overhead):
43+
- Follow the official [Docker Engine installation guide](https://docs.docker.com/engine/install/) for your Linux distribution
44+
- Docker Desktop:
45+
- If you want a GUI, you can use [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/)
46+
47+
2. Install Spin:
48+
- 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)
49+
50+
51+
## 2. Verify installation (optional)
52+
53+
After installing Docker (or Orbstack) and Spin, verify the installation:
54+
55+
1. Open a terminal or command prompt
56+
2. Run the following commands:
57+
```bash
58+
docker --version
59+
spin --version
60+
```
61+
You should see version information for both Docker and Spin.
62+
63+
64+
## 3. Fork the Coolify repository and setup your local repository
65+
66+
1. Fork the [Coolify](https://github.com/coollabsio/coolify) repository to your GitHub account.
67+
68+
2. Install a code editor on your machine (below are some popular choices, choose one):
69+
70+
- Visual Studio Code (recommended free):
71+
- Windows/macOS/Linux: Download and install from [https://code.visualstudio.com/download](https://code.visualstudio.com/download)
72+
73+
- Cursor (recommended but paid for getting the full benefits):
74+
- Windows/macOS/Linux: Download and install from [https://www.cursor.com/](https://www.cursor.com/)
75+
76+
- Zed (very fast code editor):
77+
- macOS/Linux: Download and install from [https://zed.dev/download](https://zed.dev/download)
78+
- Windows: Not available yet
79+
80+
3. Clone the Coolify Repository from your fork to your local machine
81+
- Use `git clone` in the command line
82+
- Use GitHub Desktop (recommended):
83+
- Download and install from [https://desktop.github.com/](https://desktop.github.com/)
84+
- Open GitHub Desktop and login with your GitHub account
85+
- 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`
86+
87+
4. Open the cloned Coolify Repository in your chosen code editor.
88+
89+
90+
## 4. Set up Environment Variables
91+
92+
1. In the Code Editor, locate the `.env.development.example` file in the root directory of your local Coolify repository.
93+
94+
2. Duplicate the `.env.development.example` file and rename the copy to `.env`.
95+
96+
3. Open the new `.env` file and review its contents. Adjust any environment variables as needed for your development setup.
97+
98+
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`.
99+
100+
5. Save the changes to your `.env` file.
101+
102+
103+
## 5. Start Coolify
104+
105+
1. Open a terminal in the local Coolify directory.
106+
107+
2. Run the following command in the terminal (leave that terminal open):
108+
```
109+
spin up
110+
```
111+
Note: You may see some errors, but don't worry; this is expected.
112+
113+
3. If you encounter permission errors, especially on macOS, use:
114+
```
115+
sudo spin up
116+
```
117+
118+
Note: If you change environment variables afterwards or anything seems broken, press Ctrl + C to stop the process and run `spin up` again.
119+
120+
121+
## 6. Start Development
122+
123+
1. Access your Coolify instance:
124+
- URL: `http://localhost:8000`
125+
- Login: `[email protected]`
126+
- Password: `password`
127+
128+
2. Additional development tools:
129+
- Laravel Horizon (scheduler): `http://localhost:8000/horizon`
130+
Note: Only accessible when logged in as root user
131+
- Mailpit (email catcher): `http://localhost:8025`
132+
- Telescope (debugging tool): `http://localhost:8000/telescope`
133+
Note: Disabled by default (so the database is not overloaded), enable by adding the following environment variable to your `.env` file:
134+
```env
135+
TELESCOPE_ENABLED=true
136+
```
137+
138+
139+
## 7. Development Notes
140+
141+
When working on Coolify, keep the following in mind:
142+
143+
1. **Database Migrations**: After switching branches or making changes to the database structure, always run migrations:
144+
```bash
145+
docker exec -it coolify php artisan migrate
146+
```
147+
148+
2. **Resetting Development Setup**: To reset your development setup to a clean database with default values:
149+
```bash
150+
docker exec -it coolify php artisan migrate:fresh --seed
151+
```
152+
153+
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 envrionement specific issues.
154+
155+
Remember, forgetting to migrate the database can cause problems, so make it a habit to run migrations after pulling changes or switching branches.
156+
157+
158+
## 8. Contributing a New Service
159+
160+
To add a new service to Coolify, please refer to our documentation:
161+
[Adding a New Service](https://coolify.io/docs/knowledge-base/add-a-service)
162+
163+
164+
## 9. Create a Pull Request
165+
166+
1. After making changes or adding a new service:
167+
- Commit your changes to your forked repository.
168+
- Push the changes to your GitHub account.
169+
170+
2. Creating the Pull Request (PR):
171+
- Navigate to the main Coolify repository on GitHub.
172+
- Click the "Pull requests" tab.
173+
- Click the green "New pull request" button.
174+
- Choose your fork and branch as the compare branch.
175+
- Click "Create pull request".
176+
177+
3. Filling out the PR details:
178+
- Give your PR a descriptive title.
179+
- In the description, explain the changes you've made.
180+
- Reference any related issues by using keywords like "Fixes #123" or "Closes #456".
181+
182+
4. Important note:
183+
Always set the base branch for your PR to the `next` branch of the Coolify repository, not the `main` branch.
184+
185+
5. Submit your PR:
186+
- Review your changes one last time.
187+
- Click "Create pull request" to submit.
188+
189+
After submission, maintainers will review your PR and may request changes or provide feedback.

CONTRIBUTION.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Special thanks to our biggest sponsors!
4949
<a href="https://blacksmith.sh/?ref=coolify.io" target="_blank"><img src="./other/logos/blacksmith.svg" alt="blacksmith logo" width="200"/></a>
5050
<a href="https://latitude.sh/?ref=coolify.io" target="_blank"><img src="./other/logos/latitude.svg" alt="latitude logo" width="200"/></a>
5151
<a href="https://brand.dev/?ref=coolify.io" target="_blank"><img src="./other/logos/branddev.png" alt="branddev logo" width="200"/></a>
52+
<a href="https://jobscollider.com/remote-jobs?ref=coolify.io" target="_blank"><img src="./other/logos/jobscollider.svg" alt="jobscollider logo" width="200"/></a>
53+
<a href="https://hostinger.com?ref=coolify.io" target="_blank"><img src="./other/logos/hostinger.svg" alt="hostinger logo" width="200"/></a>
5254

5355
## Github Sponsors ($40+)
5456
<a href="https://serpapi.com/?ref=coolify.io"><img width="60px" alt="SerpAPI" src="https://github.com/serpapi.png"/></a>
@@ -71,8 +73,10 @@ Special thanks to our biggest sponsors!
7173
<a href="https://github.com/aniftyco"><img src="https://github.com/aniftyco.png" width="60px" alt="NiftyCo" /></a>
7274
<a href="https://github.com/iujlaki"><img src="https://github.com/iujlaki.png" width="60px" alt="Imre Ujlaki" /></a>
7375
<a href="https://il.ly"><img src="https://github.com/Illyism.png" width="60px" alt="Ilias Ism" /></a>
76+
<a href="https://www.breakcold.com/?utm_source=coolify.io"><img src="https://github.com/breakcold.png" width="60px" alt="Breakcold" /></a>
7477
<a href="https://github.com/urtho"><img src="https://github.com/urtho.png" width="60px" alt="Paweł Pierścionek" /></a>
7578
<a href="https://github.com/monocursive"><img src="https://github.com/monocursive.png" width="60px" alt="Michael Mazurczak" /></a>
79+
<a href="https://formbricks.com/?utm_source=coolify.io"><img src="https://github.com/formbricks.png" width="60px" alt="Formbricks" /></a>
7680

7781
## Organizations
7882
<a href="https://opencollective.com/coollabsio/organization/0/website"><img src="https://opencollective.com/coollabsio/organization/0/avatar.svg"></a>

app/Actions/Database/StartClickhouse.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,7 @@ public function handle(StandaloneClickhouse $database)
7979
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8080
}
8181
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
82-
$docker_compose['services'][$container_name]['logging'] = [
83-
'driver' => 'fluentd',
84-
'options' => [
85-
'fluentd-address' => 'tcp://127.0.0.1:24224',
86-
'fluentd-async' => 'true',
87-
'fluentd-sub-second-precision' => 'true',
88-
],
89-
];
82+
$docker_compose['services'][$container_name]['logging'] = generate_fluentd_configuration();
9083
}
9184
if (count($this->database->ports_mappings_array) > 0) {
9285
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
@@ -102,6 +95,11 @@ public function handle(StandaloneClickhouse $database)
10295
if (count($volume_names) > 0) {
10396
$docker_compose['volumes'] = $volume_names;
10497
}
98+
99+
// Add custom docker run options
100+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
101+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
102+
105103
$docker_compose = Yaml::dump($docker_compose, 10);
106104
$docker_compose_base64 = base64_encode($docker_compose);
107105
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -162,6 +160,8 @@ private function generate_environment_variables()
162160
$environment_variables->push("CLICKHOUSE_ADMIN_PASSWORD={$this->database->clickhouse_admin_password}");
163161
}
164162

163+
add_coolify_default_environment_variables($this->database, $environment_variables, $environment_variables);
164+
165165
return $environment_variables->all();
166166
}
167167
}

app/Actions/Database/StartDragonfly.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(StandaloneDragonfly $database)
2323
$startCommand = "dragonfly --requirepass {$this->database->dragonfly_password}";
2424

2525
$container_name = $this->database->uuid;
26-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
26+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2727

2828
$this->commands = [
2929
"echo 'Starting {$database->name}.'",
@@ -75,18 +75,11 @@ public function handle(StandaloneDragonfly $database)
7575
],
7676
],
7777
];
78-
if (! is_null($this->database->limits_cpuset)) {
78+
if (!is_null($this->database->limits_cpuset)) {
7979
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8080
}
8181
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
82-
$docker_compose['services'][$container_name]['logging'] = [
83-
'driver' => 'fluentd',
84-
'options' => [
85-
'fluentd-address' => 'tcp://127.0.0.1:24224',
86-
'fluentd-async' => 'true',
87-
'fluentd-sub-second-precision' => 'true',
88-
],
89-
];
82+
$docker_compose['services'][$container_name]['logging'] = generate_fluentd_configuration();
9083
}
9184
if (count($this->database->ports_mappings_array) > 0) {
9285
$docker_compose['services'][$container_name]['ports'] = $this->database->ports_mappings_array;
@@ -102,6 +95,11 @@ public function handle(StandaloneDragonfly $database)
10295
if (count($volume_names) > 0) {
10396
$docker_compose['volumes'] = $volume_names;
10497
}
98+
99+
// Add custom docker run options
100+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
101+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
102+
105103
$docker_compose = Yaml::dump($docker_compose, 10);
106104
$docker_compose_base64 = base64_encode($docker_compose);
107105
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -120,10 +118,10 @@ private function generate_local_persistent_volumes()
120118
$local_persistent_volumes = [];
121119
foreach ($this->database->persistentStorages as $persistentStorage) {
122120
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
123-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
121+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
124122
} else {
125123
$volume_name = $persistentStorage->name;
126-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
124+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
127125
}
128126
}
129127

@@ -154,7 +152,7 @@ private function generate_environment_variables()
154152
$environment_variables->push("$env->key=$env->real_value");
155153
}
156154

157-
if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
155+
if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
158156
$environment_variables->push("REDIS_PASSWORD={$this->database->dragonfly_password}");
159157
}
160158

0 commit comments

Comments
 (0)