33-Migrating-website-to-cloud - DevNet

advertisement
Migrating Website To Cloud
Partners’ Webinar
04/25/2013
Karol Jarkovsky
Solution Architect
karolj@kentico.com
Why cloud?
Scalability
Performance
High
Availability
Reliability
Georeplication
Cloud Architecture and Kentico I
[n]
Smart Search
Worker Role
…
ASP.NET Web
Role
I0
I1
I2
CDN
AppFabric
(Caching +
Session)
Blob Storage
SQL
Azure
Cloud Architecture and Kentico II
CDN
Blob Storage
Traffic
Manager
SQL
Azure
…
AppFabric
(Caching +
Session)
…
Blob Storage
Traffic
Manager
SQL Data Sync
Cloud Architecture and Kentico III
Cloud Architecture and Kentico IV
AppFabric
(Caching
+ Session)
•
•
•
•
Non-HIPAA compliant
Maybe slower to access due to the roundtrips between role and cache
Alternative caching options – In-role/Dedicated (local) Caching
Storing Session State  SQL Azure using ASP.NET Universal Providers
•
•
Network service using HTTP(S)
Use Azure Affinity Groups to locate hosted service and blob in same data
center
Access from different geographical regions may be slower  use CDN
Backup strategy  3rd party tools (CloudBerry, Cloud Storage Studio)
Blob Storage
•
•
•
SQL
Azure
•
Multi-deployment scenarios (different geographical regions)  use SQL
Data Sync to replicate
Backup strategy  3rd party tools (redgate SQL Azure Backup) OR copy
DB
Migration Stages
SQL Server DB
Code-base
Azure
Project
Web
Application
Website
Project
DB
DB
DB
SQL
Azure
Migrating Project to Azure
Both WSP and WAP
1. Upgrade project to .NET Framework 4.0+
–
Validate everything works before proceeding
2. Install clean Kentico Azure project
3. Copy customized files to the CMSApp project
–
–
–
Do it outside VS to get it done faster
DO NOT overwrite CMSApp’s web.config file – merge custom settings manually instead
DO NOT copy anything that you don’t need (old import/export packages, unused files in custom
locations, unused design files, etc.) – less files = smaller deployment package = faster deployment
4. Empty folders
~/App_Data/CMSModules/SmartSearch
- Except SmartSearch/_StopWords
~/App_Data/CMSModules/WebAnalytics
- Except WebAnalytics/MaxMind
~/App_Data/CMSModules/OnlineMarketing
~/App_Data/CMSTemp
5. In VS display all files and include new content
–
Include everything, but App_Data, Bin, obj folders
and any *.SLN files you copied over
Migrating Project to Azure
Additional steps - WSP
6. Convert newly added files to Web Application,
–
–
–
Right-click CMSApp project, and select Convert to Web Application
Converts files to WAP format, generates *.designer files, and relocates App_Code content
Move Old_App_Code[n] folder content to Old_App_Code, overwrite existing files with customized
version
Migrating Project to Azure
Migrating media files
7. Migrate meta files
–
If project size > 600 MB (Azure limits maximum size of deployment package)
• Meta files stored in ~/CMSFiles folder - exclude folder from project before deployment
• Copy files manually to cmsstorage/cmsfiles container in blob storage (path has to be all in
lower case!)
8. Migrate site files
–
If project size > 600 MB
• Site files stored in ~/<site_name>/files – exclude folder from project before deployment
• Copy files manually to cmsstorage/<site_name>/files container in blob storage
9. Migrate media libraries
–
If project size > 600 MB
• Library files stored in ~/<site_name>/media – exclude folder from project before deployment
• Copy files manually to cmsstorage/<site_name>/media container in blob storage
• Manually update links to library files to ~/CMSPages/GetAzureFile.aspx?path=<file_path>
Best-practices & Recommendations
Migration
• Deployment package includes ONLY Content items
–
•
Make sure all your custom files has attribute Build Action set to Content
Including huge number of custom files may take too long in VS
–
You can edit CMSApp.proj file manually and include files like
<ItemGroup>
<Content Include="CMSAdminControls\AsyncBackground.ascx" />
<Compile Include="CMSAdminControls\AsyncBackground.ascx.cs">
<DependentUpon>AsyncBackground.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="CMSAdminControls\AsyncBackground.ascx.designer.cs">
<DependentUpon>AsyncBackground.ascx</DependentUpon>
</Compile>
</ItemGroup>
Best-practices & Recommendations
•
After migration the Powered by Windows Azure logo should appear in CMS UI
–
Make sure ~/Old_App_Code/Application/CMSHttpApplication.cs calls
AzureInit.Current.ApplicationStartInit() and file ~/Old_App_Code/CMSModules/WindowsAzure/AzureInit.cs
exists in the project folder
Development
• When development using local Azure Emulator is slow you can open ~/WebApp.sln
(instead ~/CMSAzure.sln) and work with it as a regular WAP,
–
It’s typically faster to run debug on WAP project, as well as responsiveness of WAP is better than
Azure emulator. You’ll need 2 versions of web.config and exclude
~/Old_App_Code/CMSModules/WindowsAzure/AzureInit.cs from WAP solution
•
If you get errors related to starting roles when debugging as on Azure Emulator, set
CMSAzure to use IIS Express instead of IIS
•
When modifying code files containing *.designer file double-check control types
are matching auto-generated types
–
You won’t get error during project publishing until
loading page/control for the first time
Best-practices & Recommendations
•
When using Windows Distributed Cache (AppFabric Cache) for caching and Session
storage, make sure all objects you add to cache/session are serializable
–
You most likely won’t get any errors related to serialization on localhost, until deployed to cloud
Deployment
• Wire settings from web.config file with CMSAzure\ServiceConfiguration.Cloud.csfg
–
–
•
Use Traffic Manager to direct users to the closest region deployment
–
•
Won’t need to re-deploy with every web.config change
Don’t forget to sync with local solution
You can test Traffic Manager forwards to the right region using some on-line load testing tool like
Load Impact
Configure External services to run scheduled tasks as standalone Windows Service
running as part of Smart Search worker role
–
External services are disabled in Azure by default, requires additional configuration
THANK YOU!
Download