blob: 0eaf919c99fa8a281316a2df904fc31166410aff [file] [log] [blame]
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05001Summary: OpenCloud core services
Scott Baker709bb592015-02-03 15:54:34 -08002Name: xos
Scott Bakere8cb93b2015-02-11 22:13:49 -08003Version: 1.2.0
Scott Baker709bb592015-02-03 15:54:34 -08004Release: 1
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05005License: GPL+
6Group: Development/Tools
7Source0: %{_tmppath}/%{name}-%{version}.tar.gz
8BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
9requires: postgresql
10requires: postgresql-server
11requires: python-psycopg2
12requires: graphviz
13requires: graphviz-devel
14requires: graphviz-python
15requires: libxslt-devel
16requires: python-pip
17requires: tar
18requires: gcc
Scott Baker524acdb2014-03-19 23:45:49 -070019requires: python-httplib2
Scott Baker09c7af42014-04-14 11:00:25 -070020requires: GeoIP
Sapan Bhatia897d92c2014-10-06 16:59:26 -040021requires: wget
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050022
23%description
24%{summary}
25
26%prep
27%setup -q
28
29%build
30# Empty section.
31
32%pre
Scott Bakerbaf62562014-09-17 22:19:54 -070033pip-python install django==1.7
Scott Baker6b50cb22014-12-22 08:28:55 -080034pip-python install djangorestframework==2.4.4
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050035pip-python install markdown # Markdown support for the browseable API.
36pip-python install pyyaml # YAML content-type support.
37pip-python install django-filter # Filtering support
38pip-python install lxml # XML manipulation library
39pip-python install netaddr # IP Addr library
40pip-python install pytz
41pip-python install django-timezones
42pip-python install requests
43pip-python install django-crispy-forms
44pip-python install django-geoposition
45pip-python install django-extensions
46pip-python install django-suit
47pip-python install django-evolution
Scott Baker524acdb2014-03-19 23:45:49 -070048pip-python install django-bitfield
Scott Baker09c7af42014-04-14 11:00:25 -070049pip-python install django-ipware
Sapan Bhatia1080a282014-09-08 11:00:29 -040050pip-python install django-encrypted-fields
Scott Bakera1f72802014-09-11 00:25:49 -070051pip-python install python-keyczar
Tony Mack1d7fb8e2014-10-08 13:47:54 -040052pip-python install python-keystoneclient
53pip-python install python-novaclient
54pip-python install python-neutronclient
55pip-python install python-glanceclient
Tony Mackfea49972014-12-25 19:17:54 -050056pip-python install python-ceilometerclient
Scott Baker5e140a32015-01-30 15:41:39 -080057pip-python install django_rest_swagger
Tony Mack1d7fb8e2014-10-08 13:47:54 -040058
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050059
60easy_install django_evolution
Scott Baker524acdb2014-03-19 23:45:49 -070061easy_install python_gflags
62easy_install google_api_python_client
63
Scott Bakera1f72802014-09-11 00:25:49 -070064if [ ! -f /usr/lib/python2.7/site-packages/suit/static/suit/js/jquery-1.9.1.min.js ]; then
65 wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js
66fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050067
Scott Baker566c0022014-04-18 16:14:04 -070068if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then
69 rm -f /usr/share/GeoIP/GeoLiteCity.*
70 wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
71 gzip -d /usr/share/GeoIP/GeoLiteCity*.gz
72fi
Scott Bakeredec3322014-04-14 23:51:04 -070073
Scott Baker91d769f2014-05-15 14:23:22 -070074if [ "$1" == 2 ] ; then
Scott Bakerda74fba2015-02-06 00:18:07 -080075 if [[ -e /opt/xos/scripts/opencloud ]]; then
Scott Baker8ccabb92014-06-25 23:07:54 -070076 echo "UPGRADE - saving current state"
Scott Bakerda74fba2015-02-06 00:18:07 -080077 /opt/xos/scripts/opencloud dumpdata
Scott Baker8ccabb92014-06-25 23:07:54 -070078 fi
Scott Baker91d769f2014-05-15 14:23:22 -070079fi
80
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050081%install
82rm -rf %{buildroot}
83mkdir -p %{buildroot}
Scott Bakerda74fba2015-02-06 00:18:07 -080084install -d %{buildroot}/opt/xos
Sapan Bhatiaa4d3e382014-08-04 23:49:52 -040085install -d %{buildroot}/etc/init.d
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050086
87# in builddir
John H. Hartman7a3deca2014-08-11 16:46:27 -070088
Scott Bakerda74fba2015-02-06 00:18:07 -080089rm -rf %{buildroot}/opt/xos
John H. Hartman7a3deca2014-08-11 16:46:27 -070090# don't copy symbolic links (they are handled in %post)
91rsync -rptgoD ./planetstack %{buildroot}/opt/.
Scott Bakerda74fba2015-02-06 00:18:07 -080092# XXX temporary - rename /opt/planetstack to /opt/xos
93mv %{buildroot}/opt/planetstack %{buildroot}/opt/xos
Sapan Bhatia55049402014-08-04 23:45:59 -040094cp observer-initscript %{buildroot}/etc/init.d/plstackobserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050095
Scott Bakerda74fba2015-02-06 00:18:07 -080096find %{buildroot}/opt/xos -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist
John H. Hartman7a3deca2014-08-11 16:46:27 -070097echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist
98
99# remove config files from the file list (see %config below)
100cat > %{_tmppath}/config-files << "EOF"
Scott Bakerda74fba2015-02-06 00:18:07 -0800101/opt/xos/xos_config
102/opt/xos/deployment_auth.py
John H. Hartman7a3deca2014-08-11 16:46:27 -0700103EOF
104
105sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted
106sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted
107comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist
108
Scott Baker140f15a2014-05-15 15:14:23 -0700109cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500110
Sapan Bhatia8fd7b6f2014-11-05 10:38:15 -0500111
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500112%clean
113rm -rf %{buildroot}
114
115%files -f %{_tmppath}/tmp-filelist
116%defattr(-,root,root,-)
Scott Bakerda74fba2015-02-06 00:18:07 -0800117%config /opt/xos/xos_config
118%config /opt/xos/deployment_auth.py
119%config /opt/xos/model-deps
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500120
121%post
Scott Bakerda74fba2015-02-06 00:18:07 -0800122ln -s openstack_observer /opt/xos/observer
123#ln -s config-opencloud.py /opt/xos/syndicate_observer/syndicatelib_config/config.py
John H. Hartman7a3deca2014-08-11 16:46:27 -0700124
Scott Bakerda74fba2015-02-06 00:18:07 -0800125if [ ! -e /opt/xos/public_keys ]; then
126 cd /opt/xos
Scott Bakerc44f26c2014-09-12 15:38:24 -0700127 scripts/opencloud genkeys
128fi
129
Scott Bakere7df4a12014-05-15 14:21:31 -0700130if [ "$1" == 1 ] ; then
131 echo "NEW INSTALL - initializing database"
Scott Bakerda74fba2015-02-06 00:18:07 -0800132 /opt/xos/scripts/opencloud initdb
Scott Bakere7df4a12014-05-15 14:21:31 -0700133else
Scott Bakerbaf62562014-09-17 22:19:54 -0700134 # scripts/opencloud will choose evolve or migrate depending on django version
135 echo "UPGRADE - doing evolution/migration"
Scott Bakerda74fba2015-02-06 00:18:07 -0800136 /opt/xos/scripts/opencloud evolvedb
Scott Bakera1f72802014-09-11 00:25:49 -0700137fi
138
Sapan Bhatiac6aacf12014-11-14 15:27:33 -0500139# Clone ansible with latest openstack modules
140git clone --recursive git://github.com/ansible/ansible.git /opt/ansible
141mkdir -p /etc/ansible
142echo > /etc/ansible/hosts << "EOF"
143[localhost]
144127.0.0.1
145EOF
146
147
Scott Bakere7df4a12014-05-15 14:21:31 -0700148# start the server
Scott Bakerda74fba2015-02-06 00:18:07 -0800149/opt/xos/scripts/opencloud runserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500150
151%preun
Scott Baker4cd29252014-04-08 23:47:11 -0700152if [ "$1" = 0 ] ; then
Scott Baker709bb592015-02-03 15:54:34 -0800153 echo "UNINSTALL - destroying xos"
Scott Bakerda74fba2015-02-06 00:18:07 -0800154 rm -rf /opt/xos
Scott Baker4cd29252014-04-08 23:47:11 -0700155fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500156
157%changelog
158* Sat Feb 22 2014 Siobhan Tully 1.0.0
159- First Build
160