cardinal

Your first site

Create a workspace and a site, then claim the site in the browser.

A workspace is a folder, kept outside the repository, that holds one Postgres database, its services and their ports. A site is a tenant with its own host name and its own schema in that database.

cardinal init aincrad
cd aincrad
cardinal new-site aincrad.localhost
cardinal start
  • init asks for the package manager and for where Postgres is, unless you pass --pkg and --db docker or --db external. With Docker, it writes a docker-compose.yml using ports that are free at that moment.
  • new-site HOST creates the site.
  • start starts the services, rebuilds the desk if its sources changed, migrates every active site, serves them and prints each URL. The first desk build takes a few minutes.

init writes the master key that encrypts site secrets to .cardinal/secrets.exs. Keep that file. A site's secrets open only with the key they were made under.

Claim the site

Open the URL start prints, such as http://aincrad.localhost:4000. A new site is unclaimed. Its first visitor goes through the setup wizard and becomes its System Manager.

For any site reachable from the internet, choose the first user yourself:

cardinal new-site HOST --admin-email you@example.com

If the wrong visitor claimed a site, take it back. This keeps the old schema under a new name and installs a fresh one:

cardinal setup reopen -t HOST --admin-email you@example.com

Browsers resolve *.localhost to your machine. For any other name, cardinal add-to-hosts HOST adds it to /etc/hosts and asks for sudo.

Mail and PDFs in development

Sites send no mail until they have an outgoing Email Account. In a Docker workspace, add one in the desk with server localhost and the workspace's mail_port from cardinal.workspace.exs. Mailpit catches everything it sends. cardinal email test -t HOST ADDRESS checks the account. PDFs render through the workspace's Gotenberg with no setup.

Day to day

TaskCommand
Stop the web serverCtrl-C
Stop the servicesdocker compose down, in the workspace
Migrate without startingcardinal migrate -t HOST, or -t all
Update Cardinalcardinal self-update, then cardinal start in a workspace
Update the workspace's appscardinal update
List sitescardinal list-sites
Delete a site for goodcardinal drop-site HOST

self-update follows the production branch unless you pass --branch, and refuses while the checkout has uncommitted changes.

The workspace's files, ports and the variables cardinal start sets are in Configuration.

On this page