+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Post-Webinar Post: Common Issues with Sitefinity Upgrades

by Alon Rotem

This post comes to complete my webinar from yesterday, "Common Issues with Sitefinity Upgrades".

The Recorded Webinar

The webinar is currently available on demand for free view at the following link:
http://www.sitefinity.com/developer-network/webinars/webinars-on-demand/common-issues-with-sitefinity-upgrades

The Magical Batch Files

 There appeared a certain interest in the batch files I was using during the webinar. Those did the quick and dirty work of extracting the files, restoring the database, setting up IIS, granting the relevant IIS app pool service user full access to the website files and starting the browser.
After each sample a cleanup batch was run to undo all the above.
I'm supplying here an example of those scripts. Mind you that Rotem is the name of my machine (and consequently the name on which the SQL server is running).

Extract and set-up

Here is an example of such a script:

@Echo off
title Use this version...
color e9
 
Echo -------------------------------------------------------
Echo.
Echo Setting vars..
SET DataBaseName=Sitefinity_51_withoutProjectManager
SET BasePath=C:\Webinar\2. Sitefinity51 Without ProjectManager
SET DataBaseBackupFile='%BasePath%\Project\App_Data\Sitefinity\Sitefinity_51_withouProjectManager.bak'
SET WebsitePath=%BasePath%\Project
 
SET RarFile=%BasePath%\2. Sitefinity51 Without ProjectManager.rar
SET WebsiteInIIS=Default Web Site
SET Startup="C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -p FF_13 http://localhost/sitefinity
SET bExtract = n
SET /P bExtract="Extract all files (y/[n = default])? "
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo Stopping ProjectManager
%WINDIR%\System32\taskkill.exe  /im Sitefinity.exe
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo Extracting..
Echo.
if "%bExtract%"=="y" (
    Echo Extracting. Please wait...
    "C:\Program Files\WinRAR\unrar.exe" x -y -idq "%RarFile%" "%BasePath%"
)
if "%bExtract%"=="n" (
    Echo Nothing to extract. Moving on.
)
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo Restoring database: %DataBaseName%
Echo.
call "RestoreSitefinityFromBackup.cmd"
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo setting IIS default website..
Echo.
Echo Website: "%WebsiteInIIS%"
Echo Physical path: "%WebsitePath%"
%WINDIR%\System32\inetsrv\appcmd.exe SET vdir "%WebsiteInIIS%/" -physicalPath:"%WebsitePath%"
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo Granting Network Service access to the web folder...
Echo.
"C:\Windows\System32\icacls.exe" "%WebsitePath%" /grant "NETWORK SERVICE":(OI)(CI)F /T /q
Echo.
Echo -------------------------------------------------------
 
Echo.
Echo Done.
Echo.
start "init" %Startup%
 
color 2f
Title Done.
pause

In order to restore the database, it calls another script, RestoreSitefinityFromBackup, which looks like this:

@echo off
color e5
echo.
echo Stopping server...
C:\Windows\System32\net.exe stop MSSQLSERVER
echo Starting server...
C:\Windows\System32\net.exe start MSSQLSERVER
 
echo.
echo Going to folder...
pushd "C:\Users\rotem\Documents\Shares\Batches\ResetSitefinity"
echo Running sql script...
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE" -S Rotem -iRestoreSitefinityFromBackup.sql
 
 
echo Back to parent folder...
popd
- which in turn calls an SQL Script, RestoreSitefinityFromBackup.sql, which contains:

/* 1. Force drop steps */
DECLARE @dbname nvarchar(128)
SET @dbname = $(DataBaseName)
 
ALTER DATABASE $(DataBaseName) SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
 
 
/* 2. Drop steps */
DROP DATABASE $(DataBaseName)
GO
 
/* 3. Restore */
RESTORE DATABASE $(DataBaseName) FROM DISK = $(DataBaseBackupFile) WITH REPLACE
GO

Clean-up

The cleanup script looks something like:

@Echo off
title Cleaning up...
color fc
 
%WINDIR%\System32\iisreset.exe /stop
%WINDIR%\System32\taskkill.exe  /im Sitefinity.exe
 
SET BasePath=C:\Webinar\2. Sitefinity51 Without ProjectManager
 
del /S /Q "%BasePath%\Project"
rd /S /Q "%BasePath%\Project"
 
del /S /Q "%BasePath%\_Licences"
rd /S /Q "%BasePath%\_Licences"
 
del /S /Q "%BasePath%\_Upgrade"
rd /S /Q "%BasePath%\_Upgrade"
 
SET DataBaseName=Sitefinity_51_withoutProjectManager
call "%BasePath%\..\CommonScripts\DropDatabase.cmd"
 
%WINDIR%\System32\iisreset.exe /start
color 2f
title Clean-up complete.
pause

Which calls DropDatabase.cmd:

@echo off
color e5
echo.
echo Stopping server...
C:\Windows\System32\net.exe stop MSSQLSERVER
echo Starting server...
C:\Windows\System32\net.exe start MSSQLSERVER
 
echo.
echo Going to folder...
pushd "C:\Users\rotem\Desktop\Webinar\CommonScripts"
echo Running sql script...
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE" -S Rotem -iDropDatabase.sql
 
 
echo Back to parent folder...
popd

Which runs DropDatabase.sql:

/* 1. Force drop steps */
ALTER DATABASE $(DataBaseName) SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
 
 
/* 2. Drop steps */
DROP DATABASE $(DataBaseName)
GO
 

FAQ&A

To follow-up the questions which were asked during the webinar, I've arranged them as Q&A's (I've merged some of the repeating/logically similar questions here).

Upgrading procedures, modules and packages

Q: Is it guaranteed that only bin files are changed? In the past MVC folder was added for example, I meant also the files that might have been replaced outside bin..

A: Of course, not only bin files are needed for Sitefinity to upgrade and run properly. In many cases additional files on the website need to be addressed/modified/replaced as well.
In a common case scenario (i.e. the simplest one: upgrading a project via project manager), only bin files are being replaced. As can be seen throughout the webinar, this is mostly what it takes to perform a successful upgrade. Web.config needs to be manually merged to accommodate all the users' requirements; of course this can become quite a chore when it comes to complex projects (this is not specific for Sitefinity but a basic rule for any website modification/migration/upgrade).
Those requirements may vary from one version to another. However, there are specific instructions related to advanced upgrade scenarios, which may be followed in the documentation. This webinar was not intended to address those; instead it followed certain common issues which were encountered by customers many times, to provide the right approach for upgrades. For more detailed version-based cases and for deeper-dive instructions per version, please refer to the Upgrade article on the Installation and Administration Guide.
Note that this is a rather recent documentation article which may help upgrading Sitefinity from any version.

Q: What if there are changes required in web.config, how would the upgrader know?

A: You have to manually merge the web.config between upgrades. We cannot guarantee that there are no third-party additions (except the default Sitefinity web.config), so we cannot merge automatically. (Also see the link in the previous answer).

Q: It would be nice to have a list of files that are touched to know which ones need to be uploaded again to server

A: You can find this in the documentation. We list new files so that you know what to include in your solution and deploy to the server.

Q: What exactly changes (except the version number) in the config files when we upgrade?

A: Generally it is only the versions that change. In rare cases if a configuration element is no longer valid and you have it in the configuration file it will be removed.

Q: Imports of module builder content from .xslx exported file, import of structure is there but not of content? Any plans for that?

A: We do not have immediate plans for this (5.4 or 6.0 versions), however our support staff can provide with sample project on the matter. The Dynamic Modules API is fully exposed and you can use it to import the data. Just open a ticket with this question.

Best practices with versions

Q: is there anything that can be done about the YSODs when someone upgrades but hasn't grabbed all the latest marketplace control references? Can nuget be aware of the Telerik.Sitefinity.dll version so that a nuget package could be targeted to the user that way? I mean I don't want users on 5.2 getting notifications that there's an update to my assembly when getting it would cause YSOD on their app.

A: We've seen nugget do binding redirects to the assembly of Sitefinity in my bin folder. It has not been thoroughly tested it though.

Q: I recently updated from 5.1 to 5.3, and some of my code using Fluent API did not work properly afterwards. Apparently changes/corrections had been made regarding translations. Is it possible to be aware of such details before upgrading?

A: We usually announce breaking changes in the release notes. You should read them before upgrading. We try to keep seamless backward compatibility but sometimes there are breaking changes. We provide guidance in the release notes in those cases.

Q: Are the release notes easily available on your website? Before upgrading I only found the headlines of the new version.

A: You can view them in your account or in our forums, e.g. at this link.

Q: Just to clarify, you said that you support two versions back INCLUDING SERVICES PACKS? So if I am on Sitefinity 5.1 SP1 the farthest I can upgrade to is Sitefinity 5.2 SP1?

A: We only support upgrades two intermediate versions back (including service packs). You can run a longer-ranged upgrade directly, but it is not recommended. Between 5.1 and 5.3 there are not huge schema changes so this upgrade is possible. Furthermore for each version we may need to execute specific scripts to upgrade our database. If there are too many such scripts (e.g. 4.3 -> 5.3) your process may timeout, thus not executing all scripts. That is if the project being upgraded is not being run in debug mode. For the sake of the simplified demos presented in the webinar, 5.1 -> 5.3 upgrade was OK.

Q: how do we know to which version do intermediate upgrades exist, like for instance from v4.x>5.3, you'd step to v5.0 but that had an instant hotfix...

A: Follow the order of sticky threads here. Because there's always an exception, disregard hotfixes :-)

Q: Do you think you could enhance the project manager so it is aware of problem version updates? Like if someone tries to upgrade from 4.4-5.4 they'll get a popup warning or just outright prevent it?

A: We've been discussing this, but so far did not have the time to add it to the manager.

Q: how would you recommend upgrading a website with high traffic?

A: With caution :-)
A mirror staging platform would a good idea too, to produce the upgraded version and fully test it. Then deployment of upgraded modules, web.config and any other required changes can be relatively quick and hopefully pain free (minding that Sitefinity's config files, in the majority of the cases, need not be overridden). There may be no way other than taking the site down, but this may at least help reduce the down-time..

Amazon S3 blob storage

Q: Why does the Amazon S3 provider work 'properly' with a URL to the service, but Dropbox had to do a duplicate content sync? Why couldn't Sitefinity have the link to the Dropbox file (in a manner similar to the Amazon S3 implementation) instead of pulling it and and storing locally?

A: This is mainly because of how Dropbox works and authentication and authorization. Also note that Dropbox is not a storage provider, but a libraries synch with Drobpox provider.

Q: What is CloudBarry?

A: CloudBerry Explorer for Amazon S3 is a freeware Amazon S3 and Amazon Glacier client designed to run in Windows environment. S3 Explorer provides a user interface to Amazon S3 accounts, files and buckets allowing browsing, creating, and deleting files and buckets. Freeware Amazon S3 client by CloudBerry Lab comes with a full support for CloudFront (Amazon Content Delivery Network (CDN)). It includes a set of tools to manage CloudFront HTTP and Streaming Distributions, Public and Private content and more.

Meta-webinar topics

Q: Will you be supplying the files from these demos?

A: Sure, we will do a blog post about this. See: This link (and then this).

Q: Will you share this training that we can review it later again?

A: All webinars are recorded and shared on the Webinars on Damand page. Sppecifically the Upgrades webinar is available here.

Q: Great help thanks for this tutorial


A: You're welcome!

Q: You are hitting or tapping the mic a lot.

A: Sorry about that, it was a sensitive table mic which amplified every little move/click of the mouse. Thanks for commenting this! We'll try to improve it for the next webinars.

2 comments

Leave a comment
  1. Disappointed Customer Apr 21, 2014
    Is it just me, or is the Sitefinity upgrade process one of the worst?
  2. Fenton Chester May 30, 2014
    It's not just you. 

    Leave a comment