Black Friday: add funds and get 2x credit, up to $50 free ($25 → $50, $50 → $100). Use it for anything: domains, hosting, email. Code: BLACKFRIDAY2026 Get 2x credit →

Developers → Guides

Deploy an app with git push

A NameOcean App Server is a Linux server with your project in a git repository. You push, it runs. This guide takes a Flask app from the first push to its own domain with HTTPS; Django, Node.js and Next.js differ in one line.

How requests reach your app

request path
visitor ──HTTPS:443──▶ NameOcean load balancer ──HTTP:80──▶ nginx ──▶ your app on 127.0.0.1:8000

The load balancer holds the certificates, so the server only serves port 80. Your app listens on 127.0.0.1:8000 under supervisor, and nginx passes requests to it.

1. A server and your SSH key

nameocean
$ nameocean servers plans
$ nameocean servers create --plan starter --yes
$ nameocean servers ls
ID   NAME      STATUS   PLAN     DEFAULT DOMAIN          DOMAINS
812  3f9a1c2e  running  starter  3f9a1c2e.nameocean.org  -
$ nameocean servers ssh-keys add 3f9a1c2e

A server is billed monthly; servers create without --yes only shows the price. You can also create it under Dashboard → Hosting. ssh-keys add installs ~/.ssh/id_ed25519.pub, which git uses to push.

2. The project

app.py
import os

from flask import Flask

app = Flask(__name__)


@app.get("/")
def home():
    return f"Hello from {os.environ.get('SITE_NAME', 'NameOcean')}"
requirements.txt
flask
gunicorn

That is all: no build script and no server config. Each deploy sees a Flask app, installs requirements.txt and runs it with gunicorn (what a deploy does).

3. First deploy

nameocean
$ git add . && git commit -m "First deploy"
$ nameocean deploy 3f9a1c2e

nameocean deploy adds a git remote named nameocean, pushes the current branch into /root/app on the server (the server deploys that branch from then on), pushes it to your own origin too, and restarts the apps.

Or: deploy from GitHub on every push

If the code is on GitHub, connect the repository instead of pushing to the server: every push to its branch deploys the server, with no SSH key or git remote. GitHub shows the result next to each commit and under Deployments.

nameocean
$ nameocean github installations --open   # install the NameOcean app, pick repositories
$ nameocean servers github connect 3f9a1c2e acme/site --branch main
3f9a1c2e → acme/site (branch main)
Every push to main deploys this server.
$ git push   # deploys

The server fetches the commit with a short-lived, read-only token for that one repository, then builds and runs it (what a deploy does). If a step fails, the apps are not restarted and the commit gets a red mark. Commits with [skip deploy] in the message are not deployed. The same works from the server page in the dashboard (Deploy tab), the API (PUT /api/v1/servers/{server}/github) and MCP (connect_github_repo).

4. What a deploy does

Every deploy (a push to the server, a push to a connected GitHub repository, nameocean deploy, Deploy now) looks at the project, builds it and runs it:

Next.js, Nuxt, SvelteKit, Astro, Remixnpm / pnpm / yarn install (from the lockfile), build, then the framework's server
Vite, Create React App, static exportsinstall and build, then nginx serves dist/ (or build/, out/) with a fallback to index.html
Node.jsinstall, build if there is one, npm start
Djangopip or uv install, collectstatic, migrate, gunicorn; nginx serves /static/ and /media/
FastAPI · Flaskinstall, then uvicorn · gunicorn (added if missing)
Laravel · PHPPHP-FPM and composer (installed on the first deploy), composer install, asset build, caches, migrate --force; nginx serves public/
Gogo build, then the binary
Dockerfile · composebuilds the image, starts the new container next to the old one and switches only when it answers · docker compose up -d --build and the service that publishes a port
index.htmlnginx serves the files

The app gets PORT (8000) and HOST (127.0.0.1) and your env variables. Supervisor keeps it running and nginx passes requests to it. The deploy fails, and the apps are not restarted, when a step fails; it also fails when the app doesn't answer within 30 seconds, with the end of its log in the output. nameocean servers stack 3f9a1c2e shows what was detected (--preview for the code on the server now), and so does the Deploy tab of the server page.

Change any of it with .nameocean/app.toml; everything is optional:

.nameocean/app.toml
root    = "apps/web"                     # the project's directory in a monorepo
install = "pnpm install --frozen-lockfile"
build   = "pnpm build"
release = "pnpm prisma migrate deploy"   # before the restart
start   = "node .output/server/index.mjs"
port    = 3000                           # if the app ignores $PORT
health  = "/healthz"
# stack = "node"   static, node, python, php, go, docker, compose, none
# static = "dist"  serve a directory, no process
# manage = false   build only, never write supervisor/nginx config

[processes]
worker = "celery -A proj worker -l info"

A Procfile (web:, release:, worker:) works too. /root/conf/supervisor.conf and nginx.conf are written only while they are NameOcean's: edit one by hand and deploys leave it alone (delete it to hand it back). A project that has .nameocean/deploy.sh and no app.toml keeps working as before: only deploy.sh runs and no config is written. NAMEOCEAN_BUILD=0 in the env variables turns detection off for a server.

Releases and rollback

On servers created since 30 November 2026, every deploy builds the commit in a new directory, /root/releases/<time>-<commit>, while the current version keeps serving. The new version starts next to the old one (port 8001 next to 8000), and nginx switches to it only when it answers; then the old one stops. A deploy that fails, or an app that doesn't answer, changes nothing: the site keeps running the previous release.

nameocean
$ nameocean servers deploys 3f9a1c2e        # live and restorable deploys
$ nameocean servers rollback 3f9a1c2e       # back to the previous release, no build
$ nameocean servers rollback 3f9a1c2e 412   # or to a given deploy

The last 5 releases stay on the server, and a rollback to one of them takes seconds. It does the same switch as a deploy and doesn't build anything. Database migrations that newer releases ran are not undone, and if the server deploys from GitHub, the next push deploys over the rollback. The same is on the Deploy tab of the server page (Restore), the API (POST /api/v1/servers/{server}/deploys/{id}/rollback) and MCP (rollback_deploy).

/root/app is a link to the live release, and the repository is /root/app.git. Files your app writes while it runs must live outside the release, or the next deploy won't have them: .env, *.sqlite3 at the project root, media/, uploads/ and storage/ are kept in /root/shared and linked into every release. List other paths in .nameocean/app.toml:

.nameocean/app.toml
shared = ["data", "public/avatars"]

Some deploys restart the app in place for a moment instead: when the server's memory can't hold two copies of the app, when /root/conf/supervisor.conf is your own, or when app.toml sets a fixed port. Projects with .nameocean/deploy.sh and no app.toml, and servers created before 30 November 2026, keep deploying in place in /root/app.

Previews

On servers created since 30 November 2026, any branch you push to the server can run next to the live site at its own address, https://<branch>-3f9a1c2e.nameocean.org. The live site is not touched.

nameocean
$ git push nameocean feature/login
$ nameocean servers previews create 3f9a1c2e feature/login
Building the preview of feature/login (a1b2c3d)...
Ready: https://feature-login-3f9a1c2e.nameocean.org
$ nameocean servers previews 3f9a1c2e             # list
$ nameocean servers previews rebuild 3f9a1c2e feature-login
$ nameocean servers previews rm 3f9a1c2e feature-login

A preview is built like a deploy: it gets the same detection, install and build steps, and its own process with its own port. Search engines are told not to index it. If a rebuild fails, the preview keeps serving the build it had. They are also on the Deploy tab of the server page, in the API (POST /api/v1/servers/{server}/previews) and in MCP (create_preview).

Previews can also be made without asking. Turn it on once per server:

nameocean
$ nameocean servers previews auto 3f9a1c2e pull_requests   # or branches, or off

pull_requests: on a server connected to a GitHub repository, every pull request gets a preview. Each new commit rebuilds it, closing the pull request removes it, and GitHub shows a View deployment button with the address. Pull requests from forks never get one, because their code would run with your server's env variables. branches: the same, and every other branch you push (to GitHub or straight to the server) gets one too. git push nameocean feature/login then prints the preview's address, and deleting the branch removes it.

The plan sets how many previews a server can have: Free none, Tiny 1, Starter 2, Growth 3, Pro and Business 5. When a pushed branch would go over the limit, it replaces the oldest preview made by a push; previews you created by hand are never replaced. A preview with no build for 14 days is removed.

A preview uses the server's env variables, files in /root/shared and database. So its release step (migrations) doesn't run, and neither do the workers in [processes], unless you ask for them. The app can tell it is a preview from NAMEOCEAN_PREVIEW=1, NAMEOCEAN_PREVIEW_URL and NAMEOCEAN_BRANCH.

.nameocean/app.toml
[preview]
release   = "python manage.py migrate"   # only with a separate database:
processes = true                         # run the [processes] workers too

[preview.env]
DATABASE_URL = "postgresql://app:…@127.0.0.1:5432/app_preview"

Dockerfile and compose projects can't have previews yet.

5. Settings and secrets

nameocean
$ nameocean servers env set 3f9a1c2e SITE_NAME=Kahvebot SECRET_KEY=…

Every app, deploy.sh and SSH session gets them, and the apps restart to read them. They are kept on the server only, never in the repository or in NameOcean's database.

6. Your domain

nameocean
$ nameocean bind kahvebot.com 3f9a1c2e

The domain's DNS must be on NameOcean. NameOcean adds the DNS records, issues the certificate and sets up the load balancer (HTTP to HTTPS, and the bare domain to www); it usually takes a few minutes. Nothing changes on the server.

7. Every deploy after that

nameocean
$ git commit -am "New page"
$ nameocean deploy
$ nameocean servers logs 3f9a1c2e --app app -f   # if it does not come up

Each deploy sends a server.deployed webhook event with the commit and whether the apps came up. Backups, restarts and the rest of the API: App Server API. The server has a guide for AI agents in /root/AGENTS.md.