TGIMBA is getting automated – AWS Continous Integration Pipeline for .NET Website

Git Hub Code

The second of three Continuous Integration (CI) pipelines has been completed for TGIMBA 🙂  

 

Screen Shot 2017-11-06 at 9.56.45 PM

The first was the TypeScript Node JS Application Programmatic Interface (API) I plan to replace the current .NET 4.6X Windows Communication Foundation (WCF) service with.  With .NET core in more use everyday, TGIMBA needs to leave its older technology suites behind.  Given some Node JS applications I am working on now at work, it seemed appropriate to embrace that with TGIMBA.  That post is here.

However, before I can do that upgrade, I want to create CI pipelines so that everything is automatically delivered to the user.  Doing that for the .NET 4.6.X TGIMBA website was a lot more complicated than I thought.

First, .NET 4.6.X is considered ‘Classic .NET’.  This was very evident to me when I looked through AWS’s environment options in the CodeBuild suite.  The only .NET option is .NET Core 1.  So, to learn my options, I did some reading on the ways you can compile .NET 4.6.X applications.  What I learned is that outside of Visual Studio and TFS, there are not a lot of easy options.  So, given that I will update the .NET part of TGIMBA (and there will always be a .NET component) to .NET Core 1 or 2, I opted to pursue this CI pipe line in a rather unusual manner.

Like the TypeScript API CI Pipeline, this pipeline pulls from GitHub.  So, I decided that any git commits (I am using a GitHub Visual Studio plug in) for this project will be compiled and ready to deploy.  This means adding the bin directory to the repository.  Not great, but it works.  I will change this when I start the .NET Core update.  The other interesting thing was I opted to use a Node JS environment for the CodeBuild part of this pipeline.

The following steps complete the process:

  • buildspec.yml
    • Remove portions of the Git repository files not needed for the deployment
    • Install three node libraries
      • FTP – Used to delete and upload the files to my website.
      • fs/fs-finder – These two libraries are used to update the web.config with the production database connection string.

Screen Shot 2017-11-06 at 10.00.41 PM

  • ftpLogin.js – This is a Javascript module I wrote to delete old files, upload the new files and update the web.config.
    • The FTP credentials and Database Connection string are obtained from environment variables inside the CodeBuild.

Screen Shot 2017-11-06 at 10.02.24 PM

While not ideal, it does work.  One issue I noticed is that if someone tries to access the site while a deploy is in progress, it can cause issues.  Given this is a fun project, I don’t know if I will do anything about this for now.  If I do, I will most likely put up a maintenance page and take the site off line.  I am not sure I can automate this in my current setup, but I will eventually.

The third CI Pipeline will be for the TGIMBA Android Application.

Stay tuned!

References

  1. https://www.npmjs.com/package/ftp
  2. https://github.com/mscdex/node-ftp
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s