Skip to content

Commit 22b30f9

Browse files
committed
chef recipe to deploy the app
1 parent a0566e6 commit 22b30f9

5 files changed

Lines changed: 126 additions & 1 deletion

File tree

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.exe binary
2-
*.dll binary
2+
*.dll binary
3+
binaries/om/openMalaria binary

binaries/om/readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
OpenMalaria v32
2+
Works on RedHat 7/CentOS 7 (with gsl and xerces-c packages are dependencies)
3+
14
This build was built with build-maia-release.sh
25
* from user vagrant
36
* at 2015-12-16

chef/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Chef recipe to install OpenMalaria Portal
2+
3+
Usage:
4+
sudo chef-client --local-mode chef.rb

chef/chef.rb

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package 'gsl'
2+
package 'xerces-c'
3+
package 'httpd'
4+
package 'mod_wsgi'
5+
package 'python-pip'
6+
package 'git'
7+
package 'vim'
8+
9+
bash 'postgresql respository' do
10+
code <<-EOH
11+
yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
12+
EOH
13+
not_if {::File.exist?('/etc/yum.repos.d/pgdg-96-redhat.repo')}
14+
end
15+
16+
package 'postgresql96-server'
17+
package 'postgresql96-devel'
18+
19+
20+
bash 'postgresql initdb' do
21+
code <<-EOH
22+
/usr/pgsql-9.6/bin/postgresql96-setup initdb
23+
EOH
24+
not_if {::File.exist?('/var/lib/pgsql/9.6/data/')}
25+
end
26+
27+
service 'postgresql-9.6' do
28+
action [:enable, :start]
29+
end
30+
31+
bash 'postgresql create user' do
32+
code <<-EOH
33+
sudo -u postgres sh -c 'createdb om'
34+
sudo -u postgres psql -c "CREATE USER om WITH PASSWORD 'om'"
35+
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"om\" to om;"
36+
EOH
37+
ignore_failure true
38+
end
39+
40+
file '/var/lib/pgsql/9.6/data/pg_hba.conf' do
41+
owner 'postgres'
42+
group 'postgres'
43+
mode '600'
44+
content <<-EOH
45+
local all all ident
46+
host all all all md5
47+
EOH
48+
end
49+
50+
directory 'opt/portal/aws.vecnet.org' do
51+
owner 'root'
52+
group 'apache'
53+
recursive true
54+
end
55+
56+
git '/opt/portal/aws.vecnet.org' do
57+
group 'apache'
58+
repository 'https://github.com/vecnet/om'
59+
action :sync
60+
end
61+
62+
file '/opt/portal/aws.vecnet.org/config_local.py' do
63+
group 'apache'
64+
mode '640'
65+
content <<-EOH
66+
import os
67+
68+
settings_module="website.settings.aws"
69+
70+
os.environ["SECRET_KEY"] = "lkl39#;l=01,<ML;lodfsd;lkOP(aa;dsf90adfsadfksldfjp90sdflsklilsdfslklkj"
71+
os.environ["DATABASE_NAME"] = "om"
72+
os.environ["DATABASE_USER"] = "om"
73+
os.environ["DATABASE_PASSWORD"] = "om"
74+
EOH
75+
end
76+
77+
file '/opt/portal/aws.vecnet.org/django.log' do
78+
group 'apache'
79+
mode '660'
80+
end
81+
82+
bash 'Install python packages' do
83+
code 'pip install -r /opt/portal/aws.vecnet.org/requirements/aws.txt'
84+
end
85+
86+
service 'httpd' do
87+
action [:enable, :start]
88+
end

install_centos.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# http://stackoverflow.com/questions/18215973/how-to-check-if-running-as-root-in-a-bash-script
4+
# EUID Expands to the effective user ID of the current user, initialized at shell startup.
5+
# This variable is readonly.
6+
if [ "${EUID}" -ne 0 ]
7+
then echo "Please run as root"
8+
exit
9+
fi
10+
11+
yum install xerces-c gsl git nginx python-pip python-devel
12+
# Repository for PostgreSQL 9.6
13+
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
14+
yum install postgresql96-devel postgresql96
15+
/usr/pgsql-9.6/bin/postgresql96-setup initdb
16+
17+
sudo cp /var/lib/pgsql/9.6/data/pg_hba.conf /var/lib/pgsql/9.6/data/pg_hba.conf.bak
18+
sudo sh -c 'echo "local all all ident" > /var/lib/pgsql/9.6/data/pg_hba.conf'
19+
sudo sh -c 'echo "host all all all md5">> /var/lib/pgsql/9.6/data/pg_hba.conf'
20+
21+
systemctl enable postgresql-9.6
22+
systemctl start postgresql-9.6
23+
24+
sudo systemctl start postgresql
25+
sudo -u postgres sh -c 'createdb om'
26+
sudo -u postgres psql -c "CREATE USER om WITH PASSWORD 'om'"
27+
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"om\" to om;"
28+
sudo systemctl restart postgresql-9.6
29+

0 commit comments

Comments
 (0)