Pengguna baharuPelan DNS dan CDN percuma untuk setiap akaun baharu.Cipta akaun anda

Deploy an app

Deploy long-running Node.js, Python and Go apps in a Dedicated Container, and manage PHP-FPM, PHP versions, extensions and php.ini.

5 minit bacaan Dikemas kini 20 Okt 2026

This guide explains how to deploy a long-running Node.js, Python or Go app in a Dedicated Container, how to manage PHP-FPM, and how to switch PHP versions, install extensions and edit php.ini.

Runtimes

Every container comes with the following runtimes, available on the default PATH (node, npm, python3, go, java, ruby, php and so on):

RuntimeVersions
PHP8.1 and 8.2, switchable from the console
Node.js, Python, Go, Java, RubyOne version of each per image

To see the exact versions, open the container's Configuration management tab and look at the Runtime environment card.

Deploying an app

The App management tab on the container page has four runtime cards: PHP-FPM, Node.js, Python and Golang. If no app has been deployed yet, the Node.js, Python and Golang cards show a Deploy app button.

Step 1: Upload your code

Your code must sit in /var/www/html inside the container, or in a subdirectory of it. In the File manager tab, the root / is the container's /var/www/html. You can upload an archive and extract it in place, or use Remote download to fetch it from a URL. See Files and scheduled tasks.

If your app needs dependencies (for example from npm install or pip install), build it locally and upload the directory with the dependencies included.

Step 2: Enter the start settings

  1. Open the container page and switch to the App management tab.

  2. On the runtime card you need, click Deploy app.

  3. Fill in the dialog:

    FieldDescription
    Start commandThe full command that starts your app, e.g. node app.js, npm start, python app.py, gunicorn app:app -b 0.0.0.0:$PORT or ./app
    Working directoryThe directory the command runs in. Defaults to /var/www/html
    Listening portThe port your app listens on inside the container. Defaults to 3000; range 1–65535
  4. Click Deploy and start. When you see "App deployed and started", the card status changes to Running.

Tip

The port you enter is passed to your process as the PORT environment variable. Read PORT in your code (for example process.env.PORT in Node.js) so the port isn't hard-coded.

How the start command runs

  • The command runs through /bin/sh -c, so you can pass arguments, expand environment variables (such as $PORT) and use simple shell syntax.
  • The app runs as the container's www user. Make sure that user can read your code files and write to any directories your app writes to.
  • A process manager inside the container supervises the app. It starts the app when the container starts and restarts it automatically if it exits unexpectedly.
  • For Go, compile a Linux binary locally, upload it, then use a command such as ./app.

One app per runtime

Each runtime card manages one app process. For example, the Node.js card can run one Node.js app. Once an app is deployed, the card's Deploy app button is replaced by Start, Stop, Restart and Logs.

Managing a running app

In the App management tab:

  • Start / Stop / Restart control the app process.
  • Logs shows the last 200 lines of the app's stdout and stderr. Click Refresh in the dialog to reload them.
  • Refresh status reloads all runtime cards. Each card shows the version, PID and uptime when they're available.

If no app has been deployed for a runtime, its card shows Stopped with a Deploy app button. Clicking Start at this point tells you to deploy an app first.

PHP-FPM

PHP-FPM runs by default in every container, so you don't need to deploy it. The PHP-FPM card lets you stop, start or restart it and view its logs.

Switching the PHP version

  1. Click Switch PHP version. The button is in Quick actions on the Overview tab, and on the PHP configuration card in the Configuration management tab.
  2. Choose PHP 8.1 or PHP 8.2 and click Confirm switch.

PHP-FPM restarts automatically after the switch, and every piece of code that uses the default PHP is affected. Check that your code works with the target version before you switch.

Extensions and php.ini

Open the PHP configuration tab:

  • PHP extensions: loaded extensions appear as green tags. Click a tag to disable that extension, but be careful with core extensions. To install one, type its name (e.g. redis, imap, soap, gmp) and click Install. Extensions are installed from the official Alpine packages.
  • php.ini: edit the full php.ini of the active PHP version in the browser. When you save, PHP-FPM hot-restarts automatically.
Note

Extensions and php.ini apply only to the active PHP version. After switching versions, click Refresh to load that version's configuration.

Monitoring and container actions

  • The Overview tab shows CPU usage, memory usage, disk usage and network traffic, plus the container's CPU, memory and disk limits.
  • The buttons at the top Start, Stop and Restart the container. While the container is stopped, none of its apps are available.
  • You can Delete a container from the Dedicated Containers list. Deleting a container permanently erases all of its data, and it can't be recovered.

Deploying through the API

The endpoints the console uses can also be called directly. Send your login token in the Authorization: Bearer <token> header. container_id is the id returned by the container list.

bash
# List containers
curl -H "Authorization: Bearer $TOKEN" \
  https://api.yeap.cloud/api/user/host/containers

# Deploy a Node.js app
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://api.yeap.cloud/api/user/host/apps/create \
  -d '{"container_id": 123, "type": "nodejs", "config": "node app.js", "working_dir": "/var/www/html", "port": 3000}'

# App status and recent logs
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.yeap.cloud/api/user/host/apps/status?container_id=123&type=nodejs"
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.yeap.cloud/api/user/host/apps/logs?container_id=123&type=nodejs&lines=200"

type can be nodejs, python or golang. To start, stop or restart, call POST /api/user/host/apps/start, /stop or /restart with the body {"container_id": 123, "type": "nodejs"}.

Adakah halaman ini membantu?