More in this section
Categories
Bloggers
Blogs RSS feed

Building Sitefinity Continuous Deployment on AWS with GitHub, Jenkins and AWS Elastic Beanstalk

by The Progress Team

In a deployment pipeline, automation lets you focus more on your application and worry less about the manual aspects of deployment or the steps required to get application code updated. This is in addition to enabling you to continuously integrate code changes and offer faster feedback to the developers.

In this blog post, we’ll show you how to use GitHub, Jenkins AWS Elastic Beanstalk Deployment plugin and AWS Elastic Beanstalk to create a deployment pipeline for Sitefinity that is updated automatically every time you change your code. For this, we assume you have working knowledge of Git and Amazon EC2.

Before we get started, let’s cover what Elastic Beanstalk and Jenkins are, and the roles they play.

Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go and Docker. Elastic Beanstalk enables you to focus on development instead of infrastructure, as it will automatically handle provisioning and operating the infrastructure required to get your apps up and running.

Jenkins is a popular continuous integration and continuous delivery tool. Jenkins can build and test your software projects continuously while offering various delivery options as well as a very extensible interface powered by Jenkins plugins.

For this demo, we are using the GitHub repository (this is where our Sitefinity sample application is stored), one dedicated Jenkins server (which is responsible for pulling our latest source code changes from GitHub), building our solution and preparing a package (which is deployed to AWS using Jenkins AWS Elastic Beanstalk deployment plugin).

Preparation

First, we must prepare our local Sitefinity solution to be deployable in AWS. For that, we need to:

  • Export the local DB instance and then import it to AWS (more info)
  • Include 'Configuration' folder of your Sitefinity app as well as 'Sitefinity.lic' as part of your project

VS

  • Make sure your connection string in DataConfig.config is pointing to your RDS instance in AWS

DataConfig

After that, we need to prepare our source code as package ZIP file, then we will upload this package for our initial deployment in AWS:

  • Open "Developer Command Prompt for VS"
  • Navigate to your Sitefinity Web App directory
  • Execute following command: msbuild.exe SitefinityWebApp.csproj /t:package /p:DeployIisAppPath="Default Web Site"

MSBuild

  • After that, the following package should be available in your main project directory: ~/obj/Debug/Package

Zip

GitHub Repo Setup

First, create a GitHub repo, commit and push your changes.

GitHubRepo

Once you’ve pushed your changes, your repository should look like this:

GitHubSite

Deployment Environment Setup

This environment is where the Jenkins AWS Elastic Beanstalk deployment plugin will deploy our code.

Create an Elastic Beanstalk application named SitefinityDemo. Next, create an Elastic Beanstalk environment named SitefinityDemo-env with the following parameters:

For Web Server Environment, choose Create Web Server.

EnvironmentTier

For Predefined configuration, choose .NET (Windows/IIS).

EnvironmentConfig

For Source, choose Upload your code, then click Upload

EnvironmentUpload

Choose your ZIP file located in ~/obj/Debug/Package and click Upload.

EnvironmentZip

Click Configure more options

EnvironmentConfigMore

Under Network section click Modify

EnvironmentModify

Check all Instance subnets and, most importantly, check instance security group to match your RDS security group, as shown below:

EnvironmentInstance

Click Create Environment

 

Elastic Beanstalk will begin provisioning your environment as shown below:

ElasticEvn

After successfully creating our environment, there will be a URL on which our Sitefinity Web App will be available.

ElasticGreen

Click on the URL, and there is our Sitefinity hosted in AWS Elastic Beanstalk environment!

LiveWebSite

Build Environment Setup

Once we’ve prepared our deployment environment, we need to set up our build environment. First install and set up Jenkins on an EC2 instance (https://github.com/laardee/jenkins-installation).

Once you have installed Jenkins, navigate to Manage Jenkins -> Manage Plugins and install the following plugin: AWS Elastic Beanstalk Deployment Plugin

BuildEnv

Click New Item

BuildEnvNew

Enter “SitefinityDemo” for the name and chose Freestyle project.

Jenkins Job Configuration

First check, GitHub project option.

Jenkins

Under the Source Code Management section:

  • Choose Git and enter the Repository URL, Credentials and specific branch.
  • Under Build Triggers section, check GitHub hook trigger for GITScm polling—this ensures that after we commit something on our localmachine, the Jenkins job will trigger automatically

JenkinsSource

  • Note: Make sure in your GitHub repository that webhooks are configured as followed:

WebHooks

Under Build Environment:

  • Check “Delete workspace before build starts option”

Under Build Sections:

  • Click “Add build step” and choose “Build a Visual Studio project or solution using MSBuild”

JenkinsBuildStep

The following argument is important: /t:package /p:DeployIisAppPath="Default Web Site". This will make sure that each time you commit your changes to source code, a new package will be created and then deployed to AWS using Elastic Beanstalk deployment plugin.

Click “Add build step” and choose “AWS Elastic Beanstalk”.

  • For Credentials, you should configure your AWS Credentials (you should know your Access Key and Secret Access Key)
  • For AWS Region, enter the region in which you have deployed your initial Sitefinity Web App version (in our case, “eu-central-1”)
  • Under Application and Environment—this is the environment where our package will be deployed each time:
    • Application Name: SitefinityDemo
    • Environment Name: Sitefinitydemo-env
  • Under Packaging—this is what package will be deployed each time

Root Object: “\obj\Debug\Package\SitefinityWebApp.zip”

BuildFinalConfig

Ready to Use

Now, you have a continuous deployment that will automatically build and deploy to Elastic Beanstalk each time you check in code. We are curious to hear more about your deployment setup, so share your setup in the comments. Happy deploying!

Are you interested? Let's get started!

Schedule a Demo    Start a trial

2 comments

Leave a comment
  1. arhm Apr 06, 2018
    nice
  2. Delhidating Apr 09, 2018
    it's really awesome article, i like it much more, thanks for sharing.!!  Housewife Escorts Delhi

    Leave a comment