Deploying your own modules from a repository
Connect a GitHub or GitLab repository, public or private, so every push builds your modules onto your server.
Your own modules can live in a GitHub or GitLab repository. Once it is connected, every push to its branch is built onto your server: the code is fetched and checked against your server's version of Fullfinity first, so a push that would break your server fails its build and changes nothing. Each module is a folder with a manifest.yaml at the root of the repository.
Connect the repository
- Open your server from Servers and go to the Code & domains tab.
- Under Repositories, click Connect Repository.
- Enter the Repository URL, such as https://github.com/acme/modules, choose the Provider and click Connect.
Two numbered steps appear under the card. Do both, then click Done. Production follows the repository's default branch, as the repository itself names it. A private repository's branches can be read only once its deploy key is added: then open the repository's menu, choose Choose Branches and click Refresh Branches.
Add the deploy key (private repositories)
A private repository is read with a deploy key your server makes for it. The key works only for that one repository, can only read it, never expires and belongs to nobody's personal account. Its secret half never leaves your server; you are shown only the half you add to the repository.
- GitHub: in the repository, open Settings → Deploy keys → Add deploy key, paste the Deploy key and leave Allow write access off.
- GitLab: in the project, open Settings → Repository → Deploy keys, add a new key with the Deploy key and leave write access off.
A public repository needs no key. To see the key again later, open the More actions menu on the repository and choose Show Deploy Key.
Add the webhook
The webhook is how your repository tells the server about a push. Add one in the repository's webhook settings with the URL and secret shown, sending push events only; either content type works. The secret is shown only once: copy it before you click Done. If it is ever exposed, choose New Webhook Secret from the repository's menu and give the webhook the new one; pushes signed with the old secret are refused from then on.
What a build does
Every push to the branch, and every Build Now, runs the same steps. First the build is rehearsed: your modules are checked, then each database the build goes into is copied and the update is run on the copy with the new code. Modules new to a database are installed and the ones it already has are updated, so new fields, views and data arrive with each push. Then the tests in your modules' tests folders run on that copy, each one rolled back. If anything fails there, a check, the update or a test, the build stops and nothing on the server has changed: your app kept serving throughout. The log names the tests that failed and why. Tests that run longer than 15 minutes stop the build.
Once the rehearsal has passed, your app stops for the update itself, usually a minute or two, and visitors see a page saying the site is being updated. A copy of every database is taken, the databases are updated, the new code goes live and the app starts again. Should the update fail even so, on any one database, every database is put back from its copy, not only the one that failed, the previous code is put back and the app starts on it. The log says which databases were put back.
A build needs room for a copy of the databases, both for the rehearsal and while the update runs. If the server has too little free space, the build says so before anything changes; add storage, then build again.
Renaming or removing a field needs a record of the change in your repository: run fullfinity-server resolve for the module and commit the files it writes. A build without one fails its check and says so.
Choose which branch each target follows
Production and each staging copy of the server can follow a branch of the repository, or none. A push to a branch builds into every target that follows it, so a staging copy can follow develop while production follows your release branch. Choose them from the repository's menu with Choose Branches; Refresh Branches reads the repository's branches again.
If a followed branch is deleted from the repository, or a staging copy that followed one is deleted, that target stops following and the repository says so once. It is never moved to another branch or into production by itself; choose a branch again when you are ready.
Build Now builds production at the branch it follows. Build a Branch or Tag builds any branch or tag, into production or a staging copy. Each repository shows its last build: where it went, its commit and when. Click View Log to read what the build did and, if it failed, why.
To stop deploying from a repository, choose Disconnect from its menu. The server deletes its deploy key; the modules it installed stay installed.