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KHeazZ+ z+x!7+eqBQ9)skOxT-=*VTww`f|j%2~{9t&@>>2Nh(6V`npM(@U$w@+k`?zFk4^` zfvVPHHamfKlLc`nXd8))?5I=9(8^^8{|>`9vqA-n2VtJ)MoHls0{!TDhtV~G;4%je z36gkj->^8qTx1*H36{JF8FDcu;)$7vzfXyLAqC(sL|8B7Jo$(k^aCLEeP|W>IyH)S z`}lJhgvPhsT+HFFNUozU??Z*dM|%K>q}xQ$eCbvBoOfrLN0$QZlko-Rd6Deo8v18} z{;;T0tO Il)?{b_s5FBunOPY}iTPCi|3%q&Mg;(#pBHkjZi|vh(q3ML0o0V= KDb*-ghx{KZU0w?S literal 0 HcmV?d00001 diff --git a/templates/compose/langfuse.yaml b/templates/compose/langfuse.yaml new file mode 100644 index 000000000..1512b0f07 --- /dev/null +++ b/templates/compose/langfuse.yaml @@ -0,0 +1,46 @@ +# documentation: https://langfuse.com/docs +# slogan: Langfuse is an open-source LLM engineering platform that helps teams collaboratively debug, analyze, and iterate on their LLM applications. +# tags: ai, qdrant, weaviate, langchain, openai, gpt, llm, lmops, langfuse, llmops +# logo: svgs/langfuse.png +# port: 3000 + +version: "3" + +services: + langfuse: + image: langfuse/langfuse + restart: always + environment: + - DATABASE_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-langfuse} + - NEXTAUTH_URL=$SERVICE_FQDN_LANGFUSE_3000 + - NEXTAUTH_SECRET=$NEXTAUTH_SECRET + - SALT=$SERVICE_PASSWORD_SALT + - AUTH_DISABLE_SIGNUP=${AUTH_DISABLE_SIGNUP:-false} + - TELEMETRY_ENABLED=${TELEMETRY_ENABLED:-false} + - LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=${LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES:-false} + entrypoint: + - node + - web/server.js + healthcheck: + test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/api/public/health"] + interval: 5s + timeout: 5s + retries: 3 + depends_on: + postgres: + condition: service_healthy + postgres: + image: "postgres:16-alpine" + environment: + - POSTGRES_DB=${POSTGRES_DB:-langfuse} + - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES + - POSTGRES_USER=$SERVICE_USER_POSTGRES + volumes: + - "pg-data:/var/lib/postgresql/data" + healthcheck: + test: + - CMD-SHELL + - "pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}" + interval: 5s + timeout: 5s + retries: 10 From ce926afdaad018d2b575e86dc5d4e7fd06ed768f Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Sat, 17 Aug 2024 06:16:38 +0300 Subject: [PATCH 004/142] Bump to v2 --- templates/compose/langfuse.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/langfuse.yaml b/templates/compose/langfuse.yaml index 1512b0f07..400e6ec75 100644 --- a/templates/compose/langfuse.yaml +++ b/templates/compose/langfuse.yaml @@ -8,7 +8,7 @@ version: "3" services: langfuse: - image: langfuse/langfuse + image: langfuse/langfuse:2 restart: always environment: - DATABASE_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-langfuse} From 71bb1f5e17c6b4947adb5c0c9f9403fbaa1cc030 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Sat, 17 Aug 2024 06:20:42 +0300 Subject: [PATCH 005/142] Added litellm --- public/svgs/litellm.svg | 1 + templates/compose/litellm.yaml | 177 +++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 public/svgs/litellm.svg create mode 100644 templates/compose/litellm.yaml diff --git a/public/svgs/litellm.svg b/public/svgs/litellm.svg new file mode 100644 index 000000000..01830c3f6 --- /dev/null +++ b/public/svgs/litellm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/compose/litellm.yaml b/templates/compose/litellm.yaml new file mode 100644 index 000000000..b16e08fbe --- /dev/null +++ b/templates/compose/litellm.yaml @@ -0,0 +1,177 @@ +# documentation: https://docs.litellm.ai +# slogan: Call all LLM APIs using the OpenAI format. Use Bedrock, Azure, OpenAI, Cohere, Anthropic, Ollama, Sagemaker, HuggingFace, Replicate, Groq (100+ LLMs) +# tags: ai, qdrant, weaviate, langchain, openai, gpt, llm, lmops, anthropic, cohere, ollama, sagemaker, huggingface, replicate, groq +# logo: svgs/litellm.svg +# port: 4000 + +volumes: + pg-data: null + redis-data: null + +services: + litellm: + image: "ghcr.io/berriai/litellm-database:main-latest" + restart: always + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + environment: + - LITELLM_LOG=ERROR + - LITELLM_MODE=PRODUCTION + - "LITELLM_MASTER_KEY=${SERVICE_PASSWORD_32_LITELLM_MASTER_KEY}" + - "UI_USERNAME=${SERVICE_USER_UI}" + - "UI_PASSWORD=${SERVICE_PASSWORD_UI}" + - "DATABASE_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-litellm}" + - REDIS_HOST=redis + - REDIS_PORT=6379 + - "POSTGRES_USER=${SERVICE_USER_POSTGRES}" + - "POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}" + - "POSTGRES_DB=${POSTGRES_DB:-litellm}" + - "OPENAI_API_KEY=${OPENAI_API_KEY}" + - "OPENAI_API_BASE=${OPENAI_API_BASE}" + - "ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}" + - "ANTHROPIC_API_BASE=${ANTHROPIC_API_BASE}" + - "VOYAGE_API_KEY=${VOYAGE_API_KEY}" + - "VOYAGE_API_BASE=${VOYAGE_API_BASE}" + volumes: + - "./litellm-config.yaml:/app/config.yaml" + - type: bind + source: ./docker/app/config.yaml + target: /app/config.yaml + content: | + general_settings: + proxy_batch_write_at: 60 + + router_settings: + routing_strategy: usage-based-routing-v2 + redis_host: os.environ/REDIS_HOST + redis_port: os.environ/REDIS_PORT + redis_password: os.environ/REDIS_PASSWORD + enable_pre_call_check: true + + litellm_settings: + set_verbose: false + json_logs: true + log_raw_request_response: true + # turn_off_message_logging: false + # redact_user_api_key_info: false + drop_params: true + # max_budget: 100 + # budget_duration: 30d + num_retries: 3 + request_timeout: 600 + telemetry: false + cache: true + cache_params: + type: redis + host: os.environ/REDIS_HOST + port: os.environ/REDIS_PORT + password: os.environ/REDIS_PASSWORD + namespace: "litellm_cache" + ttl: 600 + # success_callback: + # - "langfuse" + # - "prometheus" + # failure_callback: + # - "langfuse" + # - "prometheus" + model_list: + # OpenAI + - model_name: gpt-3.5-turbo + litellm_params: + model: openai/gpt-3.5-turbo + api_key: os.environ/OPENAI_API_KEY + api_base: os.environ/OPENAI_API_BASE + - model_name: gpt-4 + litellm_params: + model: openai/gpt-4 + api_key: os.environ/OPENAI_API_KEY + api_base: os.environ/OPENAI_API_BASE + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: os.environ/OPENAI_API_KEY + api_base: os.environ/OPENAI_API_BASE + - model_name: gpt-4o-mini + litellm_params: + model: openai/gpt-4o-mini + api_key: os.environ/OPENAI_API_KEY + api_base: os.environ/OPENAI_API_BASE + # Anthropic + - model_name: claude-3-haiku + litellm_params: + model: claude-3-haiku-20240307 + api_key: "os.environ/ANTHROPIC_API_KEY" + api_base: "os.environ/ANTHROPIC_API_BASE" + - model_name: claude-3.5-sonnet + litellm_params: + model: claude-3-5-sonnet-20240620 + api_key: "os.environ/ANTHROPIC_API_KEY" + api_base: "os.environ/ANTHROPIC_API_BASE" + # VoyageAI + - model_name: voyage-law-2 + model_info: + output_vector_size: 1024 + litellm_params: + model: voyage/voyage-law-2 + api_key: "os.environ/VOYAGE_API_KEY" + api_base: "os.environ/VOYAGE_API_BASE" + rpm: 300 + tpm: 1000000 + - model_name: voyage-multilingual-2 + model_info: + mode: embedding + max_tokens: 32000 + max_input_tokens: 32000 + output_vector_size: 1024 + litellm_params: + model: voyage/voyage-multilingual-2 + api_key: "os.environ/VOYAGE_API_KEY" + api_base: "os.environ/VOYAGE_API_BASE" + input_cost_per_token: 0.00000012 + output_cost_per_token: 0 + rpm: 300 + tpm: 1000000 + healthcheck: + test: + - CMD + - python + - "-c" + - "import requests as r;r.get('http://127.0.0.1:4000/health/liveliness').raise_for_status()" + interval: 5s + timeout: 5s + retries: 3 + command: + - "--config" + - /app/config.yaml + - "--port" + - "4000" + - "--num_workers" + - "8" + postgres: + image: "postgres:16-alpine" + environment: + - POSTGRES_DB=${POSTGRES_DB:-litellm} + - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES + - POSTGRES_USER=$SERVICE_USER_POSTGRES + volumes: + - "pg-data:/var/lib/postgresql/data" + healthcheck: + test: + - CMD-SHELL + - "pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}" + interval: 5s + timeout: 5s + retries: 3 + redis: + image: redis:7-alpine + command: redis-server --appendonly yes + volumes: + - redis-data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 5s + retries: 3 From 7e154ba3c38926e607e6d28f09fa09d4d72b8a79 Mon Sep 17 00:00:00 2001 From: Franck Kerbiriou Date: Thu, 22 Aug 2024 22:52:20 +0200 Subject: [PATCH 006/142] Add Mailpit template --- public/svgs/mailpit.svg | 5 +++++ templates/compose/mailpit.yaml | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 public/svgs/mailpit.svg create mode 100644 templates/compose/mailpit.yaml diff --git a/public/svgs/mailpit.svg b/public/svgs/mailpit.svg new file mode 100644 index 000000000..e569e71cc --- /dev/null +++ b/public/svgs/mailpit.svg @@ -0,0 +1,5 @@ + diff --git a/templates/compose/mailpit.yaml b/templates/compose/mailpit.yaml new file mode 100644 index 000000000..46072fb21 --- /dev/null +++ b/templates/compose/mailpit.yaml @@ -0,0 +1,20 @@ +# documentation: https://mailpit.axllent.org/docs/ +# slogan: Email & SMTP testing tool with API for developers +# tags: mailpit,email,testing,smtp +# logo: svgs/mailpit.png +# port: 8025 + +services: + mailpit: + image: axllent/mailpit + container_name: mailpit + volumes: + - "mailpit-data:/data" + ports: + - "1025:1025" + environment: + - SERVICE_FQDN_MAILPIT_8025 + - MP_MAX_MESSAGES: 5000 + - MP_DATABASE: /data/mailpit.db + - MP_SMTP_AUTH_ACCEPT_ANY: 1 + - MP_SMTP_AUTH_ALLOW_INSECURE: 1 From baa236f9343730fddad42f805c26a0059c216b29 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:46:14 +0200 Subject: [PATCH 007/142] Feat: Add debug bar --- composer.json | 3 +- composer.lock | 154 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 155 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7ca65babe..09e7f08e8 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "zircote/swagger-php": "^4.10" }, "require-dev": { + "barryvdh/laravel-debugbar": "^3.13", "fakerphp/faker": "^v1.21.0", "laravel/dusk": "^v8.0", "laravel/pint": "^1.16", @@ -110,4 +111,4 @@ }, "minimum-stability": "stable", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 4deaa42de..c3f521de0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "96f8146407d0e6e897ff097c5eccd3a4", + "content-hash": "42c28ab141b70fcabf75b51afa96c670", "packages": [ { "name": "amphp/amp", @@ -11895,6 +11895,90 @@ } ], "packages-dev": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v3.13.5", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/92d86be45ee54edff735e46856f64f14b6a8bb07", + "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07", + "shasum": "" + }, + "require": { + "illuminate/routing": "^9|^10|^11", + "illuminate/session": "^9|^10|^11", + "illuminate/support": "^9|^10|^11", + "maximebf/debugbar": "~1.22.0", + "php": "^8.0", + "symfony/finder": "^6|^7" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^5|^6|^7|^8|^9", + "phpunit/phpunit": "^9.6|^10.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.13-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\Debugbar\\ServiceProvider" + ], + "aliases": { + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.13.5" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2024-04-12T11:20:37+00:00" + }, { "name": "brianium/paratest", "version": "v7.4.3", @@ -12373,6 +12457,74 @@ }, "time": "2024-08-06T15:11:54+00:00" }, + { + "name": "maximebf/debugbar", + "version": "v1.22.5", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "1b5cabe0ce013134cf595bfa427bbf2f6abcd989" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/1b5cabe0ce013134cf595bfa427bbf2f6abcd989", + "reference": "1b5cabe0ce013134cf595bfa427bbf2f6abcd989", + "shasum": "" + }, + "require": { + "php": "^7.2|^8", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4|^5|^6|^7" + }, + "require-dev": { + "dbrekelmans/bdi": "^1", + "phpunit/phpunit": "^8|^9", + "symfony/panther": "^1|^2.1", + "twig/twig": "^1.38|^2.7|^3.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.22-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.5" + }, + "time": "2024-09-09T08:05:55+00:00" + }, { "name": "mockery/mockery", "version": "1.6.12", From 26f18e25aad56cb73fe401e7b3de30ae9c4e92fe Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:54:24 +0200 Subject: [PATCH 008/142] Create .gitignore --- storage/debugbar/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 storage/debugbar/.gitignore diff --git a/storage/debugbar/.gitignore b/storage/debugbar/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/storage/debugbar/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore From b99474ac731ba5f937b4052cf4a6a318ee1110c0 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:38:34 +0200 Subject: [PATCH 009/142] Fix: Remove memlock as it caused problems for some users --- app/Actions/Database/StartDragonfly.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Actions/Database/StartDragonfly.php b/app/Actions/Database/StartDragonfly.php index 352c6a59f..3ee46a2e1 100644 --- a/app/Actions/Database/StartDragonfly.php +++ b/app/Actions/Database/StartDragonfly.php @@ -46,9 +46,6 @@ class StartDragonfly 'networks' => [ $this->database->destination->network, ], - 'ulimits' => [ - 'memlock' => '-1', - ], 'labels' => [ 'coolify.managed' => 'true', ], From f2a9a0446140011da709719d6fde0ec6647efd35 Mon Sep 17 00:00:00 2001 From: Norman <41666997+nfnot@users.noreply.github.com> Date: Sat, 28 Sep 2024 01:14:54 +0000 Subject: [PATCH 010/142] refactor: Update search input placeholder in resource index view --- resources/views/livewire/project/resource/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/project/resource/index.blade.php b/resources/views/livewire/project/resource/index.blade.php index 62047bd41..5bd5b330a 100644 --- a/resources/views/livewire/project/resource/index.blade.php +++ b/resources/views/livewire/project/resource/index.blade.php @@ -48,7 +48,7 @@ class="items-center justify-center box">+ Add New Resource @else -+ From 9ec3233c0c039fe352b029baf09de1bd7e4e9707 Mon Sep 17 00:00:00 2001 From: liberocksDate: Sat, 28 Sep 2024 11:11:43 +0700 Subject: [PATCH 011/142] feat: allow specify use_build_server when creating/updating an application --- .../Controllers/Api/ApplicationsController.php | 17 +++++++++++++++-- bootstrap/helpers/api.php | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index 48e126f27..4941b4990 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -177,6 +177,7 @@ class ApplicationsController extends Controller 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -279,6 +280,7 @@ class ApplicationsController extends Controller 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -381,6 +383,7 @@ class ApplicationsController extends Controller 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -468,6 +471,7 @@ class ApplicationsController extends Controller 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -552,6 +556,7 @@ class ApplicationsController extends Controller 'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'], 'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']], 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -602,6 +607,7 @@ class ApplicationsController extends Controller 'name' => ['type' => 'string', 'description' => 'The application name.'], 'description' => ['type' => 'string', 'description' => 'The application description.'], 'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -627,7 +633,7 @@ class ApplicationsController extends Controller private function create_application(Request $request, $type) { - $allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths']; + $allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths', 'use_build_server']; $teamId = getTeamIdFromToken(); if (is_null($teamId)) { return invalidTokenResponse(); @@ -665,6 +671,7 @@ class ApplicationsController extends Controller $fqdn = $request->domains; $instantDeploy = $request->instant_deploy; $githubAppUuid = $request->github_app_uuid; + $useBuildServer = $request->use_build_server; $project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first(); if (! $project) { @@ -737,6 +744,8 @@ class ApplicationsController extends Controller $application->destination_id = $destination->id; $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; + $application->settings->is_build_server_enabled = $useBuildServer; + $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -1404,6 +1413,7 @@ class ApplicationsController extends Controller 'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'], 'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'], 'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'], + 'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'], ], )), ]), @@ -1460,7 +1470,7 @@ class ApplicationsController extends Controller ], 404); } $server = $application->destination->server; - $allowedFields = ['name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy']; + $allowedFields = ['name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy', 'use_build_server']; $validator = customApiValidator($request->all(), [ sharedDataApplications(), @@ -1538,6 +1548,9 @@ class ApplicationsController extends Controller } $instantDeploy = $request->instant_deploy; + $use_build_server = $request->use_build_server; + $application->settings->is_build_server_enabled = $use_build_server; + removeUnnecessaryFieldsFromRequest($request); $data = $request->all(); diff --git a/bootstrap/helpers/api.php b/bootstrap/helpers/api.php index 8e14ef9ee..006b095cf 100644 --- a/bootstrap/helpers/api.php +++ b/bootstrap/helpers/api.php @@ -175,4 +175,5 @@ function removeUnnecessaryFieldsFromRequest(Request $request) $request->offsetUnset('instant_deploy'); $request->offsetUnset('github_app_uuid'); $request->offsetUnset('private_key_uuid'); + $request->offsetUnset('use_build_server'); } From 221921990650f1921ff799251918f97c26abcc7e Mon Sep 17 00:00:00 2001 From: liberocks Date: Sat, 28 Sep 2024 11:25:00 +0700 Subject: [PATCH 012/142] fix: edit is_build_server_enabled upon creating application on other application type --- app/Http/Controllers/Api/ApplicationsController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index 4941b4990..69709bfa3 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -745,7 +745,6 @@ class ApplicationsController extends Controller $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; $application->settings->is_build_server_enabled = $useBuildServer; - $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -842,6 +841,7 @@ class ApplicationsController extends Controller $application->environment_id = $environment->id; $application->source_type = $githubApp->getMorphClass(); $application->source_id = $githubApp->id; + $application->settings->is_build_server_enabled = $useBuildServer; $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -934,6 +934,7 @@ class ApplicationsController extends Controller $application->destination_id = $destination->id; $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; + $application->settings->is_build_server_enabled = $useBuildServer; $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -1013,7 +1014,7 @@ class ApplicationsController extends Controller $application->destination_id = $destination->id; $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; - + $application->settings->is_build_server_enabled = $useBuildServer; $application->git_repository = 'coollabsio/coolify'; $application->git_branch = 'main'; $application->save(); @@ -1071,7 +1072,7 @@ class ApplicationsController extends Controller $application->destination_id = $destination->id; $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; - + $application->settings->is_build_server_enabled = $useBuildServer; $application->git_repository = 'coollabsio/coolify'; $application->git_branch = 'main'; $application->save(); From f5785b1f171cb45f12af180a98829bc17d5d4b14 Mon Sep 17 00:00:00 2001 From: liberocks Date: Sat, 28 Sep 2024 11:28:48 +0700 Subject: [PATCH 013/142] fix: save settings after assigning value --- app/Http/Controllers/Api/ApplicationsController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index 69709bfa3..782b3f270 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -745,6 +745,7 @@ class ApplicationsController extends Controller $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; $application->settings->is_build_server_enabled = $useBuildServer; + $application->settings->save(); $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -842,6 +843,7 @@ class ApplicationsController extends Controller $application->source_type = $githubApp->getMorphClass(); $application->source_id = $githubApp->id; $application->settings->is_build_server_enabled = $useBuildServer; + $application->settings->save(); $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -935,6 +937,7 @@ class ApplicationsController extends Controller $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; $application->settings->is_build_server_enabled = $useBuildServer; + $application->settings->save(); $application->save(); $application->refresh(); if (! $application->settings->is_container_label_readonly_enabled) { @@ -1015,6 +1018,8 @@ class ApplicationsController extends Controller $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; $application->settings->is_build_server_enabled = $useBuildServer; + $application->settings->save(); + $application->git_repository = 'coollabsio/coolify'; $application->git_branch = 'main'; $application->save(); @@ -1073,6 +1078,8 @@ class ApplicationsController extends Controller $application->destination_type = $destination->getMorphClass(); $application->environment_id = $environment->id; $application->settings->is_build_server_enabled = $useBuildServer; + $application->settings->save(); + $application->git_repository = 'coollabsio/coolify'; $application->git_branch = 'main'; $application->save(); @@ -1551,6 +1558,7 @@ class ApplicationsController extends Controller $use_build_server = $request->use_build_server; $application->settings->is_build_server_enabled = $use_build_server; + $application->settings->save(); removeUnnecessaryFieldsFromRequest($request); From 606d46eef0283e5b785a361405fe1fb537753370 Mon Sep 17 00:00:00 2001 From: Jordan Rey Date: Sun, 29 Sep 2024 15:36:41 +0200 Subject: [PATCH 014/142] fix(templates): filebrowser FQDN env variable --- templates/compose/filebrowser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/filebrowser.yaml b/templates/compose/filebrowser.yaml index eb5ba9eb6..e7b32dfc0 100644 --- a/templates/compose/filebrowser.yaml +++ b/templates/compose/filebrowser.yaml @@ -7,7 +7,7 @@ services: filebrowser: image: filebrowser/filebrowser:latest environment: - - SERVICE_FQDN_FILEBROWSER + - SERVICE_FQDN_FILEBROWSER_80 volumes: - type: bind source: ./srv From 1b0e2e12573187560cb3b41c76033185baa41ade Mon Sep 17 00:00:00 2001 From: MarioZet <89627138+MarioZet23@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:08:39 +0200 Subject: [PATCH 015/142] Feat. Apply all middlewares from labels to coolify router, instead of only basicauth and redirect --- bootstrap/helpers/docker.php | 81 +++++++++++------------------------- 1 file changed, 24 insertions(+), 57 deletions(-) diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index e252bda10..7e902fcdd 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -325,38 +325,16 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels->push('traefik.http.middlewares.gzip.compress=true'); $labels->push('traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https'); - $basic_auth = false; - $basic_auth_middleware = null; - $redirect = false; - $redirect_middleware = null; + $middlewares_from_labels = collect([]); if ($serviceLabels) { - $basic_auth = $serviceLabels->contains(function ($value) { - return str_contains($value, 'basicauth'); - }); - if ($basic_auth) { - $basic_auth_middleware = $serviceLabels - ->map(function ($item) { - if (preg_match('/traefik\.http\.middlewares\.(.*?)\.basicauth\.users/', $item, $matches)) { - return $matches[1]; - } - }) - ->filter() - ->first(); - } - $redirect = $serviceLabels->contains(function ($value) { - return str_contains($value, 'redirectregex'); - }); - if ($redirect) { - $redirect_middleware = $serviceLabels - ->map(function ($item) { - if (preg_match('/traefik\.http\.middlewares\.(.*?)\.redirectregex\.regex/', $item, $matches)) { - return $matches[1]; - } - }) - ->filter() - ->first(); - } + $middlewares_from_labels = $serviceLabels->map(function ($item) { + if (preg_match('/traefik\.http\.middlewares\.(.*?)(\.|$)/', $item, $matches)) { + return $matches[1]; + } + return null; + })->filter() + ->unique(); } foreach ($domains as $loop => $domain) { try { @@ -404,20 +382,15 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port"); } if ($path !== '/') { + // Middleware handling $middlewares = collect([]); - if ($is_stripprefix_enabled && ! str($image)->contains('ghost')) { + if ($is_stripprefix_enabled && !str($image)->contains('ghost')) { $labels->push("traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}"); $middlewares->push("{$https_label}-stripprefix"); } if ($is_gzip_enabled) { $middlewares->push('gzip'); } - if ($basic_auth && $basic_auth_middleware) { - $middlewares->push($basic_auth_middleware); - } - if ($redirect && $redirect_middleware) { - $middlewares->push($redirect_middleware); - } if (str($image)->contains('ghost')) { $middlewares->push('redir-ghost'); } @@ -425,10 +398,13 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels = $labels->merge($redirect_to_non_www); $middlewares->push($to_non_www_name); } - if ($redirect_direction === 'www' && ! str($host)->startsWith('www.')) { + if ($redirect_direction === 'www' && !str($host)->startsWith('www.')) { $labels = $labels->merge($redirect_to_www); $middlewares->push($to_www_name); } + $middlewares_from_labels->each(function ($middleware_name) use ($middlewares) { + $middlewares->push($middleware_name); + }); if ($middlewares->isNotEmpty()) { $middlewares = $middlewares->join(','); $labels->push("traefik.http.routers.{$https_label}.middlewares={$middlewares}"); @@ -437,13 +413,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $middlewares = collect([]); if ($is_gzip_enabled) { $middlewares->push('gzip'); - } - if ($basic_auth && $basic_auth_middleware) { - $middlewares->push($basic_auth_middleware); - } - if ($redirect && $redirect_middleware) { - $middlewares->push($redirect_middleware); - } + } if (str($image)->contains('ghost')) { $middlewares->push('redir-ghost'); } @@ -455,6 +425,9 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels = $labels->merge($redirect_to_www); $middlewares->push($to_www_name); } + $middlewares_from_labels->each(function ($middleware_name) use ($middlewares) { + $middlewares->push($middleware_name); + }); if ($middlewares->isNotEmpty()) { $middlewares = $middlewares->join(','); $labels->push("traefik.http.routers.{$https_label}.middlewares={$middlewares}"); @@ -490,12 +463,6 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ if ($is_gzip_enabled) { $middlewares->push('gzip'); } - if ($basic_auth && $basic_auth_middleware) { - $middlewares->push($basic_auth_middleware); - } - if ($redirect && $redirect_middleware) { - $middlewares->push($redirect_middleware); - } if (str($image)->contains('ghost')) { $middlewares->push('redir-ghost'); } @@ -507,6 +474,9 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels = $labels->merge($redirect_to_www); $middlewares->push($to_www_name); } + $middlewares_from_labels->each(function ($middleware_name) use ($middlewares) { + $middlewares->push($middleware_name); + }); if ($middlewares->isNotEmpty()) { $middlewares = $middlewares->join(','); $labels->push("traefik.http.routers.{$http_label}.middlewares={$middlewares}"); @@ -516,12 +486,6 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ if ($is_gzip_enabled) { $middlewares->push('gzip'); } - if ($basic_auth && $basic_auth_middleware) { - $middlewares->push($basic_auth_middleware); - } - if ($redirect && $redirect_middleware) { - $middlewares->push($redirect_middleware); - } if (str($image)->contains('ghost')) { $middlewares->push('redir-ghost'); } @@ -533,6 +497,9 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_ $labels = $labels->merge($redirect_to_www); $middlewares->push($to_www_name); } + $middlewares_from_labels->each(function ($middleware_name) use ($middlewares) { + $middlewares->push($middleware_name); + }); if ($middlewares->isNotEmpty()) { $middlewares = $middlewares->join(','); $labels->push("traefik.http.routers.{$http_label}.middlewares={$middlewares}"); From 6fe31c26a33c7648e2d20f1bbf13ada57431477b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 30 Sep 2024 11:14:40 +0200 Subject: [PATCH 016/142] refactor: remove unnecessary code --- app/Models/EnvironmentVariable.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/Models/EnvironmentVariable.php b/app/Models/EnvironmentVariable.php index 138775aba..9f8e4b342 100644 --- a/app/Models/EnvironmentVariable.php +++ b/app/Models/EnvironmentVariable.php @@ -126,11 +126,6 @@ class EnvironmentVariable extends Model $env = $this->get_real_environment_variables($this->value, $resource); return data_get($env, 'value', $env); - if (is_string($env)) { - return $env; - } - - return $env->value; } ); } From a66011701512c720fe7865d582575bd7685c7274 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 30 Sep 2024 11:14:53 +0200 Subject: [PATCH 017/142] use latest helper in dev --- app/Models/InstanceSettings.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php index 27a181ee4..6a9876c9b 100644 --- a/app/Models/InstanceSettings.php +++ b/app/Models/InstanceSettings.php @@ -85,4 +85,17 @@ class InstanceSettings extends Model implements SendsEmail return "[{$instanceName}]"; } + + public function helperVersion(): Attribute + { + return Attribute::make( + get: function () { + if (isDev()) { + return 'latest'; + } + + return $this->helper_version; + } + ); + } } From 8385b7dfe89aa4301122c142541793f693801898 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 30 Sep 2024 11:15:23 +0200 Subject: [PATCH 018/142] fix: handle edge case when build variables and env variables are in different format --- bootstrap/helpers/shared.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 975edf9ca..9ff05085a 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3826,6 +3826,21 @@ function convertComposeEnvironmentToArray($environment) { $convertedServiceVariables = collect([]); if (isAssociativeArray($environment)) { + if ($environment instanceof Collection) { + $changedEnvironment = collect([]); + $environment->each(function ($value, $key) use ($changedEnvironment) { + $parts = explode('=', $value, 2); + if (count($parts) === 2) { + $key = $parts[0]; + $realValue = $parts[1] ?? ''; + $changedEnvironment->put($key, $realValue); + } else { + $changedEnvironment->put($key, $value); + } + }); + + return $changedEnvironment; + } $convertedServiceVariables = $environment; } else { foreach ($environment as $value) { From b6b4d936580b85904f66051f26ae952a2d50cdf3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 30 Sep 2024 11:58:28 +0200 Subject: [PATCH 019/142] fix: compose based terminal --- .../Shared/ExecuteContainerCommand.php | 35 ++++++++++++------- .../execute-container-command.blade.php | 6 ++-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index d95443621..90419caed 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -11,6 +11,8 @@ use Livewire\Component; class ExecuteContainerCommand extends Component { + public $selected_container = 'default'; + public $container; public Collection $containers; @@ -83,11 +85,14 @@ class ExecuteContainerCommand extends Component $containers = getCurrentApplicationContainerStatus($server, $this->resource->id, includePullrequests: true); } foreach ($containers as $container) { - $payload = [ - 'server' => $server, - 'container' => $container, - ]; - $this->containers = $this->containers->push($payload); + // if container state is running + if (data_get($container, 'State') === 'running') { + $payload = [ + 'server' => $server, + 'container' => $container, + ]; + $this->containers = $this->containers->push($payload); + } } } elseif (data_get($this->parameters, 'database_uuid')) { if ($this->resource->isRunning()) { @@ -100,7 +105,6 @@ class ExecuteContainerCommand extends Component } } elseif (data_get($this->parameters, 'service_uuid')) { $this->resource->applications()->get()->each(function ($application) { - ray($application); if ($application->isRunning()) { $this->containers->push([ 'server' => $this->resource->server, @@ -131,9 +135,14 @@ class ExecuteContainerCommand extends Component #[On('connectToContainer')] public function connectToContainer() { + if ($this->selected_container === 'default') { + $this->dispatch('error', 'Please select a container.'); + + return; + } try { - $container_name = data_get($this->container, 'container.Names'); - if (is_null($container_name)) { + $container = collect($this->containers)->firstWhere('container.Names', $this->selected_container); + if (is_null($container)) { throw new \RuntimeException('Container not found.'); } $server = data_get($this->container, 'server'); @@ -141,11 +150,11 @@ class ExecuteContainerCommand extends Component if ($server->isForceDisabled()) { throw new \RuntimeException('Server is disabled.'); } - - $this->dispatch('send-terminal-command', - true, - $container_name, - $server->uuid, + $this->dispatch( + 'send-terminal-command', + isset($container), + data_get($container, 'container.Names'), + data_get($container, 'server.uuid') ); } catch (\Throwable $e) { diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.php index c98e9ae19..927e795ec 100644 --- a/resources/views/livewire/project/shared/execute-container-command.blade.php +++ b/resources/views/livewire/project/shared/execute-container-command.blade.php @@ -20,9 +20,11 @@ @if (count($containers) > 0)