Skip to content

Instantly share code, notes, and snippets.

@alexleventer
Last active April 18, 2016 21:17
Show Gist options
  • Save alexleventer/287309f9b8a0ca542952039ba87b01a5 to your computer and use it in GitHub Desktop.
Save alexleventer/287309f9b8a0ca542952039ba87b01a5 to your computer and use it in GitHub Desktop.
GitLab Guest Blog
layout title date comments author author_twitter image_title
post
Build, Dockerize, and Deploy your GitLab Repositories with Distelli
2016-04-21 12:00
true
Alex Leventer from Distelli
alexleventer
/images/gitlabintegrationimage.jpg

This is a guest post by Distelli.

Here at Distelli, we've obsessed with simplifying DevOps so developers can focus on product features, not infrastructure automation.

Today, we're excited to announce the release of the Distelli/GitLab integration. The integration makes it extremely simple to continuously deliver your application from GitLab to any server in the world. Simply push to GitLab to trigger a build, Dockerize, and deploy your application in minutes.

Below I'll demonstrate how simple it is to automate the build, test and deployment of a simple Node.js GitLab repository using Distelli.

How to connect GitLab and Distelli

Connecting GitLab and Distelli takes a matter of minutes.

Create a Distelli account:

Head over to Distelli and create an account.

Alt text

Create an application:

Once you’ve created an account, you’ll automatically be redirected to create your first application. Select the blue Connect GitLab button.

Alt text

Add GitLab credentials:

You'll be prompted to add your GitLab host URL and API token. If you're using the hosted version of GitLab, enter https://gitlab.com. Your token can be found in the Profile Settings > Account section of your GitLab account. Once you've added your credentials, click the blue Add Credentials button.

Alt text

Select a GitLab organization:

Next, you'll need to select a GitLab organization. I'll select my personal account.

Alt text

Select a repository:

Select a GitLab repository to associate with your Distelli application. I'll select a Hello-World Node.js repository I created for this example.

Alt text

Set build triggers:

Next, you'll need to set build triggers or rules on which branches Distelli should build. For this step, you can manually select branches or set a regular expression to add branches automatically. I'm going to configure Distleli to only build on changes to my master branch.

Alt text

Set build steps:

Now, we need to set our build steps. I'll add an npm install command in my build step to install all my Node.js package dependencies.

Alt text

Start your first build:

Finally, I'll select the Javascript build image and start my first build by clicking the blue Looks Good. Start Build! button. This tells Distelli to build my application on one of Distelli's hosted build servers inside of a Docker container with Distelli's Javascript image.

Alt text

Below, we can see our first build is in-progress. The GitLab commit is linked below the commit message.

Alt text

Setting up a pipeline:

A new release of my application is created anytime a build succeeds. I specify in my PkgInclude section what files to include in my release. Now that we've created a release, let's set up an application pipeline. Click on your application's name:

Alt text

Let's set up Distelli to automatically deploy to our beta environment whenever a build succeeds. Click the Add Step button on the bottom right of the page:

Alt text

I've set up my beta environment to automatically be deployed to whenever a build succeeds.

Alt text

Now let's rebuild our GitLab repo and test that the our application is automatically deployed when the build succeeds. Click the blue wrench icon at the top of the page to rebuild.

Alt text

We can see right from the application pipeline that our build is in progress.

Alt text

The application has been successfully deployed! We can click on the deployment number to see additional information on the deploy.

Alt text

Questions about Distelli? Shoot us an email at [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment