-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
142 lines (96 loc) · 3.52 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
= capsample
My voyage of discovery with Phusion Passenger, Enterprise Ruby, Git and
Capistrano.
These notes started as a literal record of the steps I was taking, but have
evolved into the steps I'd have to take to get the current capsample project.
My deployment server is a Debian Lenny vmware instance called lenny.vmware
(also known as beta.lenny.vmware).
== On lenny.vmware
aptitude install apache2 git-core
Installed Phusion Passenger and Enterprise Ruby into /opt/.
ln -s /opt/ruby-enterprise-*/bin/rake /usr/local/bin/.
ln -s /opt/ruby-enterprise-*/bin/ruby /usr/local/bin/.
Added /etc/hosts entry:
127.0.1.1 lenny.vmware beta.lenny.vmware
Activated these virtual hosts in apache2:
<VirtualHost *:80>
ServerName lenny.vmware
DocumentRoot /var/www/apps/capsample/current/public
RailsEnv production
</VirtualHost>
<VirtualHost *:80>
ServerName beta.lenny.vmware
DocumentRoot /var/www/apps/capsample-beta/current/public
RailsEnv development
</VirtualHost>
Created capsample and capsample-beta directories in /var/www/apps/.
Created local user sheldonh.
Made sheldonh the owner of the capsample and capsample-beta directories.
== On my workstation
Created a repository called capsample at github.com.
ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]
Add /etc/hosts entry for lenny:
172.16.103.97 lenny.vmware beta.lenny.vmware
rails capsample
cd capsample
cat >.gitignore <<EOF
db/*.sqlite3
doc/api
doc/app
log/*.log
public/cache/**/*
tmp/**/*
EOF
rake db:schema:dump
script/generate scaffold sample
cp public/stylesheets/scaffold.css .
script/destroy scaffold sample
mkdir -p public/stylesheets
mv scaffold.css public/stylesheets/
The schema dump creates a placeholder schema.rb in the db directory, and the
db directory itself, making sqlite3 easier to deal. Together with slapping
in a copy of the scaffold stylesheet, we work around having to create
directories explicitly in after_setup and before_finalize_update (empty dirs
aren't tracked by git).
capify .
edit config/deploy.rb
mkdir config/deployments
edit config/deployments/beta.rb
edit config/deployments/production.rb
cat > script/spin <<EOF
#!/bin/true
Capsample currently assumes that a Phusion Passenger virtual host is already
configured with a DocumentRoot like /var/www/apps/capsample/current/public.
EOF
chmod +x script/spin
git init
git add .
git commit -m "Initial import."
git remote add origin [email protected]:sheldonh/capsample.git
git push origin master
cap deploy:setup
Looked okay except for "zlib(finalizer): the stream was freed
prematurely." at the end, which I ignored.
cap deploy:check
cap deploy:update
cap deploy:migrate
cap deploy
Browsed to http://lenny.vmware/ and got the "Welcome aboard" page.
Note that the rails "Welcome aboard" page's "About your application's
environment" link only works with RAILS_ENV=development, which I hadn't yet
gotten working at this point.
git checkout -b edge
git remote add origin/edge [email protected]:sheldonh/capsample.git
git push origin/edge edge
cap -S deployment=beta deploy:setup
Browsed to http://beta.lenny.vmware/ and got the "Welcome aboard" page.
Because the beta sites runs in development mode, the "About your application's
environment" link works here.
Now I can deploy edge to the beta site with
cap -S deployment=beta deploy
and master to the production site with
cap -S deployment=production deploy
== To do
Handle database.yml, which should be created in a persistent location on
the server and then copied into the current release at deploy:update time.
Test with mysql and postgresql.