Deployment - a dry-run.

by Thomas Kuhnert

The idea of an automated deployment strategy always bugged me. I used a few years the cucumbersome way of manually logging per ssh into the server, go to the directory and make a git pull.
puzzling. It was really to archive a proper release structure and if something breaked, it was hard to roll back to a previous version.
So I made some research and found Ansible. It fulfilled totally my requirements and i had a project to that time, which i could use as an example code-base to write my own deployment infrastructure.

Goal

  1. Have a single project which manages all deploys from all projects
  2. SSH into my server, install all required software eg. node, npm, pm2 (first we try to a VM)
  3. create timestamp release folder
  4. deploy my current master into it
  5. symlink it
  6. restart the server

Prerequisits

Screenshot

  1. Virtual Box installed on the local machine
  2. Ubuntu Server iso to install on the virtual machine
  3. Ansible installed on the local machine

Installation

For installing ubuntu on the vm I mostly followed this guide.

Ansible setup

Ansible human readable log

Ansible's output is by default quite ugly. To format its output in a more pretty way I saved the human-readable log file to /callback_plugins/human_log.py and added the following lines to my ansible.cfg :

callback_plugins = callback_plugins/
log_path = ansible.log

callback_plugins is the folder for my human_log.py

log_path saves the ansible output to a file

Add this to your application.js

1
2
3
4
5
body
  font-weight: 400
  line-height: 1.45
  font-size: 22px

Some ruby code

1
2
3
4
5
class SkillsController < ApplicationController
  def index
    @skills = Skill.all
  end
end

And there you go

1
2
3
4
5
6
$(document).ready(function(){
  var simplemde = new SimpleMDE({ 
    element: document.getElementById("post_content")
      autofocus: true,
   });


Leave a comment!