When you want to experience the new developer tools, you need to set up a VM on Azure. Now, this takes a while.
On top of that, it’s all “preview”. As in: “might crash”. And in: “if it crashes, there might not be a decent way out”.
I was able to completely mess up my environment. Both data acted weird (getting errors like “record already exists” in an empty table), as the inability to publish any new extension (ending up with pages without controls and such). Completely weird, unexpected, .. stuff. Restarting NSTs didn’t work in all cases, unfortunately.
Now, for me personally, I don’t care too much. I just log an issue on GitHub to let Microsoft know .. and I start from scratch.
Speed up this process
Now, to speed up this process, I decided to script it. And the process is really simple:
- When I have setup a VM, I backup the database
- I have a script that can restore that backup so that I have an original environment again
So, I whenever you have set up a new VM, and before you’re going to do anything with it, one tip could be to backup the database that you ‘re going to use to publish scripts to, by running the script “01_BackupDB.ps1” of my library. It will:
- Install my modules (because it’s going to use them for backing up and restoring)
- Take the backup
- Put the backup on the C:\Backup\backup.bak
When you do encounter any weird behavior like I described above .. or any other reason why you’d like to go back to the original situation of your database .. then simply execute “02_FixBrokenEnvironment.ps1“. It will:
- Stop both server instances
- Restore the backup
- Start and synch both instances
Do I need to?
Of course not. You can just suffer through the same as I did .. and eventually set up a new environment on azure ;-). Same result – it will only take somewhat longer.. .
Now, if you are able to fix any issue in any other way – please don’t hold yourself of putting a comment on this post ;-).
Or you can simply use use Docker 🙂 You can set your environment in a few minutes and you can recreate it or you can “build” multiple instances in a matter of seconds… Even on your machine or on any server even if you a running another instances (2016, 2016) with multiple CUs.
Jakub, I think most NAV guys are unfamiliar with that and I am glad NAVTechDays is covering it.
Even more – Jakub is covering it :-). I’m really looking forward to that session.
Just curious. Why are you taking the backup? It already exists in the NAVDVD folder right? Or is that different? I did not have crashes lately but with earlier builds I have used the restore option from the DVD.
I didn’t think of it. Maybe because creating a 1-minute-script was easier than figuring out if Microsoft did something funky to the database after it just installed it.