Skip to content

Instantly share code, notes, and snippets.

@hechien
Forked from xdite/Deploy Guide.md
Created April 8, 2013 01:54
Show Gist options
  • Save hechien/5333621 to your computer and use it in GitHub Desktop.
Save hechien/5333621 to your computer and use it in GitHub Desktop.

開 Project 流程

使用 Bootstrappers 產生 project

bootstrappers demo
cd demo
git init
git add .
git commit -m "init project" 

上 Github 開 project repo

https://github.com/new,選 rocodev / demo

在 Github 掛上 team

team 加上

  • rocodev/deploy-team
  • rocodev/tech

在 Github 掛上 Hipchat

Token: TOKEN
Room : ROOM 

上 airbrake 開 project

  • http://rocodev.airbrake.io 上開專案
  • 在專案中 `rails g airbrake --api-key XXXX"
  • 掛上 hipchat 的 token 與 chatroom,如以上資訊。

Project 掛上 hipchat

修改 config/config.yml 裡下的設定

  hipchat_token: TOKEN
  hipchat_room_name: "ROOM

Deploy 到主機

  • 修改 config/deploy.rb 下的資訊
  • cap deploy:setup
  • 到主機上的 shard/ 下新增目錄 config/,再新增 config/database.yml.production
production: &default
  adapter: mysql2
  encoding: utf8
  database: demo_production
  host: localhost
  username: root
  password: 'abc123'

  • cap deploy
  • 到主機上的 current 下,RAILS_ENV="production" rake db:create
  • 到主機上的 current 下,RAILS_ENV="production" rake db:migrate
  • cap deploy

設定 Domain 與 virtual host

  • vim /opt/nginx/nginx.conf
    server {
      listen 80;
      server_name demo.rocodev.net;
      root /home/apps/demo/current/public;
      passenger_enabled on;
    }
  • sudo /etc/init.d/nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment