-
Notifications
You must be signed in to change notification settings - Fork 6
Multi Tenant Resumis
In multi-tenancy, one instance of Resumis can be used to host content for a number of different sites and owners.
For example, let's say Alisia runs a personal site for herself to show off her open source projects, her blog posts, and host her CV for potential employers. She's using Resumis for the API and has built out a frontend in her favorite JavaScript framework.
Alisia's friend Bob is also looking to host his personal site. He likes building frontend apps, but doesn't want to mess around with configuring a service for his API, so he asks Alisia if she can host him on the Resumis instance she's been talking about.
Alisia's personal site runs at www.alisia.tld
. Bob's site is www.bobloblaw.tld
. Alisia decides to set resumis up at alisia.tld
. Alisia sets up her first Resumis user [email protected]
for the subdomain www
. Alisia decides she's going to do some NGINX configuration work to allow both her frontend site and Resumis to be accessible from www.alisia.tld
, since she knows the paths won't overlap between the two.
Bob, on the other hand has decided he's going to point admin.bobloblaw.tld
at Alisia's Resumis instance. He sets up his Resumis user [email protected]
for the domain admin.bobloblaw.tld
and sets his subdomain for bob
. Bob can now access his Resumis endpoints at admin.boboloblaw.tld
and bob.alisia.tld
.
Here's where the configuration stands:
Alisia's Resumis Instance has these tenancy-related environment variables set:
RESUMIS_TENANCY_MODE=multi
RESUMIS_CANONICAL_HOST=alisia.tld
Alisia has two NGINX virtual hosts setup:
-
*.alisia.tld
- Catch all for resumis subdomains onalisia.tld
. Has TLS certificate in front of it. Proxies to Resumis for all things.-
www.alisia.tld
- Handled specially to serve her frontend app and then proxies to Resumis.
-
-
admin.bobloblaw.tld
- Proxies to Resumis. Has TLS certificate foradmin.bobloblaw.tld
from Bob.
Alisia's Resumis user has the following attributes:
-
domain
:nil
-
subdomain
:www
Bob's Resumis user has the following attributes:
-
domain
:admin.bobloblaw.tld
-
subdomain
:bob
domain
can be any hostname, not just a bare domain name. It should be considered the publicly accessible hostname for the Resumis API. It does not necessarily need to be the same hostname as the user's public-facing site, but there are some places where this is assumed to be the case (links in generated CVs, JSON Resume responses, and the View Site
link in the management site side navigation).
subdomain
is expected to be relative to RESUMIS_CANONICAL_HOST
and is required for all users in multi-tenant modes, partly because it provides an always-available endpoint for users to access their management sites, regardless of whether or not they have domain
setup in such a way to handle Resumis traffic (or vice-versa). subdomain
can be thought of more as a unique username
on the instance.
These two properties are rather confusingly named and will likely be renamed sometime before Resumis v1.0.0
to disambiguate. Resumis was initially written to host a publicly accessible frontend, rather than serve as an API, so domain
/subdomain
was designed similar to the way GitHub Pages works. The current direction is to have Resumis serve as the API for a frontend website and other services, but generally be agnostic about where a user's public presence is. The two properties will likely be replaced by a single tenant-specific hostname (which may end up just being subdomain
) and an additional field on the user for a homepage URL (to indicate a canonical URL for a public-facing site).