Sites and environments
A site in Taggor is one website of yours. It always has two environments:
- Production is your live website, what visitors see.
- Its snippet is the production snippet, with the production site key.
- It runs only on the domains you list for production.
- It shows the version on each component's Production channel.
- Staging is the test copy of your website, and pages on your own computer.
- Its snippet is the staging snippet, with the staging site key.
- It runs on the domains you list for staging, plus
localhostand127.0.0.1, always. - It shows the version on each component's Staging channel.
The environment of a page comes from the snippet on it, never from the page's address. Put the production snippet on the live website and the staging snippet on the test copy, and each shows its own version of the same components.
Everything else is one for the whole site: the components attached to it, the props saved for them and its settings.
See a site
Section titled “See a site”npx taggor sites listnpx taggor sites show SITE_IDsites list shows each site with its id and, per environment, the site key and the domains.
sites show adds both snippets and, for each attached component, what each environment shows and
why:
contact-form production serves 1.2.0 (ver_…): it follows the production channel staging serves 1.3.0 (ver_…): it follows the staging channelA command takes the site as --site, by its id (st_ and 26 characters) or by either of its two
site keys (st_ and 10 characters). A command that changes only one environment (sites domains set,
pin, unpin, sites server-keys create) also needs to know which: pass
--environment production or --environment staging, or name the site by that environment's site
key. It never guesses: without either, it stops and shows both.
What each environment shows
Section titled “What each environment shows”For each attached component, an environment shows:
- the version pinned in that environment, if there is one;
- otherwise the version on the component's channel of the same name: Production for production, Staging for staging;
- on staging only: while the component has no version on Staging, the one on Production. A component you never published to Staging still appears on your test copy.
npx taggor publish moves Staging, and npx taggor promote <component> --channel production moves Production.
A change reaches pages within about two minutes, with no change to the pages.
Hold an environment on a version
Section titled “Hold an environment on a version”Pinning makes one environment of one site keep a version, whatever publish, promote and
rollback do afterwards. Use it to keep one site on a known version while others move on, or to look
at a specific version on staging.
npx taggor versions COMPONENTnpx taggor pin COMPONENT --site SITE_ID --environment staging --version 1.2.0npx taggor unpin COMPONENT --site SITE_ID --environment stagingpin takes the version by its number or its id (ver_…). Only that environment of that site is
pinned. unpin undoes it with one command, and the environment follows its channel again.
While a version is pinned, publish, promote and rollback say so instead of failing, with the
command that undoes the pin:
NOT changed: production of the site My site (st_…) is pinned to 1.2.0 (ver_…), so it keeps serving that. To make it follow production again: taggor unpin contact-form --site st_… --environment productionDomains
Section titled “Domains”Each environment has its own list of domains where its snippet runs:
npx taggor sites domains set --site SITE_ID --environment production --domain example.com --domain shop.example.comnpx taggor sites domains set --site SITE_ID --environment staging --domain staging.example.comThe command replaces the whole list of that environment and leaves the other one alone. A plain entry also covers its www. form (example.com matches www.example.com), so www. entries are never listed; a subdomain such as shop.example.com is its own entry. The staging
snippet always runs on localhost and 127.0.0.1, so never list those. The production snippet runs
only where you list it: with an empty list it runs nowhere. Allowed domains has
the matching rules.
Staging is not private
Section titled “Staging is not private”The staging snippet and its site key are in the HTML of your test pages, and the versions it shows are public files, like the production ones. Anyone who has the staging site key can load what staging shows. Keeping the test copy of your website behind a password does not hide the components.
To show something that must stay private, use a preview link instead:
npx taggor preview COMPONENTIt prints a private link that expires in 7 days and is not listed anywhere.
A copy of your website made with the production snippet
Section titled “A copy of your website made with the production snippet”A test server is often a copy of the live website, HTML included, so it carries the production snippet. On that copy:
- nothing mounts, because the copy's hostname is not a production domain, and the browser console says so: it names the production snippet and tells you to use the staging one;
- do not fix it by adding the copy's hostname to the production domains: the copy would then show production versions and send its test submissions as production data.
Fix it by replacing the snippet on the copy with the staging one, and listing the copy's hostname for staging:
npx taggor sites snippet SITE_ID --environment stagingnpx taggor sites domains set --site SITE_ID --environment staging --domain staging.example.comIf your deploy copies the HTML every time, make the snippet's address a setting of each environment of your own site (an environment variable, a theme option), with the production snippet's address on the live website and the staging one on the copy.
Data from each environment
Section titled “Data from each environment”A form submitted from a page with the staging snippet is stored as a staging submission, and one from the production snippet as a production submission. Both count toward your plan the same way. Every submission says its environment, and you can read one environment only:
npx taggor data export COLLECTION --environment production --out submissions.csvServer rendering keys belong to one environment too: see Server-side rendering.