150 likes | 412 Views
Migrating Website To Cloud. Partners’ Webinar 04/25/2013 Karol Jarkovsky Solution Architect karolj@kentico.com. Why cloud?. Geo-replication. Performance. Scalability. High Availability. Reliability. Cloud Architecture and Kentico I. Smart Search Worker Role. ASP.NET Web Role. [n].
E N D
Migrating Website To Cloud Partners’ Webinar 04/25/2013 Karol Jarkovsky Solution Architect karolj@kentico.com
Why cloud? Geo-replication Performance Scalability High Availability Reliability
Cloud Architecture and Kentico I Smart Search Worker Role ASP.NET Web Role [n] … I0 I1 I2 CDN Blob Storage AppFabric (Caching + Session) SQL Azure
Cloud Architecture and Kentico II AppFabric (Caching + Session) SQL Azure Traffic Manager … CDN Blob Storage
Cloud Architecture and Kentico III Traffic Manager … Blob Storage SQL Data Sync
Cloud Architecture and Kentico IV • 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 AppFabric (Caching + Session) • 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 Azure Project Web Application Code-base Website Project DB DB SQL Azure DB SQL Server DB
Migrating Project to Azure Both WSP and WAP • Upgrade project to .NET Framework 4.0+ • Validate everything works before proceeding • Install clean Kentico Azure project • Copy customized files to the CMSApp project • Do it outside VS to get it done faster • DO NOT overwrite CMSApp’s web.configfile – 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 • Empty folders ~/App_Data/CMSModules/SmartSearch - Except SmartSearch/_StopWords ~/App_Data/CMSModules/WebAnalytics - Except WebAnalytics/MaxMind ~/App_Data/CMSModules/OnlineMarketing ~/App_Data/CMSTemp • 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 • 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 • Migrate meta files • If project size > 600 MB (Azure limits maximum size of deployment package) • Meta files stored in ~/CMSFilesfolder - exclude folder from project before deployment • Copy files manually to cmsstorage/cmsfilescontainer in blob storage (path has to be all in lower case!) • 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>/filescontainer in blob storage • 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>/mediacontainer 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 • Won’t need to re-deploy with every web.config change • Don’t forget to sync with local solution • Use Traffic Manager to direct users to the closest region deployment • 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