Deploy a Azure Web App using Gitlab – Part 3

In Deploy a Azure Web App using Gitlab – Part 1 a Gitlab server was installed and some basic settings were applied. In Deploy a Azure Web App using Gitlab – Part 2  a SSL certificate was added so that HTTPS traffic could be used. In this third and final part I will start with what I intended to do; namely deploying a simple web page from Gitlab to an Azure Web App. More specific using a private Git repository so that the “code” will be safe. In short this is what’s going to happen:
1. Create a new project in Gitlab
2. Create a new App service
3. Connecting Gitlab with Azure
4. Connecting Azure with Gitlab
5. Configuring triggers or Webhooks

So creating a new project is pretty easy. Just hit the New Project button and give your project a name. I want to use a private project so that I know nobody can access the resources.

So create the new project and then we can start uploading some basic content. I like to use Visual Studio Code for this. Gitlab is kind enough to provide you with all the necessary commands to get started. These can be found at the project starting page.

[cc lang=”bash”]git clone https://gitlab.stephanvdkruis.com/root/example-project.git
cd example-project
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master[/cc]

Continue reading “Deploy a Azure Web App using Gitlab – Part 3”

Deploy a Azure Web App using Gitlab – Part 2

So in Deploy a Azure Web App using Gitlab – Part 1 the Gitlab server was deployed and the url was changed by using an ssh connection.

In the second part I wanted to share how to implement a SSL certificate into your Gitlab server so you can have a secure connection. Please note that I bought a certificate for my sub domain. There is also documentation available on Gitlab, but I will show every step I took to accomplish this. Furthermore I came across some issues synchronizing Gitlab with my local PC. This was caused by not having the appropriate Root Certificates on the Gitlab server, however this was not explained in the Gitlab documentation.

Getting started

OK so you will need your key and .crt file. These files will be copied to Gitlab. If you enable HTTPS on your Gitlab server, Gitlab will check the /etc/gitlab/ssl/ directory for the key and certificate. This directory does not exist by default so this has to be created by running

[cc lang=”bash”]sudo mkdir -p /etc/gitlab/ssl
sudo chmod 700 /etc/gitlab/ssl
cd /etc/gitlab/ssl/[/cc]

Continue reading “Deploy a Azure Web App using Gitlab – Part 2”

Deploy a Azure Web App using Gitlab – Part 1

So recently I decided to start writing about things that I want to learn and that interest me. One of the first things I thought of doing was to use Gitlab to deploy virtual machines on Azure. I recently saw the power of using Desired State Configuration (DSC) to manage Windows machines, which were deployed from Gitlab. Basically you can deploy entire environments with some simple code. I thought this was amazing and I wanted to learn how to do this.

But I wanted to start small, and first set up an environment from where I can build more complex projects. So I decided to create a simple Azure Web app to test my environment. This Web App should be connected to a private Gitlab repository. In the process of building this environment I was faced with some challenges, so I thought why not make this the subject of my first blog post. I will show some basic configurations, including enabling HTTPS on Gitlab. And I will show how to deploy a simple website using Gitlab, by pushing code from a local pc.

Continue reading “Deploy a Azure Web App using Gitlab – Part 1”