Skip to content

reusable 7 #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 11 additions & 107 deletions apps/docs/content/bun/how-to/build-process.mdx
Original file line number Diff line number Diff line change
@@ -1,113 +1,17 @@
---
title: Bun build process
description: Learn more about node.js' build process.
description: Learn more about build process of Bun application
---

import data from '@site/static/data.json';
import { SetVar } from '@site/src/components/content/var';
import BuildProcessContent from '@site/src/components/content/build-process.mdx';

<p align="center">
<img
src="/img/screenshots/build_deploy_pipeline-step2.png"
alt="image"
width="100%"
height="auto"
/>
</p>
<SetVar name="servicePath" value="bun" />
<SetVar name="serviceDisplay" value="Bun" />
<SetVar name="defaultEnvironment" value="Bun package manager, Git and Bun runtime" />
<SetVar name="buildCommandExample" value={`buildCommands:
- bun install --verbose
- bun build --target=bun`} />
<SetVar name="codeLanguage" value="yaml" />

## Description of the build process

Zerops starts a temporary build container and performs following actions:

1. Installs the build environment:
- Sets up base system and Go runtime
- Restores cached files if available (based on `build.cache` configuration)
- Validates cache against current `build.os`, `build.base`, and `build.prepareCommands`
2. Downloads your application source code from [GitHub ↗](https://www.github.com), [GitLab ↗](https://www.gitlab.com) or via [Zerops CLI](/references/cli)
3. Optionally [customizes the build environment](#customize-bun-build-environment)
4. Runs the build commands
5. Uploads the application artefact to the internal Zerops storage
6. Preserves specified files for future builds (based on `build.cache` configuration)
7. Optionally [customizes the runtime environment](/bun/how-to/customize-runtime)
8. [Deploys your application](/bun/how-to/deploy-process)

The build container is automatically deleted after the build has finished or failed.

## Cancel running build

When you know that the running build is not correct and you want to cancel it, you can do it in Zerops GUI. Go to the service detail, open the list of running processes and click on the **Open pipeline detail** button. Then click on the **Cancel build** button.

<p align="center">
<img
src="/img/screenshots/cancel_running_build.png"
alt="image"
width="100%"
height="auto"
/>
</p>

:::caution
The build cancellation is available before the build pipeline is finished. When the build is finished, the deployment cannot be cancelled.
:::

## Customize Bun build environment

The default Bun build environment contains:

- <span>{data.alpine.default}</span>
- selected version of Bun defined in `zerops.yaml` [build.base](bun/how-to/build-pipeline#base) parameter
- [zCLI](/references/cli), Zerops command line tool
- `npm`, `yarn`, `git` and `npx` tools

If you prefer the Ubuntu OS instead of Alpine, set the [build.os](/bun/how-to/build-pipeline#os) attribute to `ubuntu`. To install additional packages or tools add one or more [build.prepareCommands](bun/how-to/build-pipeline#preparecommands) commands to your `zerops.yaml`.

:::info
The application code is available in the `/var/www` folder in your build container before the prepare commands are triggered. This allows you to use any file from your application code in your prepare commands (e.g. a configuration file).
:::

## Bun build hardware resources

Build of your Bun application is run in a separate build container with following resource configuration:

| HW resource | Minimum | Maximum |
| ------------- | ------- | ------- |
| **CPU cores** | 6 | 20 |
| **RAM** | 8 GB | 8 GB |
| **Disk** | 1 GB | 100 GB |

The build container is always started with the minimum hardware resources and scales vertically up to the maximum resources.

:::info
Hardware resources of the build containers are not charged. The build costs are covered by the standard Zerops [project fee](https://zerops.io/#pricing).
:::

## Build time limit

The time limit for the whole build pipeline is **1 hour**. After 1 hour, Zerops will terminate the build pipeline and delete the build container.

## Troubleshooting build-related problems

### Failure of a build prepare command

If any [prepare command](bun/how-to/build-pipeline#preparecommands) fails, it returns an exit code other than 0 and the build is canceled. Read the [build log](bun/how-to/logs#build-log) to troubleshoot the error. If the command ends successfully, it returns the exit code 0 and Zerops triggers the following command. When all `prepareCommands` commands are finished, your custom build environment is ready for the build phase.

### Invalidate the build cache
If you encounter unexpected build behavior or dependency issues, the problem might be related to [cached build data](/features/build-cache). While Zerops maintains the build cache to speed up deployments, sometimes you may need to start fresh.
To invalidate the build cache:

1. Go to your service detail in Zerops GUI
2. Choose **Pipelines & CI/CD Settings** from the left menu
3. Click on the **Invalidate build cache** button

This will force Zerops to run the next build clean, including all prepare commands, which can help resolve cache-related issues. After invalidation, your next build will also create a fresh cache.

### Failure of a build command

If any [build command](bun/how-to/build-pipeline#buildcommands) fails, it returns an exit code other than 0 and the build is canceled. Read the [build log](bun/how-to/logs#build-log) to troubleshoot the error. If the error log doesn't contain any specific error message, try to run your build with the `--verbose` option.

```yaml
buildCommands:
- npm i --verbose
- npm run build
```

If the command ends successfully, it returns the exit code 0 and Zerops triggers the following command. When all `buildCommands` are finished, the application build is completed and ready for the [deploy](bun/how-to/deploy-process) phase.
<BuildProcessContent />
2 changes: 1 addition & 1 deletion apps/docs/content/bun/how-to/customize-runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CustomizeRuntimeContent from '@site/src/components/content/customize-runt

<SetVar name="serviceDisplay" value="Bun" />
<SetVar name="serviceVersion" value={data.bun.base[0][0]} />
<SetVar name="servicePath" value="nodejs" />
<SetVar name="servicePath" value="bun" />
<SetVar name="packageManager" value="bun" />
<SetVar name="codeLanguage" value="yaml" />
<SetVar name="defaultEnvironment" value="Bun runtime and Git" />
Expand Down
34 changes: 5 additions & 29 deletions apps/docs/content/bun/how-to/filebrowser.mdx
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
---
title: Browse container files
description: Browsing files on your container using file browser on Zerops.
description: Browsing files on your container using file browser on Zerops.
---

## Zerops GUI
import { SetVar } from '@site/src/components/content/var';
import FileBrowserContent from '@site/src/components/content/file-browser.mdx';

In Zerops GUI, go to the service detail page and choose **Service containers & resources overview** and scroll down to the list of containers.
<SetVar name="servicePath" value="bun" />

<p align="center">
<img
src="/img/screenshots/nodejs_containers_list.png"
alt="image"
width="100%"
height="auto"
/>
</p>

Then click on the file browser icon and the file browser opens:

<p align="center">
<img
src="/img/screenshots/nodejs_file_browser.png"
alt="image"
width="100%"
height="auto"
/>
</p>

If your service is in the [HA mode], you can switch between containers in the top left corner.

## zCLI & SSH

You can connect to the container via SSH with the Zerops CLI and browse its files.
How to [connect to your service via SSH](/references/ssh).
<FileBrowserContent />
2 changes: 1 addition & 1 deletion apps/docs/content/bun/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ It doesn't matter whether it's your first curious introduction to Zerops, you ha
items={[
{
type: 'link',
href: 'bun/how-to/build-process#customize-bun-build-environment',
href: 'bun/how-to/build-process#customize-build-environment',
label: 'Customize build environment',
customProps: {
icon: Icons['sparkles'],
Expand Down
145 changes: 86 additions & 59 deletions apps/docs/content/deno/how-to/build-process.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Deno build process
description: Learn more about deno' build process.
description: Learn more about build process of Deno application
---

import data from '@site/static/data.json';
Expand All @@ -14,100 +14,127 @@ import data from '@site/static/data.json';
/>
</p>

## Description of the build process
## Build process overview

Zerops starts a temporary build container and performs following actions:
Zerops starts a temporary build container and performs the following actions:

1. Installs the build environment:
- Sets up base system and Go runtime
- Restores cached files if available (based on `build.cache` configuration)
- Validates cache against current `build.os`, `build.base`, and `build.prepareCommands`
2. Downloads your application source code from [GitHub ↗](https://www.github.com), [GitLab ↗](https://www.gitlab.com) or via [Zerops CLI](/references/cli)
3. Optionally [customizes the build environment](#customize-deno-build-environment)
4. Runs the build commands
5. Uploads the application artefact to the internal Zerops storage
6. Preserves specified files for future builds (based on `build.cache` configuration)
7. Optionally [customizes the runtime environment](/deno/how-to/customize-runtime)
8. [Deploys your application](/deno/how-to/deploy-process)
1. **Installs the build environment** - Sets up base system and Deno runtime
2. **Downloads your application source code** - From [GitHub ↗](https://www.github.com), [GitLab ↗](https://www.gitlab.com) or via [Zerops CLI](/references/cli)
3. **Optionally customizes the build environment** - Runs prepare commands if configured
4. **Runs the build commands** - Executes your build process
5. **Uploads the application artifact** - Stores build output to internal Zerops storage
6. **Caches selected files** - Preserves specified files for faster future builds

The build container is automatically deleted after the build has finished or failed.

## Cancel running build
## Build configuration

When you know that the running build is not correct and you want to cancel it, you can do it in Zerops GUI. Go to the service detail, open the list of running processes and click on the **Open pipeline detail** button. Then click on the **Cancel build** button.
Configure your Deno build process in your `zerops.yaml` file according to the [full build & deploy Deno pipeline guide](/deno/how-to/build-pipeline).

<p align="center">
<img
src="/img/screenshots/cancel_running_build.png"
alt="image"
width="100%"
height="auto"
/>
</p>
## Build environment

:::caution
The build cancellation is available before the build pipeline is finished. When the build is finished, the deployment cannot be cancelled.
:::

## Customize Deno build environment
### Default Deno build environment

The default Deno build environment contains:

- <span>{data.alpine.default}</span>
- selected version of Deno defined in `zerops.yaml` [build.base](/deno/how-to/build-pipeline#base) parameter
- <span>{data.ubuntu.default}</span>
- Selected version of Deno defined in `zerops.yaml` [build.base](/deno/how-to/build-pipeline#base) parameter
- [zCLI](/references/cli), Zerops command line tool
- `npm`, `yarn`, `git` and `npx` tools
- Deno and Git

If you prefer the Ubuntu OS instead of Alpine, set the [build.os](/deno/how-to/build-pipeline#os) attribute to `ubuntu`. To install additional packages or tools add one or more [build.prepareCommands](/deno/how-to/build-pipeline#preparecommands) commands to your `zerops.yaml`.
### Customize build environment

To install additional packages or tools, add one or more [build.prepareCommands](/deno/how-to/build-pipeline#preparecommands) to your `zerops.yaml`.

:::info
The application code is available in the `/var/www` folder in your build container before the prepare commands are triggered. This allows you to use any file from your application code in your prepare commands (e.g. a configuration file).
:::

## Deno build hardware resources

Build of your Deno application is run in a separate build container with following resource configuration:

| HW resource | Minimum | Maximum |
| ------------- | ------- | ------- |
| **CPU cores** | 6 | 20 |
| **RAM** | 8 GB | 8 GB |
| **Disk** | 1 GB | 100 GB |

The build container is always started with the minimum hardware resources and scales vertically up to the maximum resources.
### Build hardware resources

All runtime services use the same hardware resources for build containers:

<table className="w-fit my-1.5">
<thead>
<tr className="text-center rounded-lg">
<th className="w-fit"><strong>HW resource</strong></th>
<th className="w-fit"><strong>Minimum</strong></th>
<th className="w-fit"><strong>Maximum</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td className="w-fit font-semibold">CPU cores</td>
<td className="w-fit">1</td>
<td className="w-fit">5</td>
</tr>
<tr>
<td className="w-fit font-semibold">RAM</td>
<td className="w-fit">8 GB</td>
<td className="w-fit">8 GB</td>
</tr>
<tr>
<td className="w-fit font-semibold">Disk</td>
<td className="w-fit">1 GB</td>
<td className="w-fit">100 GB</td>
</tr>
</tbody>
</table>

Build containers start with minimum resources and scale vertically up to maximum capacity as needed.

:::info
Hardware resources of the build containers are not charged. The build costs are covered by the standard Zerops [project fee](https://zerops.io/#pricing).
Build container resources are not charged separately. Limited build time is included in your [project core plan](/company/pricing#project-core-plans), with additional build time available if needed.
:::

## Build time limit
### Build time limit

The time limit for the whole build pipeline is **1 hour**. After 1 hour, Zerops will terminate the build pipeline and delete the build container.

## Troubleshooting build-related problems
## Troubleshooting Deno builds

### Build command failures

### Failure of a build prepare command
If any [build command](/deno/how-to/build-pipeline#buildcommands) fails (returns non-zero exit code), the build is canceled. Check the [build log](/deno/how-to/logs#build-log) to troubleshoot the error.

If any [prepare command](/deno/how-to/build-pipeline#preparecommands) fails, it returns an exit code other than 0 and the build is canceled. Read the [build log](/deno/how-to/logs#build-log) to troubleshoot the error. If the command ends successfully, it returns the exit code 0 and Zerops triggers the following command. When all `prepareCommands` commands are finished, your custom build environment is ready for the build phase.
For Deno, if the error log doesn't contain specific error messages, try running your build with verbose output:

```yaml
buildCommands:
- deno cache main.ts
- deno compile --allow-net --allow-read main.ts
```

### Prepare command failures

If any [prepare command](/deno/how-to/build-pipeline#preparecommands) fails, check the [build log](/deno/how-to/logs#build-log) for specific error messages. Common issues include:

- Missing permissions in Deno commands (add --allow-net, --allow-read, etc.)
- Ubuntu package installation failures (use apt-get update first)
- Deno cache directory permissions

### Build cache issues

### Invalidate the build cache
If you encounter unexpected build behavior or dependency issues, the problem might be related to [cached build data](/features/build-cache). While Zerops maintains the build cache to speed up deployments, sometimes you may need to start fresh.

To invalidate the build cache:

1. Go to your service detail in Zerops GUI
2. Choose **Pipelines & CI/CD Settings** from the left menu
3. Click on the **Invalidate build cache** button

This will force Zerops to run the next build clean, including all prepare commands, which can help resolve cache-related issues. After invalidation, your next build will also create a fresh cache.
This will force Zerops to run the next build clean, including all prepare commands. Learn more about [build cache behavior](/features/build-cache).

### Failure of a build command
:::tip Advanced troubleshooting
For complex build issues that require investigation, you can enable [debug mode](/features/debug-mode) to pause the build process at specific points and inspect the build container state interactively.
:::

If any [build command](/deno/how-to/build-pipeline#buildcommands) fails, it returns an exit code other than 0 and the build is canceled. Read the [build log](/deno/how-to/logs#build-log) to troubleshoot the error. If the error log doesn't contain any specific error message, try to run your build with the `--verbose` option.
## More resources

```yaml
buildCommands:
- npm i --verbose
- npm run build
```
For more details about the build and deploy pipeline, including how to cancel builds and manage application versions, see the [general pipeline documentation](/features/pipeline).

## Next steps

If the command ends successfully, it returns the exit code 0 and Zerops triggers the following command. When all `buildCommands` are finished, the application build is completed and ready for the [deploy](/deno/how-to/deploy-process) phase.
- Understand the [deployment process](/deno/how-to/deploy-process)
- Learn how to [customize the runtime environment](/deno/how-to/customize-runtime)
- Explore [build and runtime logs](/deno/how-to/logs)
2 changes: 1 addition & 1 deletion apps/docs/content/deno/how-to/customize-runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The runtime prepare process follows the same steps for all runtimes. See [how ru
Zerops caches custom runtime images to optimize deployment times. Learn about [custom runtime image caching](/features/pipeline#custom-runtime-image-caching) including when images are cached and reused.

### Build Management
For information about managing builds and deployments, see [managing builds and deployments](/features/pipeline#manage-build-and-deploys).
For information about managing builds and deployments, see [managing builds and deployments](/features/pipeline#manage-builds-and-deployments).

:::warning
Shared storage mounts are not available during the runtime prepare phase.
Expand Down
Loading