What is the standard setup process with uSync?

Hello!

I’m coming from Orchard Core. There we have recipes (that is basically the uSync folder here). And in Orchard Core there is the auto setup option in the appsettings.json, that calls a setup recipe. When the SQLLite DB is deleted and the app is rebuilt, the whole site will be recreated. First a DB is created, then from the recipes, the site is filled up with the content.

In Umbraco, I’m resetting the app the following way:

  1. I have the exported data in the uSync folder.
  2. I delete the umbraco/Data folder.
  3. Then, from the appsettings.json, I have to uncomment the ConnectionStrings because it won’t recreate the DB and throw an error.
  4. After that, I can set up the site manually. The connection string will be readded and a DB will be created.
  5. Then I go to the uSync tab and click on import.

Is there an easier way? Maybe some way to automate this, to have a similar workflow as in Orchard Core.

In the meantime, I solved this. It’s simple, similar to Orchard Core. To trigger uSync I used ImportAtStartup. And I didn’t know about Unattended but it’s basically the auto setup.

{
  "$schema": "appsettings-schema.json",
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information"
    },
    "WriteTo": [
      {
        "Name": "Async",
        "Args": {
          "configure": [
            {
              "Name": "Console"
            }
          ]
        }
      }
    ]
  },
  "Umbraco": {
    "CMS": {
      "Global": {
        "UseHttps": false
      },
      "Content": {
        "MacroErrors": "Throw"
      },
      "Runtime": {
        "Mode": "Development"
      },
      "ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto"
      },
      "Hosting": {
        "Debug": true
      },
      "Unattended": {
        "InstallUnattended": true,
        "UpgradeUnattended": true,
        "UnattendedUserName": "admin",
        "UnattendedUserEmail": "[email protected]",
        "UnattendedUserPassword": "Password1!"
      }
    }
  },
  "uSync": {
    "Settings": {
      "ImportAtStartup": "All",
      "ExportOnSave": "All"
    }
  }
}

Hi,

you can also use the “firstboot” setting,

This is like ImportAtStartup but only happens the very first time, (so on the first boot, since you removed the db, and the site starts up). ImportAtStatup runs every time the site starts which has its uses. but if you just want it when you’ve cleaned the site, Firstboot does that.

personally (because i do a lot of testing tearing down local Umbraco setups) I have the unattended values set in as environmental variables (e.g FirstBoot 🥇🥾 | Jumoo docs)

then i can just remove the umbraco folder (deletes temp, logs and the Sqlite db) and run the site
(e.g rm .\umbraco\ -Force -Recurse)

3 Likes

That is even better, thank you! Yes, running on every build would be overkill for me, too. I’m used to the imports only happening at first boot.