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 startinitasks for the package manager and for where Postgres is, unless you pass--pkgand--db dockeror--db external. With Docker, it writes adocker-compose.ymlusing ports that are free at that moment.new-site HOSTcreates the site.startstarts 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.comIf 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.comBrowsers 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
| Task | Command |
|---|---|
| Stop the web server | Ctrl-C |
| Stop the services | docker compose down, in the workspace |
| Migrate without starting | cardinal migrate -t HOST, or -t all |
| Update Cardinal | cardinal self-update, then cardinal start in a workspace |
| Update the workspace's apps | cardinal update |
| List sites | cardinal list-sites |
| Delete a site for good | cardinal 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.