v1-ssr-mst-aptd-gcms-lcz-sty
MST Amplitude GraphCMS Locize Sentry
DEPRECATED
OFFICIAL
March 2020
Table of contents
- Overview
- Built-in features
- Demo
- Built-in 3rd party vendors
- Clone locally
- Local installation guide
- Advanced configuration
Overview
This preset has been deprecated in favor of
v2-mst-aptd-gcms-lcz-sty
Preset | Diff PR | Pricing concerns |
---|---|---|
v1-ssr-mst-aptd-gcms-lcz-sty - Branch
| Identical | Not free (Locize) |
Built-in features
Feature | Availability | Notes about features |
---|---|---|
Rendering mode | SSR | SSR forced for all pages (through pages/_app ), SSG not available |
Tenancy | MST (Hybrid) | Deploys multiple tenants on different domains (ST), sharing the same DB and API endpoint (MT) |
Analytics (Amplitude) | Fine-grained analytics is processed in real-time (1mn graph latency on free plans) | |
GraphQL API (GraphCMS) | Advanced GraphCMS support | |
Dynamic i18n support (GraphCMS) | Content from GraphCMS is localised (db records) | |
Static i18n support (Locize) | Content for the platform is localised using Locize (menu, links, etc.) | |
Monitoring (Sentry) | Errors are sent to Sentry in real-time (both frontend and backend) |
Demo
Tenancy
This preset uses a MST design.
Therefore, there are 2 different demo available at:
- https://nrn-v1-ssr-mst-aptd-gcms-lcz-sty-c1.vercel.app/, and its preview at https://nrn-v1-ssr-mst-aptd-gcms-lcz-sty-c1-preview.vercel.app/
- https://nrn-v1-ssr-mst-aptd-gcms-lcz-sty-c2.vercel.app/, and its preview at https://nrn-v1-ssr-mst-aptd-gcms-lcz-sty-c2-preview.vercel.app/
Both demo have been generated using the same source code, the two demo live in a completely separated server and won’t be affected by each other (MST design)
The same database is used by both tenants (MT design), but the displayed content is specific to each tenant (theme, logo, etc.) (ST design)
Overall, we use a hybrid tenancy design that we name MST, which is due to a compromise between complexity (only one DB/API (AKA MT)) and security/performances/risk (multiple servers to avoid massive downtime of all customers at once (AKA ST))
Server side rendering
Requests are performed in real-time (SSR), each request send a GraphQL query (put aside client/server caching)
Of course, if the DB itself gets down, all tenants would be impacted at once, which is quite a critical issue (we may protect ourselves against such an outage using a proxy server cache)
Built-in 3rd party vendors
The following vendors are built-in with the preset v1-ssr-mst-aptd-gcms-lcz-sty
.
Vendor | Tag | Has free trial | Has free plan | Potential discounts | Install guide |
---|---|---|---|---|---|
Vercel | Built-in | Friendly pricing for non-commercial usage | Guide | ||
Amplitude | aptd |
Up to 10 million events a month 1st year free (for startups and non-profit) | Don’t provide discounts | Guide | |
GraphCMS | gmcs | 2 weeks on Growth plan | 15% discount for NRN users + provides discounts for non-profit organisations | Guide | |
Locize | lcz | 2 weeks | May provide discount for non-profit organisations, contact them at support@locize.com | Guide | |
Sentry | sty | 2 weeks on any plan | Don’t provide discounts | Guide |
Clone locally
git clone https://github.com/UnlyEd/next-right-now.git nrn-v1-ssr-mst-aptd-gcms-lcz-sty && cd nrn-demo && git checkout v1-ssr-mst-aptd-gcms-lcz-sty
This will create a nrn-v1-ssr-mst-aptd-gcms-lcz-sty
folder in your current directory and checkout the v1-ssr-mst-aptd-gcms-lcz-sty
git branch automatically.
Local installation guide
This local installation guide is meant to guide you through the installation process on your own computer.
Pre-requisites
You must change the associated Vercel scope
(it uses NRN own scope by default, because it’s required for our CI/CD Github Actions)
- Remove the whole line
"scope": "team_qnVfSEVc2WwmOE1OYhZr4VST",
in allvercel.*.json
files (thisscope
is NRN own scope, and you don’t have permissions to access it, so you must remove it manually. We keep it there to make our own CI/CD works)-
Tip: Don’t forget
vercel.json
is a symlink and shouldn’t to be modified (runln vercel.staging.json vercel.json
if you messed it up )
-
Tip: Don’t forget
You must be authenticated to Vercel from your local machine. Typically, if it’s the first time you use Vercel you’ll need to do it.
- Run
npx vercel login
-
Windows: You’ll need to run
npx vercel login email@domain
instead, because it doesn’t support interactive prompt.
You must configure all your Vercel secrets. The list of required secrets depends on your preset and are listed in the vercel*.json
file you’re trying to deploy.
To create a new secret, use vercel secrets add nrn-secret secret-value
. If you create a secret with a wrong value, you will have to delete it and create it again (there is no update feature). See vercel secrets --help
- Tip: If you ever need to store files as secrets (such as ssh keys), see this solution
See each vendor documentation for additional information.
Install steps
-
yarn
- Installs all deps frompackage.json
-
yarn start
- Starts the app on http://localhost:8888/- Alternatively, on Windows, you need to run
yarn start:windows
- Alternatively, on Windows, you need to run
Awesome, the demo should be working on your computer now!
Note that it’s not yet linked onto your own vendor accounts, but it uses NRN defaults values instead. Configuring each vendor is probably the most time-consuming, but you don’t have to do it right away, it depends on whether you want to play around, or make a real project.
Vendors configuration
Create an account for all required 3rd party vendors below, and follow their installation guide
Recommended
Advanced configuration
- Using WebStorm IDE? Check out our “How to setup” Guide
- If you use NVM (Node Version Manager) then running
nvm use
will select the right node.js version based on the.nvmrc
file. - If you get stuck then ask for help on github issues.
- If the preset does too many things to your taste, check our “How to remove X” guides (e.g: “How to remove Locize”)