LoginSignup
0

More than 5 years have passed since last update.

Packer で作る<br />インフラのCI環境

Last updated at Posted at 2017-02-04
1 / 16

第25回【フリースタイル】PORTもくもく会 の資料


自己紹介

名前: sinsoku
会社: 株式会社grooves
できる: Ruby, Rails :heart:
できない: Clojure :cry:
github: sinsoku
twitter: @sinsoku_listy


jobs.png


Forkwell_Scout_001.jpg


宣伝おわり


Packer 知ってます?


Packer by HashiCorp

  • Vagrant の会社
  • json からイメージを作成できる
    • AMI
    • Docker container
    • VirtualBox

こんな感じ

packer.png


実例の紹介


Git on AWS Lambda

  • Lambda と同じ AMI でビルド
  • ビルドしたディレクトリを圧縮
  • Lambda 実行時に /tmp に解凍

template.json

  • builders
    • docker
    • amazon-ebs
  • provisioners
    • ansible
    • file(amazon-ebs)
  • post-processors
    • docker-tag(docker)

スクリプト

bin/ci.sh
#!/bin/bash
set -ev

if [[ "${TRAVIS_BRANCH}" = "master" || -n "${TRAVIS_TAG}" ]]; then
  packer build template.json
else
  packer build -only=docker template.json
fi

ブランチと実行される処理

branches.png


まとめ

  • プロビジョニングのテストが可能
  • CI できる
  • README は少ないけど OSS です
  • master へのマージは約10円
    • m3.medium($0.096/h)

ご清聴ありがとうございました

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0