forked from rockstor/rockstor-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildout.cfg
173 lines (156 loc) · 6.64 KB
/
buildout.cfg
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
# This file is part of RockStor.
#
# RockStor is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# RockStor is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[buildout]
extends = base-buildout.cfg
parts =
stop-rockstor
rpm-deps
rpm-deps-nut
rpm-deps-ad
delete-prod-rpm
django
scripts
postgres-setup
postgres-conf
gunicorn
nginx-conf
django-settings-conf
mime-types
init-gunicorn
extra-stuff
js-clean
js-libraries
js-sync
collectstatic
supervisor
supervisord-conf
db-migrate
create-cert
docker-conf
docker
rockstor-pre-systemd-conf
rockstor-systemd-conf
bootstrap-systemd-conf
def-kernel
start-rockstor
[rpm-deps-ad]
recipe = plone.recipe.command
stop-on-error = true
command =
${rpm-deps:install_cmd} realmd sssd oddjob oddjob-mkhomedir adcli \
samba-common
[nginx-conf]
recipe = collective.recipe.template
input = ${buildout:directory}/conf/nginx.conf.in
output = ${buildout:directory}/etc/nginx/nginx.conf
[stop-rockstor]
recipe = plone.recipe.command
command = systemctl stop rockstor
update-command = ${stop-rockstor:command}
[start-rockstor]
recipe = plone.recipe.command
command = cp -f ${buildout:directory}/conf/rockstor-pre.service /etc/systemd/system/rockstor-pre.service &&
systemctl enable rockstor-pre.service &&
systemctl daemon-reload &&
systemctl start rockstor
update-command = ${start-rockstor:command}
[init-gunicorn]
logfile = ${buildout:directory}/var/log/gunicorn.log
input = ${buildout:directory}/conf/gunicorn.in
output = ${buildout:directory}/etc/init.d/gunicorn
[supervisord-conf]
logdir = ${buildout:directory}/var/log
gunicorn_cmd = ${buildout:directory}/bin/gunicorn --bind=${init-gunicorn:bind}:${init-gunicorn:port} --pid=${init-gunicorn:pidfile} --workers=${init-gunicorn:workers} --log-file=${init-gunicorn:logfile} --pythonpath=${buildout:directory}/src/rockstor --settings=settings --timeout=120 --graceful-timeout=120 wsgi:application
smart_manager_cmd = ${buildout:directory}/bin/sm
replicad_cmd = ${buildout:directory}/bin/replicad
dc_cmd = ${buildout:directory}/bin/data-collector
sm_cmd = ${buildout:directory}/bin/service-monitor
jd_cmd = ${buildout:directory}/bin/job-dispatcher
ztask_cmd = ${buildout:directory}/bin/django ztaskd --noreload -l DEBUG -f ${supervisord-conf:logdir}/ztask.log
[django-settings-conf]
rootdir = ${buildout:directory}/src/rockstor
datastore = ${django-settings-conf:rootdir}/storageadmin/datastore
smartdb = ${django-settings-conf:rootdir}/smart_manager/smartdb
pgdata_dir = /var/lib/pgsql/data
static_dir = ${django-settings-conf:rootdir}/storageadmin/static/storageadmin
template_dir1 = ${django-settings-conf:rootdir}/storageadmin/templates/storageadmin
template_dir2 = ${django-settings-conf:rootdir}/templates/admin
smb_conf = ${buildout:directory}/conf/smb.conf
logfile = ${buildout:directory}/var/log/rockstor.log
taplib = ${django-settings-conf:rootdir}/smart_manager/taplib
output = ${django-settings-conf:rootdir}/settings.py
debug = True
kernel = '4.2.2-1.el7.elrepo.x86_64'
[postgres-setup]
recipe = plone.recipe.command
command = if [[ ! -d ${django-settings-conf:pgdata_dir} ]]; then
echo "postgres not setup";
systemctl enable postgresql;
postgresql-setup initdb;
systemctl restart postgresql;
su - postgres -c "createdb smartdb";
su - postgres -c "createdb storageadmin";
sudo -u postgres psql -c "CREATE ROLE rocky WITH SUPERUSER LOGIN PASSWORD 'rocky'";
sudo -u postgres psql storageadmin < ${buildout:directory}/conf/storageadmin.sql.in;
sudo -u postgres psql smartdb < ${buildout:directory}/conf/smartdb.sql.in;
sudo -u postgres psql storageadmin -c "select setval('south_migrationhistory_id_seq', (select max(id) from south_migrationhistory))";
sudo -u postgres psql smartdb -c "select setval('south_migrationhistory_id_seq', (select max(id) from south_migrationhistory))";
fi
update-command = ${postgres-setup:command}
[postgres-conf]
recipe = plone.recipe.command
command = su - postgres -c "cp -f ${buildout:directory}/conf/postgresql.conf /var/lib/pgsql/data/";
su - postgres -c "cp -f ${buildout:directory}/conf/pg_hba.conf /var/lib/pgsql/data/";
systemctl restart postgresql;
update-command = ${postgres-conf:command}
[create-cert]
recipe = plone.recipe.command
cert_loc = ${buildout:directory}/certs
command = if [[ ! -d ${create-cert:cert_loc} ]]; then
mkdir ${create-cert:cert_loc};
openssl req -nodes -newkey rsa:2048 -keyout ${create-cert:cert_loc}/first.key -out ${create-cert:cert_loc}/rockstor.csr -subj "/C=US/ST=Rockstor user's state/L=Rockstor user's city/O=Rockstor user/OU=Rockstor dept/CN=rockstor.user" &&
openssl rsa -in ${create-cert:cert_loc}/first.key -out ${create-cert:cert_loc}/rockstor.key &&
openssl x509 -in ${create-cert:cert_loc}/rockstor.csr -out ${create-cert:cert_loc}/rockstor.cert -req -signkey ${create-cert:cert_loc}/rockstor.key -days 3650
fi
update-command = ${create-cert:command}
[def-kernel]
recipe = plone.recipe.command
command = grubby --set-default=/boot/vmlinuz-${django-settings-conf:kernel}
update-command = ${def-kernel:command}
[docker]
recipe = plone.recipe.command
binary = ${buildout:directory}/bin/docker
command = if [[ ! -f /usr/bin/docker ]]; then
curl -o ${docker:binary} https://get.docker.com/builds/Linux/x86_64/docker-latest &&
mv ${docker:binary} /usr/bin/docker &&
chmod +x /usr/bin/docker
fi
update-command = ${docker:command}
[fixtures]
recipe = plone.recipe.command
command = export DJANGO_SETTINGS_MODULE=settings &&
${buildout:directory}/bin/django dumpdata --exclude contenttypes --exclude auth.Permission --natural --indent 4 > ${buildout:directory}/src/rockstor/storageadmin/fixtures/newfixture.json
update-command = ${fixtures:command}
[delete-prod-rpm]
recipe = plone.recipe.command
command = if [[ -d /opt/rockstor ]]; then
systemctl stop rockstor;
systemctl disable rockstor;
rm -rf /var/lib/pgsql/data;
sudo /usr/bin/yum remove -y rockstor;
rm -rf /opt/rockstor
fi
update-command = ${delete-prod-rpm:command}