From 31db1db63617ec780964e6d2d87a112f74ed4f06 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 5 Sep 2023 08:49:33 +0200 Subject: [PATCH] next helper image --- .github/workflows/coolify-helper-next.yml | 84 +++++++++++++++++++++++ .github/workflows/coolify-helper.yml | 8 ++- app/Jobs/ApplicationDeploymentJob.php | 12 ++-- config/coolify.php | 1 + docker/coolify-helper/Dockerfile | 6 +- resources/views/livewire/help.blade.php | 2 +- 6 files changed, 100 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/coolify-helper-next.yml diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml new file mode 100644 index 000000000..ef7f5b217 --- /dev/null +++ b/.github/workflows/coolify-helper-next.yml @@ -0,0 +1,84 @@ +name: Coolify Helper Image Development (v4) + +on: + push: + branches: [ "next" ] + paths: + - .github/workflows/coolify-helper.yml + - docker/coolify-helper/Dockerfile + +env: + REGISTRY: ghcr.io + IMAGE_NAME: "coollabsio/coolify-helper" + +jobs: + amd64: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Login to ghcr.io + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build image and push to registry + uses: docker/build-push-action@v3 + with: + no-cache: true + context: . + file: docker/coolify-helper/Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next + aarch64: + runs-on: [ self-hosted, arm64 ] + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Login to ghcr.io + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build image and push to registry + uses: docker/build-push-action@v3 + with: + no-cache: true + context: . + file: docker/coolify-helper/Dockerfile + platforms: linux/aarch64 + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 + merge-manifest: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: [ amd64, aarch64 ] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to ghcr.io + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create & publish manifest + run: | + docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next + - uses: sarisia/actions-status-discord@v1 + if: always() + with: + webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }} diff --git a/.github/workflows/coolify-helper.yml b/.github/workflows/coolify-helper.yml index 6a774effc..6962d1dbf 100644 --- a/.github/workflows/coolify-helper.yml +++ b/.github/workflows/coolify-helper.yml @@ -2,7 +2,7 @@ name: Coolify Helper Image (v4) on: push: - branches: [ "main", "next" ] + branches: [ "main" ] paths: - .github/workflows/coolify-helper.yml - docker/coolify-helper/Dockerfile @@ -55,7 +55,7 @@ jobs: file: docker/coolify-helper/Dockerfile platforms: linux/aarch64 push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:aarch64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64 merge-manifest: runs-on: ubuntu-latest permissions: @@ -78,3 +78,7 @@ jobs: - name: Create & publish manifest run: | docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + - uses: sarisia/actions-status-discord@v1 + if: always() + with: + webhook: ${{ secrets.DISCORD_WEBHOOK_PROD_RELEASE_CHANNEL }} diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 260bc6b88..c71e3a7e2 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -267,7 +267,6 @@ private function health_check() [ "echo 'Rolling update completed.'" ], - ["echo -n '######################'"], ); break; } @@ -304,11 +303,12 @@ private function prepare_builder_image() if (isDev()) { $pull = "--pull=never"; } - $runCommand = "docker run {$pull} -d --network {$this->destination->network} -v /:/host --name {$this->deployment_uuid} --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper"; + $helperImage = config('coolify.helper_image'); + $runCommand = "docker run {$pull} -d --network {$this->destination->network} -v /:/host --name {$this->deployment_uuid} --rm -v /var/run/docker.sock:/var/run/docker.sock {$helperImage}"; $this->execute_remote_command( [ - "echo -n 'Pulling latest version of the helper image (ghcr.io/coollabsio/coolify-helper).'", + "echo -n 'Pulling helper image from $helperImage.'", ], [ $runCommand, @@ -317,7 +317,6 @@ private function prepare_builder_image() [ "command" => $this->execute_in_builder("mkdir -p {$this->workdir}") ], - ["echo -n '######################'"], ); } @@ -497,7 +496,7 @@ private function generate_compose_file() ], 'networks' => [ $this->destination->network => [ - 'external' => false, + 'external' => true, 'name' => $this->destination->network, 'attachable' => true, ] @@ -709,7 +708,7 @@ private function stop_running_container() { if ($this->currently_running_container_name) { $this->execute_remote_command( - ["echo -n 'Removing old application version.'"], + ["echo -n 'Removing old version of your application.'"], [$this->execute_in_builder("docker rm -f $this->currently_running_container_name >/dev/null 2>&1"), "hidden" => true], ); } @@ -718,7 +717,6 @@ private function stop_running_container() private function start_by_compose_file() { $this->execute_remote_command( - ["echo -n '######################'"], ["echo -n 'Rolling update started.'"], [$this->execute_in_builder("docker compose --project-directory {$this->workdir} up -d >/dev/null"), "hidden" => true], ); diff --git a/config/coolify.php b/config/coolify.php index bb9e67364..cd16d6b6f 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -7,4 +7,5 @@ 'mux_enabled' => env('MUX_ENABLED', true), 'dev_webhook' => env('SERVEO_URL'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), + 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper:latest'), ]; diff --git a/docker/coolify-helper/Dockerfile b/docker/coolify-helper/Dockerfile index 8ce158a96..301322c63 100644 --- a/docker/coolify-helper/Dockerfile +++ b/docker/coolify-helper/Dockerfile @@ -2,11 +2,11 @@ FROM alpine:3.17 ARG TARGETPLATFORM # https://download.docker.com/linux/static/stable/ -ARG DOCKER_VERSION=23.0.6 +ARG DOCKER_VERSION=24.0.5 # https://github.com/docker/compose/releases -ARG DOCKER_COMPOSE_VERSION=2.18.1 +ARG DOCKER_COMPOSE_VERSION=2.21.0 # https://github.com/docker/buildx/releases -ARG DOCKER_BUILDX_VERSION=0.10.5 +ARG DOCKER_BUILDX_VERSION=0.11.2 # https://github.com/buildpacks/pack/releases ARG PACK_VERSION=0.30.0 # https://github.com/railwayapp/nixpacks/releases diff --git a/resources/views/livewire/help.blade.php b/resources/views/livewire/help.blade.php index a08bdda05..a9c294852 100644 --- a/resources/views/livewire/help.blade.php +++ b/resources/views/livewire/help.blade.php @@ -1,6 +1,6 @@