2
2

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.

AWS OpsWorks用に作った自作レシピ

Posted at

deploy_notifier

  • デプロイが終わった時にチャットルームに通知するレシピ
  • slack, hipchatの通知に対応
  • Custom Chef Recipesのdeployのところに入れて使います

dotenv

  • OpsWorksの管理画面のEnvironment Variablesで設定した値から.envを生成するレシピ
  • 手動でrakeタスク実行とかバッチ処理で別プロセスで動く都合でEnvironment Variablesの環境変数を引き継げないときなどに使えます

authorized_keys

  • OpsWorksでアプリを動かすユーザーのauthorized_keysにcustom jsonで設定された公開鍵を追加するレシピ

nginx_real_ip

  • ELBがフロントにいる場合、アクセスログがELBのipになってしまうので実際のipを表示されるようにするレシピ

  • ELBのipを指定して使います

  • 特定のipのみなどのアクセス制御する場合などに

htpasswd

  • custom jsonにアプリごとにユーザー名とパスワードを設定するとhtpasswdファイルが生成されます
  • htpasswdコマンドを使かわない実装になってるのでapacheをインストールしなくても使えます

nginx + unicornの構成で使う場合

OpsWorksの標準のunicornのレシピをカスタマイズするといいです。

unicorn/templates/default/nginx_unicorn_web_app.erb

location / {
  <% if @application[:nginx][:basic_auth] -%>
    auth_basic "<%= @application[:domains].first %>";
    auth_basic_user_file "<%= "/etc/nginx/htpasswd.d/#{@application[:application]}" %>";
  <% end -%>
}
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?