coolify: [Bug]: Failed To Deploy Bun App

Description

Error when deploy Bun App (Elysia)

Minimal Reproduction (if possible, example repository)

Deploy Bare minium Bun app with Elysia Framework with Nixpack: https://github.com/iyansr/test-elysia

The error log says ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132

Exception or Error

[2024-Aug-02 03:29:03.556415] Starting deployment of iyansr/test-elysia:main to localhost.
[2024-Aug-02 03:29:03.779226] Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:latest.
[2024-Aug-02 03:29:07.559904] Image not found (igowo4c:33c63fa4597c7ec8d4d74cfbf79e1620ef1c5e21). Building new image.
[2024-Aug-02 03:29:07.996401] ----------------------------------------
[2024-Aug-02 03:29:08.003692] Importing iyansr/test-elysia:main (commit sha HEAD) to /artifacts/lscgckg.
[2024-Aug-02 03:29:10.668657] Generating nixpacks configuration with: nixpacks plan -f toml /artifacts/lscgckg
[2024-Aug-02 03:29:11.212251] Found application type: node.
[2024-Aug-02 03:29:11.215882] If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/node
[2024-Aug-02 03:29:12.128105] ----------------------------------------
[2024-Aug-02 03:29:12.132614] Building docker image started.
[2024-Aug-02 03:29:12.136659] To check the current progress, click on Show Debug Logs.
[2024-Aug-02 03:29:17.917481] Oops something is not okay, are you okay? 😒

[2024-Aug-02 03:29:17.921747] #0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 979B 0.0s done
#1 DONE 0.1s

#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1716249803
#2 DONE 1.3s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.1s

#4 [stage-0 1/9] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1716249803@sha256:5ef4d2021c418fcaabb56cea5ea9e24a5fdedfe27f58062d9689214dfed45c46
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 21.08kB 0.0s done
#5 DONE 0.1s

#6 [stage-0 3/9] COPY .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix
#6 CACHED

#7 [stage-0 4/9] RUN nix-env -if .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix && nix-collect-garbage -d
#7 CACHED

#8 [stage-0 2/9] WORKDIR /app/
#8 CACHED

#9 [stage-0 5/9] RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends curl wget
#9 CACHED

#10 [stage-0 6/9] COPY . /app/.
#10 DONE 0.4s

#11 [stage-0 7/9] RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save
#11 ERROR: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132
------
> [stage-0 7/9] RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save:
------
Dockerfile:20
--------------------
18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
19 | COPY . /app/.
20 | >>> RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save
21 |
22 | # build phase
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132

[2024-Aug-02 03:29:17.927167] Deployment failed. Removing the new version of your application.

Version

v4.0.0-beta.319

Cloud?

  • Yes
  • No

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

That toml snippet I shared just needs to be saved as nixpacks.toml at the root of your project and in your coolify configuration(ui) make sure Nixpacks is set (it’s usually the default) also the build and run scripts would need to be yours for elysia commands

That toml snippet I shared just needs to be saved as nixpacks.toml at the root of your project and in your coolify configuration(ui) make sure Nixpacks is set (it’s usually the default) also the build and run scripts would need to be yours for elysia commands

Added the nixpacks to my root folder but still getting the same error:

Importing SyahmiRafsan/pm-monorepo:main (commit sha HEAD) to /artifacts/bc8448044gg8so08k8ggwo48.
Generating nixpacks configuration with: nixpacks plan -f toml  --start-cmd "bun start" --install-cmd "bun install --ignore-scripts" /artifacts/bc8448044gg8so08k8ggwo48/apps/hono
Found application type: node.
If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/node
----------------------------------------
Building docker image started.
To check the current progress, click on Show Debug Logs.
Oops something is not okay, are you okay? 😒
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.04kB 0.0s done
#1 DONE 0.1s
#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1727136237
#2 DONE 0.9s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [stage-0 1/9] FROM ghcr.io/railwayapp/nixpacks:ubuntu-![Image](https://github.com/user-attachments/assets/de50482e-20f6-4413-b88f-705d89b1dc31)
1727136237@sha256:72cd12021740b1c4100a5c53c3b22974dacb86e4b0a35fcdd12605339de25b86
#4 DONE 0.0s
#5 [internal] load build context
#5 transferring context: 5.91kB 0.0s done
#5 DONE 0.1s
#6 [stage-0 4/9] RUN nix-env -if .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix && nix-collect-garbage -d
#6 CACHED
#7 [stage-0 2/9] WORKDIR /app/
#7 CACHED
#8 [stage-0 3/9] COPY .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix
#8 CACHED
#9 [stage-0 5/9] RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential curl wget
#9 CACHED
#10 [stage-0 6/9] COPY . /app/.
#10 DONE 0.2s
#11 [stage-0 7/9] RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts
#11 0.297 ============================================================
#11 0.297 Bun v1.1.20 (ae194892) Linux x64
#11 ERROR: process "/bin/bash -ol pipefail -c bun install --ignore-scripts" did not complete successfully: exit code: 132
------
 > [stage-0 7/9] RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts:
0.297 ============================================================
0.297 Bun v1.1.20 (ae194892) Linux x64
------
Dockerfile:20
--------------------
  18 |     ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH
  19 |     COPY . /app/.
  20 | >>> RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts
  21 |     
  22 |     # build phase
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun install --ignore-scripts" did not complete successfully: exit code: 132

This is my nixpacks config shown when building the docker image:

Building docker image started.
To check the current progress, click on Show Debug Logs.
docker exec mwwgcggwssoo04444c884wow bash -c 'nixpacks build -c /artifacts/thegameplan.json --cache-key 'x4ogw0csk8k0oco440ow0c8g' --no-error-without-start -n x4ogw0csk8k0oco440ow0c8g:d68fbd00cda7bb5866cc538ec83a107fd22cd9a4 /artifacts/mwwgcggwssoo04444c884wow/apps/hono -o /artifacts/mwwgcggwssoo04444c884wow/apps/hono'
╔═══════════════ Nixpacks v1.29.0 ══════════════╗
β•‘ setup      β”‚ bun, build-essential, curl, wget β•‘
║───────────────────────────────────────────────║
β•‘ install    β”‚ bun install                      β•‘
║───────────────────────────────────────────────║
β•‘ build      β”‚ bun run build                    β•‘
║───────────────────────────────────────────────║
β•‘ start      β”‚ bun run start                    β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Here is my nixpacks:

[phases.setup]
nixPkgs = ['bun']
aptPkgs = ['build-essential']

[phases.install]
cmds = ['bun install --ignore-scripts']

# [phases.build]
# cmds = ['bun run build']

[start]
cmd = 'bun run start'

Image

I’ve cloned your repo and deployed it on my instance, it works fine for me. Did you modify the install command? Normally, Nixpacks should just run bun install and nothing else. Also, your package.json doesn’t include any build and start steps. If you just want to run the development build on Coolify, change the start command to bun dev:

image

The Elysia documentation also provides info about the scripts normally included in the package.json file: https://elysiajs.com/quick-start.html#manual-installation