deploy: Pull, compile and activate code

Deploy the latest Git changes to a running Zotonic node.

Syntax

bin/zotonic deploy [git-working-tree]

Requirements and effects

Requires a reachable Zotonic node, Git, and a working tree with an upstream branch configured. Without an argument, the command deploys the Zotonic repository. Supply a path to deploy a separate site or module repository.

The command waits for active schema migrations and pauses automatic file updates. It then runs git pull --ff-only, compiles the containing Zotonic installation, and activates changed Erlang modules together. Buffered file updates resume after successful deployment; site restarts and schema migrations continue through the normal module-manager queue.

Before pulling, the command restores the repository’s tracked rebar.lock from HEAD. This discards staged and unstaged changes to that file. Other local changes and untracked files are preserved, although conflicting changes can prevent the pull.

Do not run concurrent pulls, external compilers, or manual code-loading commands during deployment. The deployment coordinates code activation and schema migrations on this node; it does not prevent visitors from seeing files change in the working tree.

If pulling, compilation, or activation fails, the command reports an error and exits with a nonzero status. Fix the problem and run bin/zotonic update to complete a full rebuild and resume buffered updates.

Example

# Deploy the Zotonic repository.
bin/zotonic deploy

# Deploy a separate site repository.
bin/zotonic deploy /path/to/site-repository

Run commands from the Zotonic workspace root. Replace the example path with the Git working tree to deploy. All sites or modules contained in that repository are updated together.