Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Server package library

In the app: Server package library

Who can do this: an installation administrator. A workspace administrator performs the separate workspace enable step.

Use the server package library when a reusable tool is not available in the workspace’s standard catalog. The library creates composable runtime packages; it does not accept arbitrary images, Containerfiles or shell scripts and it does not contain product-specific package logic.

Maintained package and adapter registry

The registry card at the top shows the active registry revision, whether it came from the downloaded last-known-good cache or the release bundle, and the latest update-check result. Check for updates starts a background check; it does not block this page and does not modify any project or environment.

An update is accepted only after the signed index, every declared SHA-256 and the complete package and adapter snapshot have passed validation. A failed or unreachable check leaves the current snapshot active. See Maintained registry for the security, offline and publication contract.

Create a package with the guide

Select Create package. The dialog is a four-step guide rather than one long form:

  1. Source — name the release and describe where its installation files come from.
  2. Runtime — state what the package provides, requires and may reach over HTTPS after installation.
  3. Validation — define a small deterministic check that proves this package installed correctly by itself.
  4. Review — compare a readable summary with the exact server-generated build plan before saving.

Only the current step’s fields and help are shown. Continue checks required values before advancing. On step 3, Check and review asks the server to normalize the complete definition; nothing has been saved yet. Save draft becomes available only on the review step. Saving a draft does not build an image or make the package available to projects.

The heading and navigation remain visible while the guide’s content scrolls. The dialog has no horizontal page scroll; long plan values wrap inside the plan area.

Describe the runtime contract

The Runtime step is the contract between this package and every project that selects it. It has three structured lists; none of them is product-specific.

  • Environment variables are values the package contributes to the final project environment, for example JAVA_HOME, CATALINA_HOME or a variable used by an internal tool. Names and values are validated. If two selected packages assign different values to the same name, the project image build fails instead of silently choosing one.
  • Provides names capabilities other packages may depend on, such as java.runtime, java.sdk or servlet.container. The capability name is a stable contract; the optional version describes what this release provides.
  • Depends on names required capabilities. A dependency may accept any version, one exact version such as 21, or a range such as >=17 <22. It points to a capability, never to a product name or filesystem path.

The guide offers package variables that can be inserted anywhere in an environment-variable value:

Package variableResolved value
{packageKey}This release’s stable package key
{version}This release’s version label
{installPath}The archive extraction directory inside the generated environment image

Variables can be combined with literal text, for example CATALINA_HOME={installPath}/apache-tomcat-{version}. The row’s insertion menu inserts at the cursor instead of replacing the complete value. The stored normalized plan contains the resolved value, not a browser placeholder. {installPath} is available only for archive packages and never refers to a path on the Code as Usual host.

For archive packages, Code as Usual automatically chooses the isolated default /opt/code-as-usual/packages/PACKAGE-KEY/VERSION. The location is shown near the end of the Validation step. It remains read-only unless the administrator explicitly enables the advanced override. Enabling that override displays a warning because fixed paths can collide with other packages or make an environment build unstable. A normal guided template must rely on the generated location; only software that explicitly requires a fixed absolute path should supply an override.

A package that needs Java should therefore declare a Java capability under Depends on. A Java package declares that capability and exports the JAVA_HOME appropriate for its own installation. The dependent package does not guess or repeat Java’s internal path. The project screen shows missing requirements and compatible enabled providers before saving, and the server checks the complete selection again.

Start blank or import a guided template

A guided template is a versioned JSON file. It contains reusable knowledge about one product and declares the values an installation administrator must supply. Every requested value has a label, detailed help, an example and an optional safe default. A template may ask for such things as a product version, direct archive URL, published checksum and dependency capability. The platform normally supplies the installation directory.

Loading a template is local to the browser. It neither uploads the template nor saves or builds a package. The guide has two explicit starting paths.

  1. Select Load from our repository, Load local file or Create package without a template.
  2. The repository path reads the package template library. Choose a compatible, versioned template. For local import, drop the .cau-package.json file onto the upload area or select it with Choose JSON file. Then select Continue.
  3. Read the template description and the help below every requested value. Enter the missing release-specific values and select Continue. There is no separate Apply action.
  4. The guide now shows the completed generic package definition. Review its Source fields and continue through Runtime and Validation. The blank path opens this same Source step immediately, with empty fields.
  5. Near the end of Validation, check the generated installation location. Do not enable its advanced override unless the software requires a fixed path.
  6. On Review, check the normalized source, checksum, extraction path, executable links and validation argument list.
  7. Select Save draft.
  8. On the new release card, select Validate and publish.

Every package card has a collapsed Definition and audit details section. Use Export reusable JSON there only when you need to inspect a definition, retain it for audit or reuse it as a starting point. It is deliberately not a primary action on an already published package.

Template file contract

Download the version 1 JSON Schema. Download the version 2 JSON Schema. Download the version 3 JSON Schema.

The top level identifies the format and version, describes the template and contains parameters plus a definition. A parameter key can be referenced as ${key} in any string inside the definition. The browser replaces only declared parameters; duplicate parameter keys, unknown placeholders, missing help text, unsupported input types and wrong field types reject the entire file.

Use a parameter whenever a value varies by release or installation policy. Typical examples are a version, direct download URL and checksum. Keep invariant product knowledge—such as a published command path and a minimum dependency rule—in definition, so the administrator is not asked to make a product-design decision on every import. Format 2 can also carry usageGuide, written in Markdown. It contains the product-specific operating workflow that remains true across installations. The server resolves the same {packageKey}, {version} and {installPath} package variables used by environment values, then installs the guide in the resulting environment image. Do not put credentials or project-specific data in a package guide. The resolved definition is still constrained and normalized by the server, so a template cannot add shell commands or bypass package validation.

Example: Apache Tomcat

Download the Apache Tomcat guided template.

Before opening it, obtain the exact Tomcat archive URL and its SHA-512 checksum from the official Apache distribution. Code as Usual does not guess the current version and does not accept a download without a pinned checksum. The template explains each release- and installation-specific value and supplies only the parts common to Tomcat archives.

The installation directory requested by the template is a path inside the resulting project environment image, not on the Code as Usual host. The Tomcat package does not set JAVA_HOME: it declares a dependency on the generic java capability. The selected Java package owns and exports its own JAVA_HOME value, so the installation administrator does not need to know its internal path.

Expected result: the card first shows Validating and refreshes automatically. It becomes Available only after the artifact passes isolated validation. If it becomes Failed, its bounded error remains on the card; correct the definition in a new release or retry when the external cause has been corrected.

Successful validation publishes immediately. There is no second hidden publish step for server-library packages.

Grant it to a workspace

On an Available release, choose the workspace and select Grant to workspace. This does not yet make the package selectable in projects.

The workspace administrator then opens Administration → Environment catalog, finds the granted server package and selects Enable for projects. A project manager can now select the release under Project settings → Environment.

When the project runtime is built, the server carries the published package’s already normalized installation plan into the final image. It verifies the published artifact digest first, then applies the bounded archive or Ubuntu package instructions and exports the declared environment variables. The project builder does not contain a table of installation-owned product names or versions.

The same build also installs an immutable package index at /usr/local/share/code-as-usual, individual guides below its packages directory and the cau-env command. cau-env describe, cau-env packages and cau-env guide <package-key> give people and AI agents one generic discovery path. Packages without an authored guide still receive generated facts about their paths, commands and exported environment variables.

Revoking a grant or disabling a package removes it from future project revisions. It does not rewrite historical profiles or running environments.

Archive a package

Use Archive package when a draft, failed release or published release should leave the active library. Confirming moves it under Archived packages and prevents it from being granted or enabled for new project revisions.

Archive does not physically delete the definition, validation evidence, published artifact, grants or historical receipts. That retained evidence is needed so existing project revisions remain explainable and reproducible. An archived package that was already enabled can still be disabled, and retained grants can be revoked. Existing environments are not rebuilt or changed.

Use Restore package to return an archived release to exactly the state it had before archiving: Draft, Failed or Available. A restored Draft or Failed release can be corrected. Correct package definition offers the repository template library, local template import and editing of the current values. An imported template must resolve to the same package key and version; published identity remains immutable.

What the safety checks cover

  • The form has no shell or Containerfile input.
  • Archive downloads require an absolute HTTPS URL and a pinned SHA-256 or SHA-512 value.
  • Ubuntu package mode accepts bounded package names.
  • Paths, executable links and environment entries are restricted before a build starts.
  • Artifact validation runs without network access, on a read-only filesystem, with capabilities dropped and process/memory limits.

The build itself needs access to the reviewed archive URL or Ubuntu package repository. The no-network statement applies to validation, not to downloading the declared package.

Use Tomcat in a project

The package supplies Tomcat; it does not build or deploy the project’s web application. The project still needs a compatible JDK, its Wicket/Felix build, WAR deployment/start commands and an application listener port. After the new project environment revision is built and activated, create a normal preview for that port. See Web preview.