FirstBoot 🥇🥾
uSync FirstBoot is designed to get you up and going with an Umbraco site, easily and with minimal interaction.
Some examples of how you could use FirstBoot:
- Clone an Umbraco site from source control and have the site build and install the content on the first boot.
- Setup a new Umbraco site from existing uSync files either locally or via a server.
Setup FirstBoot​
The quick and simple way to setup FirstBoot on your site is to add the ImportOnFirstBoot
setting to the appsettings.json
file.
{
"uSync" : {
"Settings" : {
"ImportOnFirstBoot": true
}
}
}
Once this setting is in place any new sites that are created from the Umbraco files in the folder will automatically install all settings and content from any existing uSync folder.
If you only want FirstBoot to work while you are developing the site, put these settings in appsettings.development.json
.
FirstBoot Process​
This FirstBoot process is a one time process that will only run when a site is first installed or on the first boot after uSync has been installed on a site.
When you first run your Umbraco website, uSync will run a one time migration that looks for the ImportOnFirstBoot
setting and if it is set to true, it will run an import of any files in the uSync folder. This will get all the settings, content and media from the uSync folder and install it on your site.
This means if you have an existing site running uSync and you turn FirstBoot on, nothing will happen because the FirstBoot process will run when uSync is installed, not on an existing site.
By default FirstBoot will run all uSync files from disk, so it will import settings, content, media and any other handler files you might have installed (for example files for Vendr or Umbraco Forms).
If you only want FirstBoot to import settings you can set the FirstBoot group to Settings
.
{
"uSync": {
"Settings": {
"ImportOnFirstBoot": true,
"FirstBootGroup": "Settings"
}
}
}
Automated Install and FirstBoot.​
For a truly automated experience you can combine uSync FirstBoot with Umbraco's unattended install settings to get a site that will setup its own DB and install the required files in one boot.
Unattended​
Umbraco's unattended install settings let you setup your Umbraco install so that Umbraco will create a new database and setup the Admin user for a site.
"ConnectionStrings": {
"umbracoDbDSN": "Data Source=(localdb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Umbraco.mdf;Integrated Security=True"
},
"Umbraco": {
"CMS": {
"Unattended": {
"InstallUnattended": true,
"UpgradeUnattended": true,
"UnattendedUserName": "A.N. Other",
"UnattendedUserEmail": "AN@Other.com",
"UnattendedUserPassword": "APasswordMeetingRequirements"
}
}
},
"uSync": {
"Settings": {
"ImportOnFirstBoot": true
}
}
}
Store Username/Password in Environment​
While the above settings will work, you will notice that the default username and password for the site are stored in the config file.
If you don't want those details in the files you could set some environmental variables on your development machine(s) instead.
Environmental Variable | Example Value |
---|---|
UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERNAME | "A.N.Other" |
UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL | "AN@Other.com" |
UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD | "APasswordMeetingRequirements" |
When these environmental variables are set, Umbraco will use them for the unattended account creation and you will be able to login without having to setup the admin user or database.