11 Nov 2019
[Guest Blog] Continuous delivery: How to easily take your Forge application from Development to Production
This is a guest blog submitted by Tom 'Elvis' Jones, a Solutions Architect with Amazon Web Services, Vinod Shukla, a Partner Solutions Architect with Amazon Web Services, and Jaime Rosales, a Senior Developer Advocate with Autodesk Forge. AWS will be at Forge DevCon this year - come find them in the Collaboration Zone in the Village. Forge DevCon will be held in Las Vegas, Nevada, on Monday, November 18. Get tickets here!
I've participated in multiple Autodesk Forge DevCons and Forge Accelerators. I love to see the creativity and the different business problems that developers are solving using Autodesk Forge. One common challenge I have seen is how to move a development application to a stable robust hosting environment. This is the reason we created the Autodesk Forge on AWS Quick Start. This Quick Start builds an Autodesk Forge application environment on the Amazon Web Services (AWS) Cloud with a highly available architecture and incorporates many AWS best practices. It’s a fantastic tool for getting up to speed quickly. Today we offer two versions of the Quick Start: Autodesk Forge Application, and BIM 360 Integration. Both versions have support for NodeJS and .Net Core server-side languages. In this blog post I want to expand on these Quick Starts and describe how to use automation to ease the build, test, and deployment of a Forge application in every stage of deployment.
Going from development to production can be time consuming and require many manual steps to move the application from your development machine to the production server. Pushing code into a source code management system, compilation, running unit tests and functional tests, ensuring the correct and consistent configuration settings are some of the challenges when building an application. AWS offers services to help with each step of this process. Let’s walk through a deployment and describe how these services work together to solve these challenges.
The start of this journey is a developer using their personal machine to write. They will check their code into a source code management (SCM) system for versioning. In many cases the SCM will be configured along with a build server. The build server will pull the code from the SCM and kick off a build every time the code is checked in. That’s a good start, but what if you want to automate the whole process to move from continuous build to continuous delivery? (Actually, some organizations will require a manual verification check before pushing any code to production, so we will include that in our example.)
Let’s take a look at what the continuous integration and delivery (CI/CD) model for deploying Forge and BIM 360 integration applications would like on AWS using the respective Quick Starts. AWS has over 165 web services. Today we are going to look at some of the AWS services focused on management tools and developer tools that we’ll use to build our CI/CD pipeline. The first service we use is AWS CloudFormation which provides a common language to describe and provision all the infrastructure resources in your cloud environment. The Quick Start uses AWS CloudFormation as the foundation for its automation. To build the CI/CD pipeline, we use AWS CodePipeline, a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates. This CI/CD pipeline itself is automated using AWS CloudFormation so you can iterate and update it to meet your needs.
The CI/CD pipeline has the following stages.
Source
Consider an example where you start off with the base Autodesk Forge Quick Start and are enhancing it to build your Forge application. The first thing you’ll do is to check out the code from the SCM (in our example we are using GitHub) and make any changes locally for testing. When you are happy with your changes, you’ll commit the changes in develop branch and push to your GitHub repository. In addition, you’ll build a set of input parameters to run your code, this will consist of configuration parameters such as choosing a runtime language for your application, and also secrets such as your Forge client ID and secret. For secure storage of your configuration, we will be using an encrypted S3 bucket using Amazon S3, an object storage service that offers industry-leading scalability, data availability, security, and performance.
Test
In the event of a source change (code is committed to GitHub or a configuration update is pushed to Amazon S3) a trigger will start the AWS CodePipeline build process, pulling the code from these locations and running a build using AWS CodeBuild which is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy. The test CodeBuild project invokes TaskCat (an open-source tool to test CloudFormation templates built by the AWS Quick Starts team) to test your source modifications. If the tests are successful, we move on to the next stage.
Git merge
Typically in SCM, you have several branches. For example, you could have a develop branch for development work and a master branch that is used as a base for production deployment. After the tests pass in the previous step, we use a custom action using AWS Lambda, a service that lets you run code without provisioning or managing servers, to merge the development branch to the master branch. A merge to master branch triggers the next stage.
Sync to S3
CodePipeline supports sourcing directly from GitHub, but does not support Git submodules at this time. To run the updated code in production, we create a CodeBuild job that takes the updated master branch and recursively copies the GitHub repository contents to your bucket in Amazon S3 that holds the production templates. We then move on to the next and last deployment stage.
CloudFormation deployment
CodePipeline supports AWS CloudFormation as a deployment option. After the new code has synced to Amazon S3, the pipeline invokes the CloudFormation deployment stage. While this could be completely automated with no manual intervention, it may be a good idea for an administrator to review artifacts and changes prior to approving the deployment. We do this in two steps, first we create a change set that an administrator could review to understand what changes are included in the deployment. And then only if the administrator manually approves the change, the deployment will proceed.
At the end, when the pipeline execution is successful, you will see your change in GitHub deployed to production automatically with just one manual step that requires you to choose Approve action before the final deployment.
Conclusion
The Autodesk Forge is a powerful platform for developers working with design, engineering, and construction data. Using either of the Autodesk AWS Quick Starts simplifies the creation of a highly available environment to host applications. Quick Starts use CloudFormation templates to provide a consistent way to deploy and update the required infrastructure. These templates are best stored in a SCM, effectively creating version-controlled infrastructure. Placing CloudFormation into a deployment pipeline using AWS CodePipeline allows for complete automation of the application deployment. This results a continuous delivery pipeline where every step is automated insuring reliable updates to both the application and the infrastructure. Continuous delivery increases agility and allows your developers to focus their energy and time on development to delight your customers.
I hope this article has given you some insight into how automation can ease deployment and operations, freeing up time to focus on development and enabling greater agility. Here are some options to learn more about AWS and the Autodesk Forge:
-
Visit the AWS booth at the Forge DevCon on Monday November 18th
-
Attend our workshop during Autodesk University: Forge and Amazon Web Services: A Perfect Match - SD323978-L, on Wednesday November 20th at 2:45pm
-
View a recording of the How to build your Forge application on AWS webinar
-
Try the Autodesk Forge on AWS Quick Starts
-
Autodesk Forge Application on AWS (Node.js and .NET)
-
Autodesk BIM 360 Integration on AWS (Node.js and .NET)
-
See you at Forge DevCon! If you haven't registered yet, there's still time to get your pass here.