0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Engine Yard Cloud の Custom Recipes を設定ファイルから作成するようにする

Posted at

概要

Engine Yard Cloudには、Chefにて、デフォルトの環境をカスタマイズする機能があります。
ただ、Berkshelfのような、Bundlerのような仕組みがありません。

元のリポジトリを追うのも、面倒です。

そこで、設定ファイルから、Cookbooksを作成し、自身のattributes(変数)を適応するためのコマンドラインツールを作っていました。

ey-berks の紹介

仕組みは、設定ファイル(EyBerksfile, TOML形式)を元に、Git repositoryから、各recipesを集めます。
その後、Attributesを適応します。

Attirubtesはすでにあるものを集めて、適応することも可能です。

コマンド一覧

$ ey-berks help
Engine Yard Cloud cookbook tool like Berkshelf

Usage:
    ey-berks config <path>                                               : make a sample configuration file (default path=$PWD, --config=EyBerks)
    ey-berks compile <path> --config=<path to EyBerks>                   : update cahce,  write a main/recipes and gather recipe to the cookbooks directory
    ey-berks update-cache                                                : update cache of remote repositories cookbooks
    ey-berks create-main-recipe <path>                                   : create main recipes from the configration file
    ey-berks copy-recipes <path>                                         : copy recipes from the cache dir to the cookbooks/ directory
    ey-berks clear <path>                                                : remove EyBerksfile and cookbooks directory
    ey-berks gather-attr <path> --from=</path/cookbooks>                 : gather attbiutes from cookbook directory
    ey-berks apply-attr <path> ---from=<attributes directory>            : apply attbiutes for cookbook directory
    ey-berks help                                                        : show this help
    ey-berks version                                                     : show the version

使い方

コンフィグファイルを生成します。

$ey-berks config .
$ls
EyBerkfile

コンフィルファイルに自分の必要な、Recipeを追加します。

[library]
repo = "engineyard/ey-cloud-recipes"
path = "cookbooks/main/libraries"
name = "main/libraries"

[definition]
repo = "engineyard/ey-cloud-recipes"
path = "cookbooks/main/definitions"
name = "main/definitions"

[[cookbook]]
repo = "engineyard/ey-cloud-recipes"
path = "cookbooks/env_vars"

[[cookbook]]
host = "bitbucket.org"
repo = "engineyard/ey-cloud-recipes"
path = "cookbooks/cutom_nginx"

[[cookbook]]
repo =  "youraccount/cookbooks"
path = "cookbooks/sidekiq"

CookBooks Directoryを作成します

$ey compile .
$ls
EyBerkfile cookbooks/

もともと、Cookbookを持っている場合は、attributesを収集します。

$ey recipes download -e your_enviornment_name
$ey-berks gather-attr . --from=/path/to/original/cookbooks
$ls
EyBerkfile cookbooks/ attr-meta/

ey-berksで作った、Cookbooksに収集してきたattirbutesを適応します。

$ ey-berks apply-attr . --from=./attr-meta

後はいつものように、cookbooksをuploadして、適応します。

$ey recipes upload -e your_environment_name
$ey recipes apply -e your_environment_name

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?