Skip to content

Instantly share code, notes, and snippets.

View daisuke-morita's full-sized avatar

Daisuke Morita daisuke-morita

View GitHub Profile
@daisuke-morita
daisuke-morita / deploy.rb
Created February 7, 2016 04:55
Capistranoデプロイタスク
require 'aws-sdk'
lock '3.4.0'
set :application, 'example_app'
set :pty, true
set :user, "ubuntu"
set :use_sudo, true
set :ssh_key, "~/.ssh/example_app.pem"
@daisuke-morita
daisuke-morita / main.yml
Created February 7, 2016 07:10
Phoenixアプリサーバーのプロビジョニング - ansible/roles/app/tasks/main.yml
---
- name: Download package
command: aws s3 cp "{{ package_url }}" /tmp/app.tar.gz
environment:
AWS_ACCESS_KEY_ID: "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
AWS_SECRET_ACCESS_KEY: "{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
- name: Make app directory
file: state=directory path={{ item }}
with_items:
@daisuke-morita
daisuke-morita / example_app.conf
Created February 7, 2016 12:29
Phoenixアプリ用のUpstart設定
description "Example App"
setuid ubuntu
setgid ubuntu
start on runlevel [2345]
stop on runlevel [016]
expect stop
respawn
@daisuke-morita
daisuke-morita / upgrade.sh
Created February 11, 2016 05:22
upgrade.sh - デプロイ処理の実際
#!/bin/bash
export AWS_DEFAULT_REGION="ap-northeast-1"
APP="example_app"
APP_HOME="/opt/${APP}"
DEPLOY_TO="${APP_HOME}/releases"
S3_FOLDER="s3://example-app-packages"
# Get the specified or latest version number
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Hello Cotoami!</title>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">