Skip to content

FIDATA/infrastructure

Repository files navigation

FIDATA Infrastructure

This repository contains:

  • Scripts to build immutable servers with Packer & Vagrant & Chef

    • Kernel images - clean installs without any provisioners
    • Base images
    • Jenkins master
    • Jenkins slaves

    Targets:

    • Vagrant boxes for VirtualBox - testing environment
    • Amazon AMIs - production environment
  • Scripts to deploy infrastructure with Terraform

Prerequisites:

  • Java (JRE or JDK) >= 8
  • VirtualBox (5.1.26)
  • Packer
  • Vagrant and vagrant-cachier plugin
  • Terraform (~> 0.10)
  • Ruby & Bundler (~> 1.14, tested with 1.15.4)
  • Python 3 & Pipenv

Before start you have to install required gems, packages, plugins and cookbooks:

./gradlew prerequisitesInstall

When necessary you can check locked versions for updates with:

./gradlew prerequisitesOutdated

and update them with:

./gradlew prerequisitesUpdate

NOTE: Update of gems with exact version constraint (e.g. Chef) is not supported now (see #67). When you change their versions you have to update them manually with:

bundle update chef

Workflow:

  1. Clean and build kernel VirtualBox images

    ./gradlew clean-kernel-*-vbox
    ./gradlew build-kernel-*-vbox
    

    There is a separate task for each image

  2. Deploy common Terraform resources, build base VirtualBox images & Vagrant boxes

    ./gradlew build-base
    
  3. Test build toolkit used for Jenkins slaves:

    ./gradlew kitchenTest-BuildToolkit
    
  4. Build Jenkins slave AMIs:

    ./gradlew build-JenkinsSlaves
    
  5. Test Jenkins Master:

    ./gradlew kitchenTest-JenkinsMaster-vbox
    ./gradlew kitchenTest-JenkinsMaster-amazon
    
  6. Build JenkinsMaster production AMI:

    ./gradlew build-JenkinsMaster
    
  7. Deploy instances:

    ./gradlew deploy
    

Making changes:

Check code before pushing:

gradlew --continue check

Packer, Vagrant & Chef scripts are based on:

  1. Bento

  2. Boxcutter

  3. joefitzgerald/packer-windows

  4. innvent/parcelles

Credits (Additional reading)

  1. Immutable Servers:
  2. Alvaro Miranda Aguilera: Idea about separate minimal (kernel) image
  3. MistiC: Nested Berksfiles
  4. StephenKing: Method to install Jenkins plugins
  5. tknerr: Vagrantfile to enable vagrant-cachier

Copyright © 2015-2017 Basil Peace

This is part of FIDATA Infrastructure.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.