Deploying an ASP.NET Core web app to an AWS Linux VM and SQL Server for Linux - Will it Deploy? Episode 7
Welcome to another Will it Deploy? episode where we try to automate the deployment of different technologies with Octopus Deploy. In this episode, we're trying to deploy an ASP.NET Core 2.0 web app to an Amazon Web Services (AWS) Ubuntu Linux Virtual Machine (VM) with SQL Server for Linux. We also explore setting up a cloud-based delivery pipeline with AppVeyor and Octopus.
NOTE: Octopus Cloud is coming soon! Register your interest and stay up to date with our cloud-based solution.
Our app is a random quote generator web app called Random Quotes. This is fairly simple, but it'll allow us to walk through how to automate the deployment of an ASP.NET Core web application with a database to an Ubuntu Linux VM and SQL Server for Linux running in AWS.
- Microsoft ASP.NET Core 2.0 web app.
- Entity Framework Core 2.0 framework.
- Build with AppVeyor.
- Deploy with Octopus.
Kudos to our marketing manager Andrew who has been learning to code and built the first cut of this app. Nice job!
- AWS EC2 Ubuntu virtual machine.
- Microsoft SQL Server 2017 for Linux database
So will it deploy? Yes it will!
Our cloud-based delivery pipeline looks like the following:
We're committing our source code to GitHub, building our app automatically with AppVeyor, and deploying to an AWS Ubuntu VM with Octopus.
It's quick and easy to integrate AppVeyor with Octopus. We're using a custom build script to build and package our application and we configure the 'Octopus Deploy' deployment provider to deploy it.
Our deployment process looks like the following:
- Octopus Deploy a Package step to acquire/unzip our database scripts on the Octopus Server.
- Octopus Community Contributed step template - SQL - Execute Script File to execute our Entity Framework Core migration script agaist our SQL Server database.
- Octopus Deploy a Package step to deploy our ASP.NET Core web application to our Ubuntu Linux VM and configure it appropriately.
This project uses the following variables to store our app settings and database connection details.