Skip to main content

Posts

Showing posts from March, 2020

Building an Azure web app using continuous deployment in 15 minutes

Thanks to things like cloud services and continuous deployment tools, it’s become easier than ever to build small web apps using CI/CD workflows. In this tutorial, I’ll show you how to use Azure, GitHub and Python to build a very simple web app which auto-refreshes every time you update your code. All you need for this is a free GitHub account and a free Microsoft Azure account.Creating our codeOnce you’ve signed up, go to GitHub and create a new repository with any name you want. In it, create two new files:requirements.txtFlask==1.0.2 index.pyfrom flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" You can make these files directly in your web browser, or you can use a git client to clone the repository and create the files. Your git repository should look like this:Creating our app serviceLog into the Azure web portal and click on App Services and then Add. Here, create a new app service using Python 3, pick a r…

Publishing your first Docker container

Docker is a great way to deploy micro services, or any application that can be self-contained and is used for a specific task. I’ve been deploying Docker containers for a while now, along with managing them, but I had never created a container from scratch. I decided to change that and create a container for my Healthstone Monitoring System app, and I’ll bring you along to show how easy it can be to convert a traditional app into a Docker container, then publish it for anyone to use.Setting up DockerThe first thing to do is install and configure Docker. I’m using a CentOS Linux VM and you can see this article on how to set it up. Basically, these are the commands to run:yum install yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce systemctl start docker systemctl enable docker docker login Once done, you should have the Docker service running on your local machine, and be ready to create images.Creating the Doc…

Continuous integration workflow using GitHub, Travis and AWS EBS

This article will be a quick walkthrough of how a CI/CD workflow would look like using some of the most popular cloud based tools. The tools we’ll make use of are:The Python Flask framework to display a simple web appDocker for build portabilityGitHub to store our codeTravis to automate the building, testing and deployment processAWS Elastic Beanstack (EBS) to host the web appAt a high level, what we want to accomplish is an automated method which will be triggered by our code commit, build the Docker container with our app, do some basic sanity tests, and if those pass, automatically deploy the app in production on AWS.Sample applicationThe sample application I created is available at https://github.com/dendory/simpleflask and is a basic two-page web app that allows you to click a button, enter a username, and have it displayed on the page. The first step is to clone the git repo to your local machine and install the prerequisites. You need Python 3, along with the connix an…