This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passenger.rb
63 lines (57 loc) · 2.73 KB
/
passenger.rb
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
#generating a self signed key
#openssl genrsa -des3 -out server.key 1024
#openssl req -new -key server.key -out server.csr
#openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
#cp server.key server.key.secure
#openssl rsa -in server.key.secure -out server.key
#openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
#create the databases manually rather than through rake db:create:all (because it doesn't work)
#sudo -u postgres psql -U postgres -c "alter user torsion with password 'torsion' createdb;"
#sudo -u postgres psql template1 -c "alter role torsion with superuser"
#sudo -u postgres psql -U postgres -c "create database torsion;"
#sudo -u postgres psql -U postgres -c "create database torsion_development;"
#sudo -u postgres psql -U postgres -c "create database torsion_test;"
#sudo -u postgres psql -U postgres -c "grant all privileges on database torsion to torsion;"
#sudo -u postgres psql -U postgres -c "grant all privileges on database torsion_development to torsion;"
#sudo -u postgres psql -U postgres -c "grant all privileges on database torsion_test to torsion;"
#to list databases you've created
#sudo -u postgres psql -U postgres -c "\l"
dep 'install_nginx_passenger.aptget' do
requires 'add_passenger_brightbox_repo'
met?{ aptget('-y install nginx-brightbox') =~ /.*is already the newest version.*/ }
meet{ aptget('-y install nginx-brightbox') }
after {
log('Edit your Nginx configuration file')
log('http {')
log(' ...')
log(' passenger_root /home/ubuntu/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7;')
log(' passenger_ruby /home/ubuntu/.rvm/wrappers/ree-1.8.7-2011.03/ruby;')
log(' ...')
log('}')
log(' server {')
log(' listen 80;')
log(' server_name heroku.impactdata.com.au;')
log(' root /home/ubuntu/Squawkbox/public;')
log(' passenger_enabled on;')
}
end
dep 'add_passenger_brightbox_repo' do
met?{
shell("cat /etc/apt/sources.list.d/brightbox.list") =~ /.*apt.brightbox.net.lucid.main.*/
}
meet{
if shell("echo $HOME") =~ /.*root.*/
shell("wget -q -o release http://apt.brightbox.net/release.asc")
shell("apt-key add release")
shell("rm release")
shell('echo "deb http://apt.brightbox.net lucid main" | sudo tee --append /etc/apt/sources.list.d/brightbox.list')
shell('apt-get update')
else
sudo("wget -q -o release http://apt.brightbox.net/release.asc")
sudo("apt-key add release")
sudo("rm release")
sudo('echo "deb http://apt.brightbox.net lucid main" | sudo tee --append /etc/apt/sources.list.d/brightbox.list')
sudo('apt-get update')
end
}
end