From fca64d672699d52b151f02665f8186edeb2514e0 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 20 Sep 2024 23:12:08 +0200 Subject: [PATCH 1/8] Fix: volumes on development environment --- docker-compose.dev.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 750ad45d4..ebcf16709 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -19,7 +19,7 @@ services: PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" volumes: - .:/var/www/html/:cached - - /data/coolify/backups/:/var/www/html/storage/app/backups + - backups_volume:/var/www/html/storage/app/backups postgres: pull_policy: always ports: @@ -32,8 +32,7 @@ services: POSTGRES_DB: "${DB_DATABASE:-coolify}" POSTGRES_HOST_AUTH_METHOD: "trust" volumes: - - /data/coolify/_volumes/database/:/var/lib/postgresql/data - # - coolify-pg-data-dev:/var/lib/postgresql/data + - postgres_data:/var/lib/postgresql/data redis: pull_policy: always ports: @@ -41,8 +40,7 @@ services: env_file: - .env volumes: - - /data/coolify/_volumes/redis/:/data - # - coolify-redis-data-dev:/data + - redis_data:/data soketi: build: context: . @@ -69,7 +67,7 @@ services: ports: - "${VITE_PORT:-5173}:${VITE_PORT:-5173}" volumes: - - .:/var/www/html:cached + - .:/var/www/html/:cached command: sh -c "npm install && npm run dev" networks: - coolify @@ -79,9 +77,11 @@ services: init: true container_name: coolify-testing-host volumes: - - /:/host - /var/run/docker.sock:/var/run/docker.sock - - /data/coolify/:/data/coolify + - backups_volume:/data/coolify/backups + - postgres_data:/data/coolify/_volumes/database + - redis_data:/data/coolify/_volumes/redis + - minio_data:/data/coolify/_volumes/minio networks: - coolify mailpit: @@ -105,17 +105,15 @@ services: MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY:-minioadmin}" MINIO_SECRET_KEY: "${MINIO_SECRET_KEY:-minioadmin}" volumes: - - /data/coolify/_volumes/minio/:/data - # - coolify-minio-data-dev:/data + - minio_data:/data networks: - coolify volumes: - coolify-data-dev: - coolify-pg-data-dev: - coolify-redis-data-dev: - coolify-minio-data-dev: - + backups_volume: + postgres_data: + redis_data: + minio_data: networks: coolify: From cb4f7755c3850810c901e14fa2f45e9a78611ea0 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:08:28 +0200 Subject: [PATCH 2/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 86 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 63 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 590360ddb..d6b18e126 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,9 +12,10 @@ You can ask for guidance anytime on our [Discord server](https://coollabs.io/dis 4. [Set up Environment Variables](#4-set-up-environment-variables) 5. [Start Coolify](#5-start-coolify) 6. [Start Development](#6-start-development) -7. [Development Notes](#7-development-notes) -8. [Create a Pull Request](#8-create-a-pull-request) -9. [Additional Contribution Guidelines](#additional-contribution-guidelines) +7. [Create a Pull Request](#7-create-a-pull-request) +8. [Development Notes](#8-development-notes) +9. [Resetting Development Environment](#9-resetting-development-environment) +10. [Additional Contribution Guidelines](#10-additional-contribution-guidelines) ## 1. Setup Development Environment @@ -145,26 +146,7 @@ After installing Docker (or Orbstack) and Spin, verify the installation: > TELESCOPE_ENABLED=true > ``` -## 7. 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. - -## 8. Create a Pull Request +## 7. Create a Pull Request 1. After making changes or adding a new service: - Commit your changes to your forked repository. @@ -194,6 +176,64 @@ When working on Coolify, keep the following in mind: After submission, maintainers will review your PR and may request changes or provide feedback. +## 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 + +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): + +1. Stop all running containers: + ``` + ctrl + c + ``` + +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 + ``` + +3. Remove Coolify volumes: + ```bash + docker volume rm coolify_backups_volume coolify_minio_data coolify_postgres_data coolify_redis_data + ``` + +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. + ## Additional Contribution Guidelines ### Contributing a New Service From a26c1f00523ca59839689752cb19af6c6f3c2860 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:11:03 +0200 Subject: [PATCH 3/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6b18e126..bce8cc4ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -197,19 +197,16 @@ When working on Coolify, keep the following in mind: ## Resetting Development Environment -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): +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`): -1. Stop all running containers: - ``` - ctrl + c - ``` +1. Stop all running containers `ctrl + c`. 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 ``` -3. Remove Coolify volumes: +3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on you machine, in that case remove the prefix): ```bash docker volume rm coolify_backups_volume coolify_minio_data coolify_postgres_data coolify_redis_data ``` From 76655a7c7d1034b0536d13c9eda2c23210fb29c4 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:31:17 +0200 Subject: [PATCH 4/8] Remove dev .env form nightly as there is also no dev compose in nightly --- other/nightly/.env.development.example | 38 -------------------------- 1 file changed, 38 deletions(-) delete mode 100644 other/nightly/.env.development.example diff --git a/other/nightly/.env.development.example b/other/nightly/.env.development.example deleted file mode 100644 index 3023a21a6..000000000 --- a/other/nightly/.env.development.example +++ /dev/null @@ -1,38 +0,0 @@ -# Coolify Configuration -APP_ENV=local -APP_NAME="Coolify Development" -APP_ID=development -APP_KEY= -APP_URL=http://localhost -APP_PORT=8000 -APP_DEBUG=true -SSH_MUX_ENABLED=false - -# PostgreSQL Database Configuration -DB_DATABASE=coolify -DB_USERNAME=coolify -DB_PASSWORD=password -DB_HOST=host.docker.internal -DB_PORT=5432 - -# Ray Configuration -# Set to true to enable Ray -RAY_ENABLED=false -# Set custom ray port -RAY_PORT= - -# Clockwork Configuration -CLOCKWORK_ENABLED=false -CLOCKWORK_QUEUE_COLLECT=true - -# Enable Laravel Telescope for debugging -TELESCOPE_ENABLED=false - -# Selenium Driver URL for Dusk -DUSK_DRIVER_URL=http://selenium:4444 - -# Special Keys for Andras -# For cache purging -BUNNY_API_KEY= -# For asset uploads -BUNNY_STORAGE_API_KEY= From 5a46ef42c89870f5c0cd4dd36fbf6e66eb9c6b50 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:03:10 +0200 Subject: [PATCH 5/8] Feat: clean new volume name for dev volumes --- CONTRIBUTING.md | 4 ++-- docker-compose.dev.yml | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bce8cc4ff..490d2268d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -206,9 +206,9 @@ If you encounter issues or break your database or something else, follow these s docker rm coolify coolify-db coolify-redis coolify-realtime coolify-testing-host coolify-minio coolify-vite-1 coolify-mail ``` -3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on you machine, in that case remove the prefix): +3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on your machine, in that case remove the prefix): ```bash - docker volume rm coolify_backups_volume coolify_minio_data coolify_postgres_data coolify_redis_data + docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_minio_data ``` 4. Remove unused images: diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index ebcf16709..71ffcb2d4 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -19,7 +19,7 @@ services: PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" volumes: - .:/var/www/html/:cached - - backups_volume:/var/www/html/storage/app/backups + - dev_backups_data:/var/www/html/storage/app/backups postgres: pull_policy: always ports: @@ -32,7 +32,7 @@ services: POSTGRES_DB: "${DB_DATABASE:-coolify}" POSTGRES_HOST_AUTH_METHOD: "trust" volumes: - - postgres_data:/var/lib/postgresql/data + - dev_postgres_data:/var/lib/postgresql/data redis: pull_policy: always ports: @@ -40,7 +40,7 @@ services: env_file: - .env volumes: - - redis_data:/data + - dev_redis_data:/data soketi: build: context: . @@ -78,10 +78,10 @@ services: container_name: coolify-testing-host volumes: - /var/run/docker.sock:/var/run/docker.sock - - backups_volume:/data/coolify/backups - - postgres_data:/data/coolify/_volumes/database - - redis_data:/data/coolify/_volumes/redis - - minio_data:/data/coolify/_volumes/minio + - dev_backups_data:/data/coolify/backups + - dev_postgres_data:/data/coolify/_volumes/database + - dev_redis_data:/data/coolify/_volumes/redis + - dev_minio_data:/data/coolify/_volumes/minio networks: - coolify mailpit: @@ -105,15 +105,15 @@ services: MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY:-minioadmin}" MINIO_SECRET_KEY: "${MINIO_SECRET_KEY:-minioadmin}" volumes: - - minio_data:/data + - dev_minio_data:/data networks: - coolify volumes: - backups_volume: - postgres_data: - redis_data: - minio_data: + dev_backups_data: + dev_postgres_data: + dev_redis_data: + dev_minio_data: networks: coolify: From 6bb21da9f3c65c350dd9ff9ea69ec9eb61aaa0ac Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:20:31 +0200 Subject: [PATCH 6/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 490d2268d..b9c2962c3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,9 +13,9 @@ You can ask for guidance anytime on our [Discord server](https://coollabs.io/dis 5. [Start Coolify](#5-start-coolify) 6. [Start Development](#6-start-development) 7. [Create a Pull Request](#7-create-a-pull-request) -8. [Development Notes](#8-development-notes) -9. [Resetting Development Environment](#9-resetting-development-environment) -10. [Additional Contribution Guidelines](#10-additional-contribution-guidelines) +8. [Development Notes](#development-notes) +9. [Resetting Development Environment](#resetting-development-environment) +10. [Additional Contribution Guidelines](#additional-contribution-guidelines) ## 1. Setup Development Environment @@ -26,15 +26,15 @@ Follow the steps below for your operating system: 1. Install `docker-ce`, Docker Desktop (or similar): - Docker CE (recommended): - - Install Windows Subsystem for Linux v2 (WSL2) by following this guide: [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install) - - After installing WSL2, install Docker CE for your Linux distribution by following this guide: [Install Docker Engine](https://docs.docker.com/engine/install/) + - 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) - Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide - Install Docker Desktop (easier): - - Download and install [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/) + - Download and install [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/?ref=coolify) - Ensure WSL2 backend is enabled in Docker Desktop settings 2. Install Spin: - - 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) + - 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) @@ -43,12 +43,12 @@ Follow the steps below for your operating system: 1. Install Orbstack, Docker Desktop (or similar): - Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop): - - Download and install [Orbstack](https://docs.orbstack.dev/quick-start#installation) + - Download and install [Orbstack](https://docs.orbstack.dev/quick-start#installation?ref=coolify) - Docker Desktop: - - Download and install [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/) + - Download and install [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/?ref=coolify) 2. Install Spin: - - 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) + - 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) @@ -57,12 +57,12 @@ Follow the steps below for your operating system: 1. Install Docker Engine, Docker Desktop (or similar): - Docker Engine (recommended, as there is no VM overhead): - - Follow the official [Docker Engine installation guide](https://docs.docker.com/engine/install/) for your Linux distribution + - Follow the official [Docker Engine installation guide](https://docs.docker.com/engine/install/?ref=coolify) for your Linux distribution - Docker Desktop: - - If you want a GUI, you can use [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/) + - If you want a GUI, you can use [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/?ref=coolify) 2. Install Spin: - - 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) + - 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) @@ -86,14 +86,14 @@ After installing Docker (or Orbstack) and Spin, verify the installation: | Editor | Platform | Download Link | |--------|----------|---------------| - | Visual Studio Code (recommended free) | Windows/macOS/Linux | [Download](https://code.visualstudio.com/download) | - | Cursor (recommended but paid) | Windows/macOS/Linux | [Download](https://www.cursor.com/) | - | Zed (very fast) | macOS/Linux | [Download](https://zed.dev/download) | + | 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) | 3. Clone the Coolify Repository from your fork to your local machine - Use `git clone` in the command line, or - Use GitHub Desktop (recommended): - - Download and install from [https://desktop.github.com/](https://desktop.github.com/) + - Download and install from [https://desktop.github.com/](https://desktop.github.com/?ref=coolify) - 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` @@ -161,8 +161,7 @@ After installing Docker (or Orbstack) and Spin, verify the installation: 3. Filling out the PR details: - Give your PR a descriptive title. - - In the description, explain the changes you've made. - - Reference any related issues by using keywords like "Fixes #123" or "Closes #456". + - Use the Pull Request Template provided and fill in the details. > [!IMPORTANT] > Always set the base branch for your PR to the `next` branch of the Coolify repository, not the `main` branch. @@ -206,7 +205,7 @@ If you encounter issues or break your database or something else, follow these s docker rm coolify coolify-db coolify-redis coolify-realtime coolify-testing-host coolify-minio coolify-vite-1 coolify-mail ``` -3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on your machine, in that case remove the prefix): +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): ```bash docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_minio_data ``` From 83c6dcb06328af137f2d2c38d985c1fd87fa6014 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:31:20 +0200 Subject: [PATCH 7/8] Fix: Persist DBs, services and so on stored in data/coolify --- docker-compose.dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 71ffcb2d4..b6fb931df 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -78,6 +78,7 @@ services: container_name: coolify-testing-host volumes: - /var/run/docker.sock:/var/run/docker.sock + - dev_coolify_data:/data/coolify - dev_backups_data:/data/coolify/backups - dev_postgres_data:/data/coolify/_volumes/database - dev_redis_data:/data/coolify/_volumes/redis @@ -113,6 +114,7 @@ volumes: dev_backups_data: dev_postgres_data: dev_redis_data: + dev_coolify_data: dev_minio_data: networks: From 7c52d7ef9e4e92cfd2ccf8e08a0442ab6833f48e Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:33:06 +0200 Subject: [PATCH 8/8] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9c2962c3..80ec0614e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -207,7 +207,7 @@ If you encounter issues or break your database or something else, follow these s 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): ```bash - docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_minio_data + docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_coolify_data coolify_dev_minio_data ``` 4. Remove unused images: