blob: ad39606902616086a571e3f2b495c71c384ac17b [file] [log] [blame]
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05001Summary: OpenCloud core services
2Name: opencloud
John H. Hartman7a3deca2014-08-11 16:46:27 -07003Version: 1.0.23
4Release: 0
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 Bhatia1080a282014-09-08 11:00:29 -040021requires: python-keyczar
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 Baker8ccabb92014-06-25 23:07:54 -070033#pip-python install django==1.5
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050034pip-python install djangorestframework
35pip-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
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050051
52easy_install django_evolution
Scott Baker524acdb2014-03-19 23:45:49 -070053easy_install python_gflags
54easy_install google_api_python_client
55
56wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050057
Scott Baker566c0022014-04-18 16:14:04 -070058if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then
59 rm -f /usr/share/GeoIP/GeoLiteCity.*
60 wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
61 gzip -d /usr/share/GeoIP/GeoLiteCity*.gz
62fi
Scott Bakeredec3322014-04-14 23:51:04 -070063
Scott Baker91d769f2014-05-15 14:23:22 -070064if [ "$1" == 2 ] ; then
Scott Baker8ccabb92014-06-25 23:07:54 -070065 if [[ -e /opt/planetstack/scripts/opencloud ]]; then
66 echo "UPGRADE - saving current state"
67 /opt/planetstack/scripts/opencloud dumpdata
68 fi
Scott Baker91d769f2014-05-15 14:23:22 -070069fi
70
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050071%install
72rm -rf %{buildroot}
73mkdir -p %{buildroot}
74install -d %{buildroot}/opt/planetstack
Sapan Bhatiaa4d3e382014-08-04 23:49:52 -040075install -d %{buildroot}/etc/init.d
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050076
77# in builddir
John H. Hartman7a3deca2014-08-11 16:46:27 -070078
79
80# don't copy symbolic links (they are handled in %post)
81rsync -rptgoD ./planetstack %{buildroot}/opt/.
Sapan Bhatia55049402014-08-04 23:45:59 -040082cp observer-initscript %{buildroot}/etc/init.d/plstackobserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050083
Scott Baker140f15a2014-05-15 15:14:23 -070084find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist
John H. Hartman7a3deca2014-08-11 16:46:27 -070085echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist
86
87# remove config files from the file list (see %config below)
88cat > %{_tmppath}/config-files << "EOF"
89/opt/planetstack/plstackapi_config
90/opt/planetstack/deployment_auth.py
91EOF
92
93sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted
94sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted
95comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist
96
Scott Baker140f15a2014-05-15 15:14:23 -070097cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050098
99%clean
100rm -rf %{buildroot}
101
102%files -f %{_tmppath}/tmp-filelist
103%defattr(-,root,root,-)
Scott Baker140f15a2014-05-15 15:14:23 -0700104%config /opt/planetstack/plstackapi_config
Scott Baker8ccabb92014-06-25 23:07:54 -0700105%config /opt/planetstack/deployment_auth.py
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500106
107%post
John H. Hartman7a3deca2014-08-11 16:46:27 -0700108ln -s ec2_observer /opt/planetstack/observer
109ln -s config-opencloud.py /opt/planetstack/syndicate_observer/syndicatelib_config/config.py
110
Scott Bakere7df4a12014-05-15 14:21:31 -0700111if [ "$1" == 1 ] ; then
112 echo "NEW INSTALL - initializing database"
113 /opt/planetstack/scripts/opencloud initdb
114else
115 echo "UPGRADE - doing evolution"
116 /opt/planetstack/scripts/opencloud evolvedb
117fi
118# start the server
119/opt/planetstack/scripts/opencloud runserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500120
121%preun
Scott Baker4cd29252014-04-08 23:47:11 -0700122if [ "$1" = 0 ] ; then
Scott Bakere7df4a12014-05-15 14:21:31 -0700123 echo "UNINSTALL - destroying planetstack"
Scott Baker4cd29252014-04-08 23:47:11 -0700124 rm -rf /opt/planetstack
125fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500126
127%changelog
128* Sat Feb 22 2014 Siobhan Tully 1.0.0
129- First Build
130