Demo mode in bundles
This page is for bundlers who build public demonstrations, and for every other bundler, so they keep demo mode
out of their bundles. Demo mode is switched on only by the environment variable EXP_DEMO_MODE=1
(Demo mode).
Contents
- What demo mode does
- The rule for bundles
- Setting it in a demo bundle
- Installing with a published password
- Rebuilding on a schedule
- Checks
What demo mode does
- Administrator passwords "cannot be changed or reset": the Change password form, Forgot your password?, user
edit,
exp:resetuserpassword, web services and imports refuse it for administrators. - Every administration page shows a Demo mode banner.
- The installers accept a published, well-known or short administrator password (
publish,publishing); an empty one is still refused. - It "does not make the site read-only: a visitor can edit content, create users, change roles and settings. That is why a demo is rebuilt from scratch on a schedule."
Source: Demo mode, Demo mode: the upgrade note.
The rule for bundles
| Bundle | Demo mode |
|---|---|
| Public demo with a published sign-in | on, for that demo's processes only |
| Trade-show or sales laptop showing a published sign-in | on, if the sign-in is published |
| Classroom where every student knows the password | on, only if the image never becomes a real site |
| Every bundle meant for a real site | never |
"Demo mode means that the administrator password is known to everyone." Because it is environment only ("No INI setting, no request parameter and no administration page can switch it on"), a settings file or database copied from a demo does not carry it. Your images, units and panel templates for real sites must not set it either.
Setting it in a demo bundle
Every process that serves or maintains the demo needs it (Demo mode for hosts):
| Where PHP runs | Setting |
|---|---|
| PHP-FPM | env[EXP_DEMO_MODE] = 1 in the demo's own pool |
| Apache | SetEnv EXP_DEMO_MODE 1 in the demo's virtual host |
| Velocity | export EXP_DEMO_MODE=1 in the demo's site envvars /etc/vc/sites-available/<site>.envvars, or the environment of the process that starts the demo's server; never the shared /etc/vc/envvars, which the workers refuse for demo mode |
| Cron | EXP_DEMO_MODE=1 at the top of the demo user's crontab |
| Containers | ENV EXP_DEMO_MODE=1 in the demo image, or -e EXP_DEMO_MODE=1 for the demo service only |
"Only the exact value 1" turns it on. config.env.php explicitly says demo mode "IS NOT A SETTING OF THIS FILE": a
constant there does nothing (config.env.php.example).
Installing with a published password
EXP_DEMO_MODE=1 php bin/php/console exp:install --apply --db=sqlite --password='<the published demo password>'The same works for the kickstarter ([site_admin] Password) and the setup wizard. "Only the administrator password
of the new installation is relaxed."
Rebuilding on a schedule
"A demo that is rebuilt on a schedule (every few hours, from the current code) does this in its build script: install
with the variable, swap the new site in, keep the variable in the running site's PHP environment and crontab. The
script must not write the variable into config.php, settings/ or anything that is copied to other sites."
exp:install on SQLite is "the usual choice" for such demos (4.7).
Checks
- To do: The administration of the demo shows the Demo mode banner.
- To do: Bundles for real sites do not show it, and none of their files mention
EXP_DEMO_MODE. - To do: The demo's page says plainly that it is public and reset regularly ("Do not enter anything private here").
Related pages
- Education and demo bundles
- Demo mode FAQ, Demo mode problems
- Live demo safety
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.