Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

higanworks/sakurraform-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo sakurraform and knife-zero with dozens, fluentd

Setup

Sakurraform

$ bundle install --path vendor/bundle --binstubs


$ ./bin/sakurraform 
Commands:
  sakurraform bs SUBCOMMAND    # Manage Sakura no Base Storage
  sakurraform help [COMMAND]   # Describe available commands or one specific command
  sakurraform init             # initiaize .sakuracloud/credentials
  sakurraform map              # open sakura cloud map!
  sakurraform plan SUBCOMMAND  # Manage plan
  sakurraform status           # show status [--sync](to update cached_state)
  sakurraform version          # show version

Knife-Zero

$ cd chef_repo
$ bundle install --path vendor/bundle --binstubs


$ ./bin/knife zero
FATAL: Cannot find sub command for: 'zero'
Available zero subcommands: (for details, knife SUB-COMMAND --help)

** ZERO COMMANDS **
knife zero bootstrap FQDN (options)
knife zero chef_client QUERY (options)

Rake tasks(chef_repo)

$ cd chef_repo

$ ./bin/rake -vT
rake add_hostname    # add hosts to dozens
rake bootstrap       # bootstrap servers with knife-zero
rake data_bag        # convert credentials to data_bag
rake default         # show server_states for debug
rake flush_hostname  # clear all hosts on dozens (Caution! All record of domain will be deleted.)

Steps.

このデモのプランはこんな構成になります。

  • network1
    • server1 (fluent-fowarder)
    • server2 (fluent-aggregater)
  • network2
    • server3 (fluent-fowarder)
    • server4 (fluent-aggregater)

※ さくらのクラウド APIキー、BASE STORAGEのAPIキーが必要です。

プロジェクトルートで。インフラを作ります。

  1. ./bin/sakurraform initcredencialsを作る
  2. ./env.sh.sample を元にenv.shを作成、ssh鍵のIDを登録し、sourceで読んでおく。
  3. ./bin/sakurraform plan apply でインフラ作成
  4. ./bin/sakurraform status --sync でリモート状態をローカルキャッシュと同期
    • 割り当てたIPアドレスなど

plan applyではAPIが結構落ちます(503)が、もう一度実行すれば続きからリソースを作成します。

chef_repoディレクトリで。サーバの構成をします。

事前にSSH-Agentにログイン用の秘密鍵を登録しておきましょう。

※ Dozens連携を試したければホストの登録が何もないドメインを用意。

  1. (※option)./env.sh.sample を元にenv.shを作成、DOZENS_ID、sourceで読んでおく。
  2. rake data_bag でBase Storageの情報入りData_Bagを作成
  3. rake bootstrapでfluent準備OK
  4. (※option)rake add_hostnameでDozensにAレコードを作成します

fluent=> Base Storageを確認

  1. chef_repoディレクトリでデータ投入
    1. echo '{"hoge" : "piyo"}' | ./bin/fluent-cat -h {IPまたはホスト名} stdin.test でfluent-fowarderにデータ送信。
  2. 60秒くらい待機
  3. プロジェクトルートでデータを表示
    1. ./bin/sakurraform bs lsでオブジェクト一覧を確認。
    2. ./bin/sakurraform bs cat {キー名}で中身を確認。
    3. ./bin/sakurraform bs delete {キー名}でオブジェクトを削除。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages