With git push

Push to a repository on the server: the push shows the build, and fails if the deploy does.

On this page

Every app has a git repository on the server. Pushing its production branch deploys it: the build is shown in your terminal as it happens, and the push fails if the deploy does.

Once: register your SSH key#

moor keys add

That registers ~/.ssh/id_ed25519.pub (or id_ecdsa.pub, or id_rsa.pub; name another file to use it) on your account. Moorage accepts Ed25519, ECDSA and RSA keys of 3072 bits or more. moor keys lists yours, moor keys remove NAME removes one. A push is recorded as yours, and until projects arrive, any account may push to any app.

For each app: add the remote, push#

In the app's repository:

moor git remote
git push moorage main

moor git remote adds a remote named moorage, for the app named by [app].name in moorage.toml (or --app, or the directory's name), such as ssh://git@moorage.apps.example.com:2222/hello.git. The app need not exist: the first push creates it.

remote: moorage  created the app hello
remote: moorage  hello · production · dep_01M6HGSPPT25AQVD820A37WKEF
remote: ▸ source     main @ 9b8f6c7  First version
remote: ▸ detected   static
remote: ▸ built      9 files, 9.8 KiB in 0s
remote: ✔ live       v1  https://hello.apps.example.com  (0s)
To ssh://moorage.apps.example.com:2222/hello.git
 * [new branch]      main -> main

The first time, ssh asks you to trust the server's host key: its fingerprint is in the server's log, on the line that starts the SSH listener (git pushes over SSH … host_key=SHA256:…).

Once the remote is there, the other commands find the app from it: moor logs -f, moor rollback and the rest need no --app.

What a push does#

PushWhat happens
The production branchDeployed to production. The production branch is the repository's default branch: main, or, if the first push had no main, the first branch it pushed.
A branch named in [environments.NAME]Deployed to that environment.
Another branchDeployed to a preview of its own, at its own address.
A tagKept, not deployed.
git push moorage --delete BRANCHThe branch is deleted, and its preview destroyed; the production branch cannot be.
A commit whose message contains [skip deploy]Kept, not deployed.
What touches nothing in watch of [app], or moorage.tomlKept, not deployed.

A locked environment takes no deployments: the commits are kept, and not deployed, and the push says so.

A failed deploy fails the push. The deploy runs before the branch moves: if it fails, git reports the push as rejected, with the deployment's ID and why, and the branch on the server stays where it was. Fix the problem and push again. The previous release keeps serving meanwhile.

Ctrl-C leaves the deploy running. Follow it with moor deployments follow ID; the branch moves if it succeeds.

Force pushes are accepted: Moorage is where you deploy, not where the code is kept. Two pushes to one branch do not deploy at once: the second is refused until the first has finished. Pushes to different branches, or apps, go on side by side.

Push options#

git push -o OPTION changes one push:

OptionEffect
skip-deployKeep the commits without deploying them.
detachAccept the push at once; the deploy goes on (follow it with moor deployments follow ID).
env=NAMEDeploy this branch to that environment, which must exist, whatever the branch's name.
git push -o detach moorage main

Over HTTPS#

Where SSH is blocked, push over HTTPS with the API token:

moor git remote --http

The remote is https://moorage.apps.example.com/git/hello.git, and moor git remote --http sets up moor git credential for it, a git credential helper that gives git the token of the server moor talks to. The token is not given to any other host, and not stored in a keychain.

In a script, use an API token as the password (Accounts and access): pushing needs the deploy scope, fetching the read scope, and a token restricted to an app reaches only that app's repository. A disabled user's keys and tokens stop working at once.

What is deployed#

The commit's files, as moor deploy would upload them: what .moorignore excludes is left out, and so are node_modules, .venv and __pycache__. Symbolic links and submodules are left out, and the push says so. Git LFS is not supported: the app gets the pointer files, and the push warns.

moor deployments shows what each push deployed:

ID                               SOURCE              STATUS   RELEASE   TOOK   CREATED
dep_01M6HGT4BCTV2TNH0QKAN2W603   push main@0bb5a15   live     v2        0s     just now

Limits#

Suggest a change to this page