Docs / How-to guides

Self-host Otto on your own domain

Run Otto's server under your own domain. You add DNS records, name your domain in one file, deploy, and sign in with a passkey. Below, example.org stands for your domain and SERVER_IP for your server's address.

Before you start

Set it up

  1. Add the DNS records

    At your DNS provider, point four names at the server:

    NameTypeValueServes
    example.org (@)ASERVER_IPThe public website
    wwwASERVER_IPThe website's www name
    myASERVER_IPThe Otto web app
    *.previewASERVER_IPPhone previews, one name per repo

    If your server has an IPv6 address, add the same four as AAAA records.

  2. Write domain.env

    On the server, as root, create /etc/otto-deploy/domain.env with your domain:

    sudo install -d /etc/otto-deploy
    echo 'OTTO_DOMAIN=example.org' | sudo tee /etc/otto-deploy/domain.env

    The app lives at my.example.org and previews under preview.example.org. To use other names, add the optional keys. The reference lists them all.

  3. Deploy

    On your Mac, in your Otto checkout, run:

    OTTO_VPS=myserver yarn deploy:vps all

    OTTO_VPS is your server's SSH alias. Leave it out and the deploy uses otto-vps. The deploy reads the file and gives each service its names. Without the file, or without OTTO_DOMAIN in it, it stops before it builds or restarts any service.

    When it finishes, it tells you that no passkey is enrolled yet.

  4. Enroll your first passkey

    Nobody can sign in until a passkey exists. Mint a one-time enrollment link, valid for 15 minutes:

    yarn vps:auth enroll

    This runs through otto-vps by default. With your own alias, run ssh myserver docker exec otto-auth node cli.mjs enroll.

    Open the link on the device you will sign in from, usually your phone, and follow its prompt. The passkey is tied to my.example.org and saved as owner. To pick another name, set OTTO_PASSKEY_USER in domain.env before you deploy.

  5. Check it

    Open https://my.example.org and sign in with the passkey. The first visit to a preview name takes a moment longer while its certificate is issued.

If something is off