App Presets › Single-tenant
Single-tenant (shared)
What it is. One shared workspace, no personal workspaces, the tenancy UI suppressed. Every authenticated user is a member of the same workspace; new signups land there automatically. The workspace switcher names that workspace and lists no other; there is no “New workspace” UI and no way for users to create additional workspaces.
Who it’s for. Internal company tools, one-org deployments, classroom/cohort tools with central administration — any product where “the workspace” is implicit and there’s no need to expose tenancy as a user-facing concept.
How users relate
Everyone shares one workspace. Each person (with how they sign in) is a member of the same Acme workspace; signup is invite-only, so people are invited straight in — and there are no personal workspaces:
What you get when configured.
| Knob | Value | Mechanism |
|---|---|---|
signup.mode |
typically :invite_only (your call) |
config/initializers/signup.rb |
tenancy.onboarding |
:shared |
User#onboard_workspace dispatches to join_shared_workspace |
tenancy.workspace_creation |
:disabled |
RequiresWorkspaceCreationEnabled (included by WorkspacesController and Operations::WorkspacesController) redirects :new/:create — operators included; a second workspace on a single-tenant instance means flipping the flag or a console one-liner |
permitted_join_strategies |
[:invite] (default — SIGNUP_PERMITTED_JOIN_STRATEGIES) |
Invitation.consume! is the single membership-grant path |
session.reauth_enabled |
false (optional — your call) |
config/initializers/sessions.rb; internal tools often skip the “confirm it’s you” interstitial |
session.new_device_notification |
false (optional — your call) |
same file; skips “new sign-in” alerts when every teammate’s laptop would fire one |
The workspace switcher stays, naming the shared workspace: with one membership its menu lists no other workspace, only “All workspaces”, so no extra suppression is needed.
Setup steps.
-
Set the ENV vars before running
bin/setup(or before deploying):Variable Required? Example Purpose WORKSPACE_ON_SIGNUPno, after bin/fork --preset sharedsharedSelects this preset; defaults to the preset in .fork.ymlTENANCY_WORKSPACE_CREATIONyes disabledTurns off “New workspace” UI + route — operators included; a second workspace on a single-tenant instance means flipping the flag or a console one-liner TENANCY_SHARED_WORKSPACE_SLUGno, after bin/fork --preset sharedacmeURL-safe slug of the shared workspace; defaults to the name in .fork.ymlTENANCY_SHARED_WORKSPACE_NAMEno Acme Inc.Display name (defaults to the product name in config/locales/en/brand.en.yml)TENANCY_OWNER_EMAILin production admin@acme.comEmail of the initial Owner; development falls back to owner@<slug>.test, so a fresh fork’sbin/setupneeds nothing setTENANCY_OWNER_FIRST_NAMEno AdminDisplay first name (default Workspace)TENANCY_OWNER_LAST_NAMEno UserDisplay last name (default Owner)SIGNUP_MODEyes invite_onlyLock account creation to invitations APP_HOSTno app.acme.comHost used in the logged workspace URL and in tenancy:owner_setup_link‘s sign-in link (default: the mailer’s host,RAILS_HOSTin production) -
Run
bin/setup(orbin/rails db:seedon an existing app). The seed is idempotent — safe to re-run. -
The seed creates the shared workspace and the Owner user (with a verified email Authentication and an Owner Membership). In development it emails the Owner a sign-in link, captured by Letter Opener: open
/letter_openerto see it (it isn’t sent over SMTP). With passwords turned on, the link lands on the set-a-password form. Inproductionit deliberately does not put a credential in the logs (a logged token would linger in log retention past its short expiry); instead it logs the workspace URL and points you to an on-demand task. Mint the Owner’s sign-in link when you’re ready to use it:bin/rails tenancy:owner_setup_linkThis prints a fresh sign-in link, valid for 15 minutes — the expiry clock starts when you run it, not at deploy time. Deliver it to the Owner out-of-band (or run it yourself if you’re claiming the account). It doubles as a break-glass Owner login if email delivery is ever down.
-
The Owner opens the link, which signs them in (with
AUTH_PASSWORDS=enabledit opens the set-password form first). They can then invite other users via the normal invitation flow — each invitation specifies the role the invitee receives (Member, Admin, etc.). The Owner remains the single source of new-role-granting authority for the shared workspace; roles can also be changed after signup via the members UI at/workspaces/:slug/members.
Re-inviting under
:sharedupdates the role, it doesn’t error. Because:sharedonboarding pre-creates a placeholder membership for every new user,Workspace#admitreconciles — admitting an existing member to a new role updates their role rather than raising “already a member” (the behavior you’d get under the default:personalposture). So re-inviting someone at a higher role is a valid way to promote them.
How to verify your setup is Single-tenant. After running the seed:
bin/rails console
TenancyConfig.shared? # => true
TenancyConfig.shared_workspace.slug # => "acme" (your slug)
TenancyConfig.shared_workspace.personal? # => false
TenancyConfig.shared_workspace.memberships.count # => 1 (the seeded Owner)
owner = User.find_by!(email_address: ENV["TENANCY_OWNER_EMAIL"])
owner.workspaces # => [<Workspace slug: "acme">]
owner.personal_workspace_id # => nil
owner.memberships.first.role.slug # => "owner"
In the browser, after the Owner has signed in:
- They land on the home page; Go to your workspaces lists only the shared workspace.
- The workspace switcher at the top of the sidebar names the shared workspace and their role; its menu lists no other workspace — only “All workspaces”.
/workspaces/newredirects to root with the alertWorkspace creation is disabled on this instance.- Invited new users (via the standard invitation flow) verify their email and become Members of the same shared workspace.
When to switch presets.
- “Users should each get their own personal workspace; this is too restrictive.” → Solo-default.
- “Each customer should have their own workspace, and signup should be public.” → Open SaaS.
Next steps
- ← Compare all presets — the decision matrix and the other three shapes.
- Extending ModelRails → — add your own workspace-scoped features on top of this preset.