Giter VIP home page Giter VIP logo

companieshouse.smartpan-ami's Introduction

smartpan-ami

This project is comprised of a collection of Packer templates and Ansible playbooks which are used in combination to build Amazon Machine Images (AMIs) for a SmartPAN deployment. It is intended to be run inside of a Docker container as part of a CI pipeline (see infrastructure-packer-runner for a suitable container).

Prerequisites

Project hierarchy

The following filesystem structure is used in this project:

ansible/
  ├── ...               - Ansible inventory, roles , templates and playbooks
packer/
  ├── vars/             - Packer variable files
  |     └── smartpan    - Variables specific to the 'smartpan' instance
  ├── web.json          - Packer template for building a SmartPAN instance AMI
  └─ ...

Building AMIs

⚠️ The recommended way of building AMIs when using this project is to configure a Concourse CI pipeline and run the Packer build process within a Docker container for which there is a purpose-built 'packer' task in ci-concourse-resources.

When building AMIs this way, specify the Packer template and variable file to use as part of the build task using the PACKER_FLAGS and PACKER_TEMPLATE_FILE environment variables respecitely. For full details of the environment variables available refer to the ci-concourse-resources README file for the task (i.e. tasks/ami/packer/README.md).

For example:

  - task: build-ami
    file: concourse-resources/tasks/ami/packer/task.yml
    params:
      ANSIBLE_ROOT: ansible
      PACKER_FLAGS: -var-file=packer/vars/smartpan
      PACKER_TEMPLATE_FILE: packer/smartpan.json

It is also possible to build AMIs manually if needed, and this process is described in more detail below.

Building SmartPAN instance AMIs manually

To manually build a SmartPAN AMI use the AWS command line interface to establish a login to Elastic Container Registry (ECR):

$ eval (aws ecr --no-include-email get-login)
Login Succeeded

Once successfully logged in, launch a Packer build container with a mount point to this repository (replace <local-path-to-this-repo> with the path to the local directory containing this git repository):

$ cd <local-path-to-this-repo>
$ docker run --rm -v $(pwd):/source-code -it 123456789012.dkr.ecr.eu-west-1.amazonaws.com/packer-runner /bin/bash

This should spawn a container shell with a mount point at /source-code containing this repository.

Finally, change directory and export a suitable version number while running the packer command and providing the path to both the variable file and Packer template for the desired instance:

$ cd /source-code
$ VERSION=1.0.0 packer build -var-file=packer/vars/smartpan templates/smartpan.json

companieshouse.smartpan-ami's People

Contributors

marcransome avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.