You inherit an environment that was installed by clicking three things in the Jelastic UI. The next person who needs to recreate it from scratch — a customer’s staging clone, a disaster-recovery rebuild, a fork for a sister project — opens a ticket because nobody wrote down the steps. You decide you’re done with that, sit down to write a JPS manifest, and then realize the JPS documentation is mostly reference material that assumes you already know what onAfterInstall does versus onAfterScaleOut and where to put the settings block so the user actually sees a form. The first manifest takes a day. The second takes an hour. This article gives you the first one.
What’s happening
A JPS (Jelastic Packaging Standard) manifest is a single YAML or JSON file that tells Jelastic how to build an environment from zero: which node types and versions, in which region, with what topology, what files to drop in, what commands to run on each node, and what UI to show the operator while it’s installing. It’s the API between “an environment that exists” and “an environment that can be installed by clicking a button.” Marketplace packages are JPS manifests that Virtuozzo or community members have published; your own JPS manifest goes through the same engine.
Six top-level sections matter:
type— usuallyinstall.updateis a different lifecycle (covered in the upgrade-hooks article).name/description/logo— what shows up in the marketplace card and in the install dialog header.baseUrl— the URL where supporting assets (scripts, config templates, SQL files) live. Relative paths incmdactions resolve against this.settings— the install form. Field IDs become variables you can reference as${settings.fieldId}later. Keep this short; every field is a chance for the operator to type something wrong.nodes— the topology. Node groups (cp,bl,sqldb,nosqldb,storage,vds,extra) plus image and version. Cloudlets per node, count, display name.onInstallandonAfterInstall— the actions block.onInstallruns during the install while the UI shows progress;onAfterInstallfires when nodes exist and you need to put files on them or run commands inside them.
The order of operations the engine guarantees: it provisions nodes, runs onInstall actions, then onAfterInstall. Inside each action list, items run sequentially. If anything in onInstall returns a non-zero exit code or a non-success JSON, the install aborts and the environment is marked failed — partially built. (The recovery article in this series covers that case.) onAfterInstall failures do not roll back nodes, only abort remaining steps.
How to verify
Before you deploy, validate the manifest locally. You don’t have to push it to Jelastic to find structural errors:
# 1. YAML syntax check
python3 -c "import yaml,sys; yaml.safe_load(open('manifest.yml'))" \
&& echo "YAML OK"
# 2. Schema-aware lint (community schema, not official)
npx jps-validator manifest.yml
# 3. Render the install form to see what the operator will see
curl -sX POST 'https://app.<your-paas>.com/1.0/marketplace/jps/GetManifest' \
-d "manifest=$(cat manifest.yml | jq -sRr @uri)" \
| jq '.response.settings'
If settings renders as null, your form will be empty in the UI and the install will use the defaults silently — a frequent source of “why did it deploy to the wrong region” tickets.
Once deployed to a test environment, check the install log from the Jelastic dashboard (Environment → Settings → Log History) or via the CLI:
# CLI: pull the last install log
jelastic environment.control.GetEnvInfo \
--envName mytest --session "$SESSION_ID" \
| jq '.env.log'
# Per-node post-install state
jelastic environment.control.ExecCmdById \
--envName mytest --session "$SESSION_ID" \
--nodeId 12345 --commandList '[{"command":"systemctl status myapp"}]'
If onAfterInstall ran cmd actions, their stdout and stderr are captured in the log. If a cmd fails silently because you wrote command: foo instead of cmd: [foo], you’ll see an empty action result and an installed-but-broken environment. The schema is unforgiving about field names.
The fix
Save the following as manifest.yml. It deploys a two-node environment: one application server (Nginx-PHP 8.3) and one MySQL 8 database, drops in a small PHP app, creates the schema from an SQL file, and runs a smoke test before signaling success.
type: install
version: 1.6
jpsType: install
name: Acme PHP Demo
id: acme-php-demo
description:
text: A small PHP app fronted by Nginx with a MySQL 8 backend.
short: Acme PHP demo — production-ready scaffold for new tenants.
logo: https://assets.example.com/acme/logo.png
baseUrl: https://assets.example.com/acme/jps/1.0
categories:
- apps/web
- apps/php
settings:
fields:
- name: envDisplayName
caption: Environment display name
type: string
required: true
default: Acme demo
- name: adminEmail
caption: Notification email
type: string
required: true
regex: "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$"
regexText: Must be a valid email address.
- name: region
caption: Region
type: list
required: true
default: yyz
values:
yyz: Toronto (yyz)
cdg: Paris (cdg)
iad: Ashburn (iad)
- name: appVersion
caption: App version
type: string
required: true
default: 1.4.2
regex: "^[0-9]+\\.[0-9]+\\.[0-9]+$"
regexText: Use semantic versioning, e.g. 1.4.2.
nodes:
- nodeType: nginxphp
nodeGroup: cp
displayName: AppServer
cloudlets: 16
count: 1
fixedCloudlets: 4
extip: false
tag: 8.3
- nodeType: mysql8
nodeGroup: sqldb
displayName: Database
cloudlets: 12
count: 1
fixedCloudlets: 4
extip: false
diskLimit: 20G
globals:
DB_NAME: acme
DB_USER: acme_app
DB_PASSWORD: ${fn.password(24)}
ADMIN_TOKEN: ${fn.password(40)}
onInstall:
- log: "Beginning Acme PHP demo install for ${settings.envDisplayName}"
# Database: create schema + user
- cmd[sqldb]: |-
mysql -uroot -p${nodes.sqldb.password} <<SQL
CREATE DATABASE IF NOT EXISTS ${globals.DB_NAME}
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS '${globals.DB_USER}'@'%'
IDENTIFIED BY '${globals.DB_PASSWORD}';
GRANT ALL ON ${globals.DB_NAME}.* TO '${globals.DB_USER}'@'%';
FLUSH PRIVILEGES;
SQL
user: root
# App server: install dependencies the base image doesn't ship with
- cmd[cp]: |-
yum install -y --nogpgcheck unzip git jq
user: root
onAfterInstall:
# Drop the schema file in and load it
- upload:
- nodeGroup: sqldb
sourcePath: ${baseUrl}/sql/schema-${settings.appVersion}.sql
destPath: /tmp/schema.sql
- cmd[sqldb]: |-
mysql -u${globals.DB_USER} -p${globals.DB_PASSWORD} \
${globals.DB_NAME} < /tmp/schema.sql
rm -f /tmp/schema.sql
user: root
# Drop the app tarball and explode it under the webroot
- upload:
- nodeGroup: cp
sourcePath: ${baseUrl}/releases/acme-${settings.appVersion}.tar.gz
destPath: /tmp/app.tar.gz
- cmd[cp]: |-
mkdir -p /var/www/webroot/ROOT
tar -xzf /tmp/app.tar.gz -C /var/www/webroot/ROOT --strip-components=1
rm -f /tmp/app.tar.gz
chown -R nginx:nginx /var/www/webroot/ROOT
user: root
# Template the app config
- cmd[cp]: |-
cat > /var/www/webroot/ROOT/config/env.php <<PHP
<?php
return [
'db_host' => '${nodes.sqldb.address}',
'db_name' => '${globals.DB_NAME}',
'db_user' => '${globals.DB_USER}',
'db_password' => '${globals.DB_PASSWORD}',
'admin_email' => '${settings.adminEmail}',
'admin_token' => '${globals.ADMIN_TOKEN}',
'env_name' => '${env.envName}',
'app_version' => '${settings.appVersion}',
];
PHP
chmod 640 /var/www/webroot/ROOT/config/env.php
chown nginx:nginx /var/www/webroot/ROOT/config/env.php
user: root
# Reload the web server with the new config
- api: env.control.ExecCmdByGroup
nodeGroup: cp
commandList:
- command: nginx -t && systemctl reload nginx
sayYes: true
# Smoke test — abort install if the health endpoint isn't 200
- cmd[cp]: |-
for i in $(seq 1 20); do
code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1/health)
if [ "$code" = "200" ]; then
echo "Health OK"
exit 0
fi
sleep 3
done
echo "Health endpoint never returned 200" >&2
exit 1
user: root
- log: "Acme PHP demo install complete — admin token in env.php"
success:
text: |-
Acme demo is up. Application: https://${env.domain}
The admin token is stored in /var/www/webroot/ROOT/config/env.php on
the AppServer node. Rotate it via the platform's secrets workflow
before sharing this environment with a customer.
email: |-
Acme demo for ${settings.envDisplayName} is installed.
Admin email of record: ${settings.adminEmail}.
A few non-obvious things in there worth calling out:
${fn.password(N)}generates a random alphanumeric string at install time. Use it for any credential you don’t want the operator typing into the install form. Output is captured inglobalsand survives across actions in this install run.cmd[sqldb]is the shorthand for “run this on every node in thesqldbgroup.” You can target a specific node withcmd[nodeId]wherenodeIdis the integer ID, but that only makes sense after the environment exists.uploadis the right way to deliver static assets.cmd: curl -O ${baseUrl}/fileworks too, butuploadproduces a clean error if the file isn’t reachable, wherecurlwill happily write a 404 HTML page to disk.nginx -t && systemctl reload nginxahead of any actualreload— if your templating produced an invalid config, you want the install to abort here, not at the smoke-test step where the failure mode is harder to read.- The smoke test at the end is what separates a manifest that’s correct on paper from one that actually works. It costs a minute of install time and saves you from “the install said success but the site is 502” tickets.
Deploy it from the CLI to a fresh test environment:
jelastic marketplace.app.Install \
--manifest "$(cat manifest.yml)" \
--envName acme-demo-test \
--displayName "Acme demo (test)" \
--region yyz \
--session "$SESSION_ID"
Watch the log stream while it runs. When it succeeds, hit https://acme-demo-test.<your-paas>.com/ and confirm the page loads. When it doesn’t, the engine tells you which action failed, with stderr captured — fix the action, bump the version comment at the top of the manifest, and run the install on a fresh environment. JPS does not have a real “patch the running install” mode; you fix forward by reinstalling or by writing an update manifest, which is its own discipline.
Stack Harbor builds and maintains custom JPS manifests for customers running on our Cloud PaaS platform — environment templates, marketplace forks, and the install pipelines that promote them through staging. If you’d like us to author or audit a JPS manifest before you put it in front of customers, book a scoping call or read about how environment management keeps those templates current.