Skip to content
Skip to Content

Deploy from Git

Build a service from a repository, a branch and a folder in one of your Git accounts, on your own server, at the branch's newest commit or the one you name.

A service can come from a Git repository. Each deploy clones it on one of your servers, builds an image there, and then starts it. Nothing is built on OpenPanel's own servers.

What a Git service needs

SettingWhat it takes
Git accountOne of your organization's Git accounts, by its id. openpanel git lists them.
Repositoryowner/name, such as acme/shop; GitLab groups can be deeper, such as acme/web/shop.
BranchThe branch to build. main when you give none.
FolderFor a monorepo: the service's folder in the repository, such as apps/web. The repository's root when you give none. A folder cannot lead out of the repository.
BuildRailpack, which works out how to build the folder, or a Dockerfile you name. See How builds work.

For an account added as one repository over SSH or HTTPS (Any Git server), the build clones that repository. The repository setting is still required: give its owner/name as the Git host shows it.

Create a service from a repository

Open the project. Click New service and choose A Git repository. Choose the Git account, the Repository and the Branch, and for a monorepo the Folder. Under Build and start, keep Auto or choose Dockerfile. Tick a server under Servers it may run on, and click Create service.

Deploy a branch or a commit

A deploy builds the branch's newest commit. To build an exact commit, give its hash, 7 to 64 hexadecimal characters:

Open the project and click the service on the canvas. To build another branch, change the Branch in the Source card of its Settings tab, click Save, then Deploy on its Overview tab. The console always builds the branch's newest commit; to build an exact commit, use the CLI or the API.

The deployment moves through queued (waiting for the server to start the build), building, deploying and running. Once the build ends, the deployment's commit field still shows what you asked for; the build's own output names the full commit it built. To deploy on every push instead, turn on push to deploy.

Where the build runs

The build runs on the first server the deployment is placed on, by OpenPanel's agent there, one build at a time per server. The agent:

  1. clones the branch's newest commit, or the commit you named, without the rest of the history where the Git host allows it;
  2. builds the service's folder with its Dockerfile or with Railpack;
  3. keeps the image on that server under a name of its own for this deployment, and reports that the build succeeded;
  4. starts the new containers once the deployment is deploying.

See How builds work for the details, the time limit and the cache.

A Git service on several servers

A Git service placed on more than one server is built once and pushed to your organization's own registry, and each of its servers pulls the image from there. The registry travels over the private network, so every server of the service must be in it; OpenPanel refuses the deploy while one is not, for example a server added with One command. See Replicas.

Private repositories

A private repository needs a Git account with a token, a password or a deploy key. The account's credentials leave OpenPanel sealed for its gateway, which hands them to the agent for this one build:

  • a token or password goes in an HTTP header for the repository's own host, never in the address or on a command line;
  • an SSH key goes to a file only that build reads, and is deleted with the build's folder when it ends.

What can go wrong

MessageWhat it means
"That Git account was not found."The account id is wrong, the account was removed, or it is another member's own account.
"Choose the repository as owner/name."The repository is not in the owner/name form.
"A commit is its hexadecimal hash."--commit or commit was not 7 to 64 hexadecimal characters. A branch name does not go there.
"Choose at least one server for this service before deploying."The service has no server it may run on, or all of them are disconnected.
"The build failed: …"The clone or the build stopped. See A build fails.