Hosts & TLS
Orca can make your projects reachable at real-looking hostnames like https://api.acme.test, with certificates your browser trusts.
Hosts
List each project's hostnames in its orca.project.yaml:
Then add them to /etc/hosts:
orca hosts collects the hosts from every project in the workspace, and points each one at 127.0.0.1. Its entries are tagged with a comment naming the workspace, and running it again replaces that workspace's entries, so it's safe to re-run after adding or removing hosts. Entries for other workspaces, and anything else in the file, are left alone.
Writing to /etc/hosts needs root, hence sudo.
Why ORCA_CONFIG_PATH is set
Orca finds your user config through your home directory ($HOME/.orca/orca.yaml), and that's where your workspaces are recorded. Whether sudo keeps your HOME depends on how it's configured:
- Some systems reset
HOMEto root's home, e.g. Ubuntu by default, or anywheresudoerssetsalways_set_home. A plainsudo orca hoststhen looks for root's config instead of yours. It doesn't find one, so it creates an empty, root-owned config at/root/.orca/orca.yaml, and fails because your workspace isn't in it. - Others keep your
HOME, which macOS's defaultsudoersdoes, as far as we know. There, plainsudo orca hostsfinds your config.
Setting ORCA_CONFIG_PATH on the command line points orca at your config either way, so the same command works everywhere. If you know your sudo keeps HOME, you can leave it out.
Plugins run as root under sudo
Orca starts its plugins on every run, so under sudo they run as root too:
- plugins in
~/.orca/plugins, whensudokeeps yourHOME; - plugins in any
plugins.dirsdirectories in your config, always, becauseORCA_CONFIG_PATHpoints orca at that config.
Setting ORCA_PLUGINS_PATH=/nonexistent skips the first, but not the second. Only run orca hosts with sudo if you trust every plugin you have installed.
TLS certificates
List the domains each project needs certificates for in its orca.project.yaml. Wildcards are allowed:
Then generate them:
orca tls gen does two things:
- Creates a certificate authority for orca, if there isn't one yet:
~/.orca/tls/cert.pemandkey.pem. It's shared by all your workspaces. - Creates a certificate for each domain in the workspace, signed by that authority, in
~/.orca/tls/certs/. Each one is a{domain}.certand{domain}.keypair, with*replaced by_. So*.acme.testbecomes_.acme.test.certand_.acme.test.key.
Existing certificates are kept, so it's safe to re-run after adding domains. Certificates are valid for two years. To replace one, delete its .cert and .key files and run orca tls gen again.
To use the certificates in a container, for example a reverse proxy, add the TLS injection label to its service. Orca then mounts the certificates directory into it.
Trusting the certificate authority
Browsers and other tools only accept the certificates once they trust orca's certificate authority. Orca doesn't do this for you, so add ~/.orca/tls/cert.pem to your system's trust store once:
Firefox uses its own trust store by default: import cert.pem under Settings → Privacy & Security → Certificates → View Certificates → Authorities.
Warning
Keep ~/.orca/tls/key.pem private. Anyone with it can create certificates your machine will trust.