首页 > 代码库 > Ubuntu 12.04.4 LTS 部署cap 二

Ubuntu 12.04.4 LTS 部署cap 二

创建gemset

apps@mode:~$ rvm gemset list


gemsets for ruby-1.9.3-p547 (found in /home/apps/.rvm/gems/ruby-1.9.3-p547)

=> (default)

   global


apps@mode:~$ rvm gemset create xmnewcrm

ruby-1.9.3-p547 - #gemset created /home/apps/.rvm/gems/ruby-1.9.3-p547@xmnewcrm

ruby-1.9.3-p547 - #generating xmnewcrm wrappers........

apps@mode:~$ rvm gemset list


gemsets for ruby-1.9.3-p547 (found in /home/apps/.rvm/gems/ruby-1.9.3-p547)

=> (default)

   global

   xmnewcrm


apps@mode:~$ ruby -v

ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]


部署

deploy@mode:~/xmnewcrm$ cap production deploy



在被部署的节点服务器上

apps@mode:~$ ll /app/rails/xmnewcrm.xiaoma.com/shared/ 

total 16

drwxrwxr-x 4 apps apps 4096 Aug 29 13:26 ./

drwxr-xr-x 5 apps apps 4096 Aug 29 13:21 ../

drwxrwxr-x 2 apps apps 4096 Aug 29 13:29 bin/

drwxrwxr-x 3 apps apps 4096 Aug 29 13:24 bundle/

apps@mode:~$ mkdir /app/rails/xmnewcrm.xiaoma.com/shared/config

apps@mode:~$ mkdir /app/rails/xmnewcrm.xiaoma.com/shared/tmp   

apps@mode:~$ mkdir /app/rails/xmnewcrm.xiaoma.com/shared/log

apps@mode:~$ mkdir /app/rails/xmnewcrm.xiaoma.com/shared/public

apps@mode:~$ vim /app/rails/xmnewcrm.xiaoma.com/shared/config/database.yml


# SQLite version 3.x

#   gem install sqlite3

#

#   Ensure the SQLite 3 gem is defined in your Gemfile

#   gem ‘sqlite3‘

development:

  adapter: mysql

  database: xmnewcrm

  username: root

  password: ergal1234

  encoding: utf8

  #pool: 5

  #timeout: 5000


# Warning: The database defined as "test" will be erased and

# re-generated from your development database when you run "rake".

# Do not set this db to the same as development or production.

test:

  adapter: sqlite3

  database: db/test.sqlite3

  pool: 5

  timeout: 5000


production:

  adapter: mysql2

  database: xmnewcrm

  username: root

  password: ergal1234

  encoding: utf8


staging:

  adapter: mysql2

  encoding: utf8

  database: xmnewcrm

  pool: 5

  host: localhost

  username: root

  password: ergal1234






创建项目的数据库

jim@mode:~$ mysql -uroot -pergal1234      

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 36

Server version: 5.5.35-0ubuntu0.12.04.2 (Ubuntu)


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> create database xmnewcrm;           

Query OK, 1 row affected (0.01 sec)



部署

deploy@mode:~/xmnewcrm$ cap production deploy


启动

deploy@mode:~/xmnewcrm$ cap production deploy:start




 cap staging deploy

  218  cap staging deploy:start_ps

  219  cap staging deploy:stop_ps



  220  cap production deploy:start








11  mkdir /app/rails/xmnewcrm.xiaoma.com/

   12  ruby -v

   13  rvm -v

   14  ll .ssh/

   15  cat .ssh/id_dsa.pub 

   16  ssh vincent@211.157.136.58

   17  ruby -v

   18  rvm -v

   19  ll .ssh/

   20  ll

   21  \curl -sSL https://get.rvm.io | bash -s stable

   22  ll

   23  rvm -v

   24  ruby -v

   25  rvm install 1.9.3

   26  source /home/apps/.rvm/scripts/rvm 

   27  ruby -v

   28  rvm -v

   29  rvm install 1.9.3

   30  echo $?

   31  ssh vincent@211.157.136.58

   32  ll

   33  ls

   34  id apps 

   35  git clone git@git.xiaoma.com:xmnewcrm

   36  cat .ssh/id_dsa.pub 

   37  git clone git@git.xiaoma.com:xmnewcrm

   38  ll

   39  rvm gemset list

   40  rvm gemset create xmnewcrm

   41  rvm gemset list

   42  ruby -v

   43  mysql -uroot -pergal1234

   44  lsof -i:3306

   45  ll /app/rails/xmnewcrm.xiaoma.com/

   46  ll /app/rails/xmnewcrm.xiaoma.com/shared/

   47  mkdir /app/rails/xmnewcrm.xiaoma.com/shared/config

   48* 

   49  vim /app/rails/xmnewcrm.xiaoma.com/shared/config/database.yml

   50  ll /app/rails/xmnewcrm.xiaoma.com/shared/

   51  ll /app/rails/xmnewcrm.xiaoma.com/shared/config/

   52  ll /app/rails/xmnewcrm.xiaoma.com/shared

   53  ps aux|grep un

   54  ll /app/rails/xmnewcrm.xiaoma.com/shared

   55  mkdir /app/rails/xmnewcrm.xiaoma.com/shared/

   56  ll /app/rails/xmnewcrm.xiaoma.com/shared

   57  mkdir /app/rails/xmnewcrm.xiaoma.com/shared/log

   58  mkdir /app/rails/xmnewcrm.xiaoma.com/shared/public

   59  ll /app/rails/xmnewcrm.xiaoma.com/shared

   60  ll /app/rails/xmnewcrm.xiaoma.com/shared/log/

   61  ll /app/rails/xmnewcrm.xiaoma.com/shared/public/

   62  ll /app/rails/xmnewcrm.xiaoma.com/shared/log/

   63  ll /app/rails/xmnewcrm.xiaoma.com/shared

   64  ll /app/rails/xmnewcrm.xiaoma.com

   65  ll

   66  ls

   67  rails s -p 8000

   68  ls 

   69  ll 

   70  cd /app/rails/xmnewcrm.xiaoma.com/

   71  rails s -p 8000

   72  ruby -v

   73  rails -v

   74  gemlist

   75  rails c

   76  rails

   77  cd /app/rails/xmnewcrm.xiaoma.com/

   78  ll

   79  cd shared/

   80  ll

   81  ll public/

   82  ll log/

   83  ll public/

   84  cd ~

   85* ll /app/rails/xmnewcrm.xiaoma.com/shared/tmp/unicorn.sock 

   86  history 


本文出自 “8055082” 博客,谢绝转载!

Ubuntu 12.04.4 LTS 部署cap 二