Running multiple local instances
Give a project, an experiment, or another person their own isolated Syncropel instance on the same machine, with a separate home directory, separate port, separate identity, separate backups.
This page is for people running their own workspace or using the API. If you use a workspace created at syncropel.com, start with Your hosted workspace.
One machine can run several Syncropel instances side by side. Each one is complete and isolated: its own records, its own identity, its own configuration, its own backups. Nothing is shared unless you explicitly federate them.
Reach for a second instance when:
- a project deserves its own space (a music library, a research corpus, a client engagement) and you don't want tens of thousands of imported records mixed into your everyday instance;
- you want a scratch instance to experiment against without any risk to real data;
- someone else on the machine needs their own instance.
The one rule: the home directory is the instance
Everything an instance is lives under one directory: the config, the keys, the record store, the Unix socket, the token, the logs:
~/.syncro/ your default instance (what plain `spl` talks to)
~/.syncro-project/ a second instance: completely separateThe SYNCROPEL_HOME environment variable selects which one a command
targets. Every command you aim at a non-default instance needs this variable
set. Getting this right is what keeps the instances apart:
export SYNCROPEL_HOME=$HOME/.syncro-projectA shell without that variable talks to ~/.syncro/: your default
instance. That's a feature (your everyday spl task add keeps working
untouched), and it's also the classic mistake: running one command in the
wrong terminal targets the wrong instance. Pin the home per shell, or use
aliases (below).
Worked example: a second instance on port 9300
# 1. Create it: a fresh identity + config under its own home
export SYNCROPEL_HOME=$HOME/.syncro-project
spl init
# 2. Start it on its own port (your default instance is already on 9100)
spl start --port 9300
# 3. Prove it's alive and separate
spl status
spl task add "hello from the project instance"Pass --port explicitly when starting: each instance needs its own, and
9100 belongs to your default instance.
The local CLI works immediately with no tokens: the Unix socket inside the instance's own home is the authentication, exactly like a first install.
Open TCP access (browser, phone, remote CLI)
Like any fresh secure instance, the HTTP API starts in bootstrap mode
(503 BOOTSTRAP_REQUIRED) until its first service account exists:
spl service-account create --bootstrap --name admin \
--actors did:sync:user:$(whoami) --scopes admin --with-token
spl token save spl_prod_sa_... # lands in ~/.syncro-project/tokenEach instance has its own accounts and its own tokens. A token minted on one instance means nothing to another.
Working with two instances at once
Aliases keep the targeting explicit and typo-proof:
alias spl-work='spl' # plain spl = the default home = ~/.syncro
alias spl-project='SYNCROPEL_HOME=$HOME/.syncro-project spl'
spl-work task list # your everyday instance
spl-project task list # the project instanceWhat's isolated (and how to check)
| Concern | Isolation |
|---|---|
| Records | Each home has its own record store. A record added to one never appears on the other. |
| Identity | spl init per home generates a separate identity and keypair. |
| Auth | Service accounts, tokens, and pairings are per-instance. |
| Config | config.toml, routing rules, assistant settings: all per-home. |
| Backups | Each instance backs up to its own directory: ~/.local/share/syncropel/backups/instance-<id>/. The daily automatic backup is per-instance too. |
| Health | spl doctor audits whichever home is pinned. |
Verify isolation the direct way: add a task on the project instance, then list tasks on your default instance: it isn't there.
Gotchas
- Never point two running instances at one home. One home directory = one instance. Two processes on the same home break the isolation this guide describes.
- The default shell targets the default instance. If a command's output
looks like it came from the wrong instance, check
echo $SYNCROPEL_HOMEfirst. - Ports don't follow the config file across restarts you run by hand:
make
--portpart of how you always start the instance (a shell alias, or a service definition per Keeping your instance running). - Retiring an instance is
spl stopunder its home, then archiving or deleting that home directory. Nothing else on the machine references it.
See also
- First run: what
spl initcreates inside a home - Starting your instance: modes, ports, lifecycle
- Your first federation pair: make two instances talk, deliberately
- Backup & restore: backing up each instance