From 236f0d2a5d90608c0bb8e6e759c662b8d1891179 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 3 Aug 2026 02:18:23 +0200 Subject: [PATCH] deploy.py: create_api_application ueber /applications/private-deploy-key (Git-basiert) --- scripts/deploy.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 2d444ef..972f33c 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -806,35 +806,33 @@ def set_service_envs(client: CoolifyClient, service_uuid: str, envs: list[dict]) def create_api_application(client: CoolifyClient, project_uuid: str, environment_name: str, server_uuid: str) -> str | None: - """Create the API application from the Dockerfile in the repo. + """Create the API application from a Git repository via private deploy key. + + Uses POST /applications/private-deploy-key with the Coolify host's private key. + This creates a Git-based application that can auto-update on git push. - Uses POST /applications/dockerfile with base64-encoded Dockerfile content. Returns the application UUID or None on failure. """ - import base64 as b64mod - - repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - dockerfile_path = os.path.join(repo_root, "Dockerfile") - try: - with open(dockerfile_path, "r") as f: - dockerfile_content = f.read() - except FileNotFoundError: - print(f" Error: Dockerfile not found at {dockerfile_path}") - return None - - dockerfile_b64 = b64mod.b64encode(dockerfile_content.encode()).decode() + # The private key UUID for the Coolify host (localhost) + PRIVATE_KEY_UUID = os.environ.get( + "COOLIFY_PRIVATE_KEY_UUID", + "rgcsc0048c04csckk8kogk40", + ) try: resp = httpx.post( - f"{client.base_url}/api/v1/applications/dockerfile", + f"{client.base_url}/api/v1/applications/private-deploy-key", headers=client.headers, json={ "project_uuid": project_uuid, "environment_name": environment_name, "server_uuid": server_uuid, - "name": "leocrm-api", - "dockerfile": dockerfile_b64, + "private_key_uuid": PRIVATE_KEY_UUID, + "git_repository": API_GIT_REPO, + "git_branch": API_GIT_BRANCH, "build_pack": "dockerfile", + "name": "leocrm-api", + "ports_exposes": "8000", }, timeout=30, )