Developers → App servers

App Server API

Run your app on a NameOcean App Server and manage it from code: push to deploy, restart the apps, read their logs, keep secrets in env variables, and back up or restore the whole server.

Deploy with git

Every App Server has a git repository in /root/app. A push writes the pushed branch there and runs .nameocean/deploy.sh if your project has one. nameocean deploy does the whole round trip:

nameocean
$ nameocean deploy 3f9a1c2e
Remote nameocean → ssh://root@3f9a1c2e.nameocean.org:2152/root/app (added)
Pushed main to nameocean (3f9a1c2 Fix checkout)
Pushed main to origin
Restarted 2 apps, nginx reloaded: web running, worker running
  1. Adds a git remote named nameocean for the server if the project doesn't have it.
  2. Pushes the current branch to the server's repository.
  3. Pushes it to the project's own remote too (its upstream, or origin), unless you pass --no-origin.
  4. Restarts every supervisor program and reloads nginx, then records the deploy (POST /servers/{server}/deploys) and sends a server.deployed event.

The push uses your SSH key. If the server doesn't know it yet: nameocean servers ssh-keys add 3f9a1c2e (it reads ~/.ssh/id_ed25519.pub). A plain git push deploys the files as well; call POST /servers/{server}/deploys after it to restart the apps.

Endpoints

Scopes servers:read and servers:write; creating a server also needs billing:write. {server} is the id or the default domain. Everything is in the API reference.

GET /servers/plans · POST /serversPlans and prices; create a server (first answer is the price, then send confirm: true)
POST /servers/{server}/start · stop · restartStart, stop or reboot the server
GET /servers/{server}/apps · POST …/reloadSupervisor programs and their state; restart them all and reload nginx
GET /servers/{server}/logs?app=web&lines=200The last lines of an app's output, or app=nginx
GET · PATCH /servers/{server}/envEnv variables every app gets; the apps restart after a change
GET · POST · DELETE /servers/{server}/ssh-keysKeys that can log in and push
GET · POST /servers/{server}/backups · POST …/backups/restoreList backups, back up now, restore one over the server
POST /servers/{server}/git · GET · POST …/deploysPrepare the push target; the deployed commit and the deploy history

Env variables

curl
$ curl -X PATCH https://nameocean.net/api/v1/servers/3f9a1c2e/env \
    -H "Authorization: Bearer $NAMEOCEAN_API_KEY" -H "Content-Type: application/json" \
    -d '{"set": {"DATABASE_URL": "postgres://app@127.0.0.1/app"}, "unset": ["DEBUG"]}'

They are kept on the server only, in /root/conf/env, never in our database. Supervisor programs, SSH sessions and .nameocean/deploy.sh get them. Reading them needs servers:write, and the AI over MCP sees their names, not their values.

Events

Webhooks can subscribe to server.*: server.created, server.started, server.stopped, server.restarted, server.restore.started and server.deployed (with the commit and whether the apps came up).

From the terminal

nameocean
$ nameocean deploy 3f9a1c2e
$ nameocean servers logs 3f9a1c2e --app web -n 200
$ nameocean servers env set 3f9a1c2e DATABASE_URL=postgres://app@127.0.0.1/app
$ nameocean servers restart-apps 3f9a1c2e
$ nameocean servers backups ls 3f9a1c2e

From your AI

Over MCP an assistant can read logs, restart apps, set env variables, finish a deploy after pushing, back up a server and, after showing you the price, create one. Stopping, restarting and restoring ask for your OK first.