blob: ed9e864cfd355b3064dcc9c6a3ceac07a7fded71 [file] [log] [blame]
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05001Summary: OpenCloud core services
2Name: opencloud
Scott Baker72ba6d92014-12-19 12:31:35 -08003Version: 1.0.29
4Release: 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
Tony Mack1d7fb8e2014-10-08 13:47:54 -040057
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050058
59easy_install django_evolution
Scott Baker524acdb2014-03-19 23:45:49 -070060easy_install python_gflags
61easy_install google_api_python_client
62
Scott Bakera1f72802014-09-11 00:25:49 -070063if [ ! -f /usr/lib/python2.7/site-packages/suit/static/suit/js/jquery-1.9.1.min.js ]; then
64 wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js
65fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050066
Scott Baker566c0022014-04-18 16:14:04 -070067if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then
68 rm -f /usr/share/GeoIP/GeoLiteCity.*
69 wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
70 gzip -d /usr/share/GeoIP/GeoLiteCity*.gz
71fi
Scott Bakeredec3322014-04-14 23:51:04 -070072
Scott Baker91d769f2014-05-15 14:23:22 -070073if [ "$1" == 2 ] ; then
Scott Baker8ccabb92014-06-25 23:07:54 -070074 if [[ -e /opt/planetstack/scripts/opencloud ]]; then
75 echo "UPGRADE - saving current state"
76 /opt/planetstack/scripts/opencloud dumpdata
77 fi
Scott Baker91d769f2014-05-15 14:23:22 -070078fi
79
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050080%install
81rm -rf %{buildroot}
82mkdir -p %{buildroot}
83install -d %{buildroot}/opt/planetstack
Sapan Bhatiaa4d3e382014-08-04 23:49:52 -040084install -d %{buildroot}/etc/init.d
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050085
86# in builddir
John H. Hartman7a3deca2014-08-11 16:46:27 -070087
88
89# don't copy symbolic links (they are handled in %post)
90rsync -rptgoD ./planetstack %{buildroot}/opt/.
Sapan Bhatia55049402014-08-04 23:45:59 -040091cp observer-initscript %{buildroot}/etc/init.d/plstackobserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050092
Scott Baker140f15a2014-05-15 15:14:23 -070093find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist
John H. Hartman7a3deca2014-08-11 16:46:27 -070094echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist
95
96# remove config files from the file list (see %config below)
97cat > %{_tmppath}/config-files << "EOF"
98/opt/planetstack/plstackapi_config
99/opt/planetstack/deployment_auth.py
100EOF
101
102sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted
103sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted
104comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist
105
Scott Baker140f15a2014-05-15 15:14:23 -0700106cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500107
Sapan Bhatia8fd7b6f2014-11-05 10:38:15 -0500108
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500109%clean
110rm -rf %{buildroot}
111
112%files -f %{_tmppath}/tmp-filelist
113%defattr(-,root,root,-)
Scott Baker140f15a2014-05-15 15:14:23 -0700114%config /opt/planetstack/plstackapi_config
Scott Baker8ccabb92014-06-25 23:07:54 -0700115%config /opt/planetstack/deployment_auth.py
Sapan Bhatiac6aacf12014-11-14 15:27:33 -0500116%config /opt/planetstack/model-deps
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500117
118%post
John H. Hartman7a3deca2014-08-11 16:46:27 -0700119ln -s ec2_observer /opt/planetstack/observer
120ln -s config-opencloud.py /opt/planetstack/syndicate_observer/syndicatelib_config/config.py
121
Scott Bakerc44f26c2014-09-12 15:38:24 -0700122if [ ! -e /opt/planetstack/public_keys ]; then
123 cd /opt/planetstack
124 scripts/opencloud genkeys
125fi
126
Scott Bakere7df4a12014-05-15 14:21:31 -0700127if [ "$1" == 1 ] ; then
128 echo "NEW INSTALL - initializing database"
129 /opt/planetstack/scripts/opencloud initdb
130else
Scott Bakerbaf62562014-09-17 22:19:54 -0700131 # scripts/opencloud will choose evolve or migrate depending on django version
132 echo "UPGRADE - doing evolution/migration"
Scott Bakere7df4a12014-05-15 14:21:31 -0700133 /opt/planetstack/scripts/opencloud evolvedb
Scott Bakera1f72802014-09-11 00:25:49 -0700134fi
135
Sapan Bhatiac6aacf12014-11-14 15:27:33 -0500136# Clone ansible with latest openstack modules
137git clone --recursive git://github.com/ansible/ansible.git /opt/ansible
138mkdir -p /etc/ansible
139echo > /etc/ansible/hosts << "EOF"
140[localhost]
141127.0.0.1
142EOF
143
144
Scott Bakere7df4a12014-05-15 14:21:31 -0700145# start the server
146/opt/planetstack/scripts/opencloud runserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500147
148%preun
Scott Baker4cd29252014-04-08 23:47:11 -0700149if [ "$1" = 0 ] ; then
Scott Bakere7df4a12014-05-15 14:21:31 -0700150 echo "UNINSTALL - destroying planetstack"
Scott Baker4cd29252014-04-08 23:47:11 -0700151 rm -rf /opt/planetstack
152fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500153
154%changelog
155* Sat Feb 22 2014 Siobhan Tully 1.0.0
156- First Build
157