How to HTTPS with Hugo LetsEncrypt and HAProxy

Intro Hi folks. Today, I would like to write about how to do HTTPS for a website, without the need to buy a certificate and set it up via your DNS provider. Let’s begin. Abstract What you will achieve by the end of this post: Every call to HTTP will be redirected to HTTPS via haproxy. HTTPS will be served with Haproxy and LetsEncrypt as the Certificate provider. Automatically update the certificate before its expiration. No need for IPTable rules to route 8080 to 80. Traffic to and from your page will be encrypted. This all will cost you nothing. I will use a static website generator for this called Hugo which, if you know me, is my favorite generator tool. These instructions are for haproxy and hugo, if you wish to use apache and nginx for example, you’ll have to dig for the corresponding settings for letsencrypt and certbot. ...

February 15, 2017 · 9 min · hannibal

Go Development Environment

Hello folks. Here is a little something I’ve put together, since I’m doing it a lot. Go Development Environment If I have a project I’d like to contribute, like GoHugo, I have to setup a development environment, because most of the times, I’m on a Mac. And on OSX things work differently. I like to work in a Linux environment since that’s what most of the projects are built on. So here you go. Just download the files, and say vagrant up which will do the magic. ...

December 8, 2015 · 1 min · hannibal

Kill a Program on Connecting to a specific WiFi – OSX

Hi folks. If you have the tendency, like me, to forget that you are on the corporate VPN, or leave a certain software open when you bring your laptop to work, this might be helpful to you too. It’s a small script which kills a program when you change your Wifi network. Script: #!/bin/bash function log { directory="/Users/<username>/wifi_detect" log_dir_exists=true if [ ! -d $directory ]; then echo "Attempting to create => $directory" mkdir -p $directory if [ ! -d $directory ]; then echo "Could not create directory. Continue to log to echo." log_dir_exists=false fi fi if $log_dir_exists ; then echo "$(date):$1" >> "$directory/log.txt" else echo "$(date):$1" fi } function check_program { to_kill="[${1::1}]${1:1}" log "Checking if $to_kill really quit." ps=$(ps aux |grep "$to_kill") log "ps => $ps" if [ -z "$ps" ]; then # 0 - True return else # 1 - False return 1 fi } function kill_program { log "Killing program" `pkill -f "$1"` sleep 1 if ! check_program $1 ; then log "$1 Did not quit!" else log "$1 quit successfully" fi } wifi_name=$(networksetup -getairportnetwork en0 |awk -F": " '{print $2}') log "Wifi name: $wifi_name" if [ "$wifi_name" = "<wifi_name>" ]; then log "On corporate network... Killing Program" kill_program "<programname>" elif [ "$wifi_name" = "<home_wifi_name>" ]; then # Kill <program> if enabled and if on <home_wifi> and if Tunnelblick is running. log "Not on corporate network... Killing <program> if Tunnelblick is active." if ! check_program "Tunnelblick" ; then log "Tunnelblick is active. Killing <program>" kill_program "<program>" else log "All good... Happy coding." fi else log "No known Network..." fi Now, the trick is, on OSX to only trigger this when your network changes. For this, you can have a ’launchd’ daemon, which is configured to watch three files which relate to a network being changed. ...

October 26, 2015 · 2 min · hannibal

Jenkins Job DSL and Groovy goodness

Hi Folks. Ever used Job DSL plugin for Jenkins? What is that you say? Well, it’s TEH most awesome plug-in for Jenkins to have, because you can CODE your job configuration and put it under source control. Today, however, I’m not going to write about that because the tutorials on Jenkins JOB DSL are very extensive and very well done. Anyone can pick them up. Today, I would like to write about a part of it which is even more interesting. And that is, extracting re-occurring parts in your job configurations. ...

October 15, 2015 · 4 min · hannibal

How to Aggregate Tests with Jenkins with Aggregate Plugin on non-relating jobs

Hello folks. Today, I would like to talk about something I came in contact with, and was hard to find a proper answer / solution for it. So I’m writing this down to document my findings. Like the title says, this is about aggregating test result with Jenkins, using the plug-in provided. If you, like me, have a pipeline structure which do not work on the same artifact, but do have a upstream-downstream relationship, you will have a hard time configuring and making Aggregation work. So here is how, I fixed the issue. ...

October 2, 2015 · 4 min · hannibal

Selenium Testing with Packer and Vagrant

So, recently, the tester team talked to me, that their build takes too long, and why is that? A quick look at their configuration and build scripts showed me, that they are actually using a vagrant box, which never gets destroyed or re-started at least. To remedy this problem, I came up with the following solution. ...

July 16, 2015 · 7 min · hannibal

Packer 0.8.1.

Previously I wrote that the scripts I’m writing, are failing because Packer hangs. Apparently, this was a known issue. And apparently, I was using an older version, 0.7.5. After I updated everything is working wonderfully!!! And for my thanks, here is an updated PowerShell script for provisioning my dotnet stuff. $source = "http://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe" $destination = "C:\Windows\Temp\dotnet.exe" Write-Host 'Starting to download dotnet file.' try { (New-Object System.Net.WebClient).DownloadFile($source, $destination) } catch [Exception] { Write-Host "Exception during download. Probable cause could be that the directory or the file didn't exist." Write-Host '$_.Exception is' $_.Exception } Write-Host 'Download done. Checking if file exists.' if (!(Test-Path $destination)) { Write-Host 'Downloading dotnet Failed!' } else { Write-Host 'Download successful.' } Write-Host 'Starting install process.' try { Start-Process -FilePath $source -ArgumentList "/q /norestart" -Wait -PassThru } catch [Exception] { Write-Host 'Exception during install process.' Write-Host '$_.Exception is' $_.Exception } Write-Host 'All done. Goodbye.' Thanks for reading! ...

July 1, 2015 · 1 min · hannibal

Powershell can also be nice -Or Installing Java silently and waiting

Hello folks. Today, I would like to show you a small script. It installs Java JDK, both version, x86 and 64 bit, silently, and wait for that process to finish. The wait is necessary because /s on a java install has the nasty habit of running in the background. If you are using a .bat file, you shouldn’t, than you would use something like: start /w jdk-setup.exe /s. This gets it done, but is ugly. Also, if you are using Packer and PowerShell provisioning, you might want to set up some environment variables as well for the next script. And you want that property to be available and you don’t want to mess it up with setting a path into a file and then re-setting your path on the begin of your other script. Or pass it around with Packer. No. Use a proper PowerShell script. Learn it. It’s not that hard. Be a professional. Don’t hack something together for the next person to suffer at. ...

June 30, 2015 · 3 min · hannibal

The Packer, The Windows, and the Vagrant box

Hello folks. Today, I would like to write about something close to my heart recently. I’ve been fiddling with Packer, Windows and Vagrant these days. Trying to get a Windows box up in running is a pain in the arse though, so I thought I share my pain with you nice folks out there. Let’s begin. ...

June 27, 2015 · 9 min · hannibal

Docker + Java + Vagrant+ GO.CD

Hello folks. Today, I would like to write about something interesting and close to me at the moment. I’m going to setup Go.cd with Docker, and I’m going to get a Ruby Lotus app running. Let’s get started. ...

June 6, 2015 · 6 min · hannibal