Lesson 6.4: Reinstalling, resetting and regenerating settings
An install is not always the first one. Training labs are reset, test systems rebuilt, and sometimes only the
settings should be written again while the content stays. One key decides what happens to the data: DatabaseAction
(--db-action for exp:install). This lesson teaches the three values, the backup that must come before the
destructive one, and how to get out of a failed run.
Note
DatabaseAction=remove destroys every row in the database it names, and nothing asks again: --force is the only
confirmation. Practise only on the installations of lessons 6.2 and 6.3.
At a glance
| Course | Multisite and site packages |
| Module | Module 6: Installing sites with the kickstarter and exp:install |
| Duration | 45 minutes (15 presenting, 30 exercise) |
| Level | Advanced |
| Audience | Administrators, developers and hosts |
| Prerequisites | Lesson 6.3: an installation made with the kickstarter and its kickstart.ini kept aside |
Learning objectives
After this lesson, learners can:
- explain
remove,ignoreandskipand choose the right one; - back up a SQLite database consistently before a reinstall, outside the installation root;
- reset a site to its installed state by running the same
kickstart.iniagain; - regenerate the settings without touching the data, and merge hand-made changes back;
- end the maintenance mode of a failed run after fixing its cause.
Trainer's notes
How to present it
Sources: 6.5 DatabaseAction, 6.10 Re-running and resuming and 7.9 Examples.
The three values (5 minutes):
Value Database Settings Use it for removeexisting tables dropped (SQLite: file emptied), then installed written a clean install, a reinstall ignoreadded to what is there, tables that exist skipped written a new, empty database (the ini --yesdefault)skipnothing inserted, the administrator untouched written regenerating settings/siteaccess/andsettings/override/A missing or misspelled value behaves like
ignore, which fails on a database that is not empty. Write it out.exp:installdefaults to--db-action=remove.The backup (4 minutes). Into a directory outside the installation root: a dump inside the document root can be downloaded by anyone who guesses its name. For SQLite,
sqlite3 <file> ".backup '<target>'"gives a consistent copy even while the site writes. Check that the backup is not empty before the run.Regenerating settings (3 minutes).
skiprewrites the settings from the file or the options. Hand-made changes insettings/override/andsettings/siteaccess/are replaced, so copy them aside first and merge them back. Never restore old settings wholesale after a reinstall: node IDs in them may no longer fit.A failed run (3 minutes). The site stays in maintenance mode ("The site stays in maintenance mode. After fixing the cause: run the kickstarter again, or php bin/php/maintenance.php off"). A window opened before the run stays open. After an
exp:installkilled before its clean-up, the earlierkickstart.iniis invar/log/kickstart.ini.before-exp-install-<date>.
Common questions
Can I resume a failed run at the failed step? No; run the whole sequence again after fixing the cause. With
remove, a complete second run replaces whatever the failed one left.
How do I reset a training lab fastest? The same kickstart.ini with DatabaseAction=remove and run --apply,
or the same exp:install --force command. Train the trainer lesson 2.6 covers lab resets.
I changed the database engine and the site still talks to the old one. Settings in settings/override/ win; set
[DatabaseSettings] DatabaseImplementation there to the new driver first, or remove the old value.
Does skip keep my content and users? Yes: nothing is inserted and the administrator is not touched.
Pitfalls
- The wrong database.
--from-installedor a copied file can point at a live database. ReadDatabasetwice. - A backup in
var/. That is inside the installation; use a directory outside it. - Settings merged blindly. After
skip, merge only the hand-made changes back, block by block.
Hands-on exercise
Use the installation of lesson 6.3 (kickstart-course) and its kickstart.ini, which you moved aside.
Find the database file:
php bin/php/console exp:ini get site.ini/DatabaseSettings/Database, thenls -l var/storage/sqlite3/.In the administration of that site, create a folder
Before resetand publish it.Back up the database outside the installation (replace the paths):
mkdir -p ~/course-backups sqlite3 var/storage/sqlite3/exponential.db ".backup '$HOME/course-backups/before-reset.sqlite'" ls -l ~/course-backups/Put
kickstart.iniback into the installation root and setDatabaseAction=removein[site_details].Run
php bin/php/console exp:kickstarter run(a dry run), thenrun --apply.Check the content tree: the folder Before reset is gone; the site is as freshly installed. Note the new administrator password from the summary.
Add a hand-made setting:
php bin/php/console exp:ini set site.ini/SiteSettings/SiteName "Hand-made name" global.Regenerate the settings, keeping the data: set
DatabaseAction=skip, and runrun --applyagain.Run
exp:ini where site.ini/SiteSettings/SiteName: the hand-made line is gone from the global override. Find the backup of the override invar/backup/ini/from step 7, and set the value again by hand.Move
kickstart.iniout of the installation root again.
Expected result
- Step 3: a backup file of more than a few bytes outside the installation.
- Step 6: the content tree is the one of a fresh install, without Before reset; a new password was generated.
- Step 9: the hand-made
SiteNameis gone until it is set again; the content was not touched by theskiprun. - The trainer checks step 3 (size of the backup) before anyone runs step 5.
Quiz
- Which
DatabaseActionempties the database first? A.ignoreB.skipC.removeD. none - What is the default
--db-actionofexp:install? - Why must a backup not be kept inside the installation's document root?
- Which value writes only the settings?
- A run failed and the site shows the maintenance page. What two ways out are there after fixing the cause?
Answers
- C.
remove.- Anyone who guesses its name could download it (6.5).
skip.- Run the kickstarter (or
exp:install) again, orphp bin/php/maintenance.php off.
Further reading
- 6. The kickstarter:
DatabaseAction, re-running, logs. - 7. The console install.
- Maintenance mode.
- Backups: what to back up.
- Train the trainer: Resetting the lab between sessions.
Related pages
- Module 6: Installing sites with the kickstarter and exp:install
- Multisite and site packages: course overview
- Trainers: start here
- 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.