๐นDemo Experience
Last updated
Last updated
Guardian now includes a "Demo Experience" feature which separates the production and demo versions by default. In order to access either the production or demo version, the user will need to build and deploy Guardian, defining on the โ.envโ file present in the root directory the variable โDEMO=trueโ if the demo is desired or not stating it at all if the production mode is intended.
It's important to note that if โDEMOโ is present with a value other than โDEMO=trueโ, the auth-service, api-gateway, guardian-service and web-proxy modules will still be built as if the demo is intended, so either use โDEMO=trueโ or delete the variable altogether.
Procedure:
./.env
When deploying in demo mode, the demo accounts created on build will be included. Additionally, when it comes to the API, the present โapi/v1/demoโ endpoints will be accessible, leading to the availability of the "Demo Admin Panel", and the โapi/v1/accounts/registerโ POST method can be used by anyone even when logged out, as before. The header will make it evident that the user is using the demo as "Guardian" will have "Demo" written in superscript and the color of the header will turn grey instead of the default black.
Procedure:
./.env
When Guardian is built in production mode, the demo accounts that have been present until now will no longer be produced on deployment, besides a single Standard Registry account. The โapi/v1/accounts/registerโ POST method is now guarded to be used exclusively by logged in Standard Registries while the โapi/v1/demo/โ methods are deactivated as well. Finally, on the frontend side, the "Demo Admin Panel" will no longer be present.
To summarize, the "Demo Experience" feature in Guardian allows for the separation of the production and demo versions. By defining the โDEMOโ variable in the โ.envโ file, the user can access the desired version. In production mode, the demo accounts and related features will no longer be present, whereas in demo mode, they will be available and the header will indicate that the user is using the demo version.
Much like what was already done for the โweb-proxyโ service, now the โauth-serviceโ, โapi-gatewayโ and โguardian-serviceโ services also contain separate Dockerfiles and tsconfig files for both demo and production modes. This allows further liberties when configuring each mode. For the already existing โweb-proxyโ service, as we are now allowing the toggle of building with demo configurations, some of these can be found at the bottom of your .env.${GUARDIAN_ENV}.guardian.system, such as:
./guardian/configs/.env.${GUARDIAN_ENV}.guardian.system
In order to make use of the already existing demo configuration files, the intention was to make the deployment in either demo or production mode as seamless as possible, leading, unfortunately, to a compromise. Because โ.ymlโ files do not allow native logic operations and Docker Compose does not allow โif elseโ operations, the โweb-proxyโ, โauth-serviceโ, โapi-gatewayโ and โguardian-serviceโ services will build the demo versions every time the variable โDEMOโ is stated, even if it is equal to a random value or even โfalseโ. As stated before, the rule of thumb is if you want the demo, state โDEMO=trueโ, otherwise delete the variable all together from your root .env file. The following diagrams summarize what has been said:
Up until now it was possible to generate new accounts on the โCreate New Accountโ under the /login page, however, with these changes, this will only remain true if under a Demo build (DEMO=true defined on the ~/.env). This requires a new way for Standard Registries to be able to create new accounts. The /accounts/register POST method is still available on both versions, exclusively for Standard Registries if on Production mode (no DEMO variable defined on ~/.env), however Standard Registries also have a new menu option once logged in. Under the โAdministrationโ menu one can find a โCreate Accountsโ option that will lead to the same account creation process as before. This is depicted in the figures below.