blob: 6f282e16debc6c0d3a0c164ef5f4c8f960f75ca1 [file] [log] [blame]
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05001Summary: OpenCloud core services
2Name: opencloud
Scott Bakerc85b07a2014-09-11 00:24:41 -07003Version: 1.0.25
Scott Baker87ef01a2014-09-11 00:25:49 -07004Release: 7
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
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050021
22%description
23%{summary}
24
25%prep
26%setup -q
27
28%build
29# Empty section.
30
31%pre
Scott Baker8ccabb92014-06-25 23:07:54 -070032#pip-python install django==1.5
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050033pip-python install djangorestframework
34pip-python install markdown # Markdown support for the browseable API.
35pip-python install pyyaml # YAML content-type support.
36pip-python install django-filter # Filtering support
37pip-python install lxml # XML manipulation library
38pip-python install netaddr # IP Addr library
39pip-python install pytz
40pip-python install django-timezones
41pip-python install requests
42pip-python install django-crispy-forms
43pip-python install django-geoposition
44pip-python install django-extensions
45pip-python install django-suit
46pip-python install django-evolution
Scott Baker524acdb2014-03-19 23:45:49 -070047pip-python install django-bitfield
Scott Baker09c7af42014-04-14 11:00:25 -070048pip-python install django-ipware
Sapan Bhatia56ceec42014-09-08 11:00:29 -040049pip-python install django-encrypted-fields
Scott Baker87ef01a2014-09-11 00:25:49 -070050pip-python install python-keyczar
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
Scott Baker87ef01a2014-09-11 00:25:49 -070056if [ ! -f /usr/lib/python2.7/site-packages/suit/static/suit/js/jquery-1.9.1.min.js ]; then
57 wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js
58fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050059
Scott Baker566c0022014-04-18 16:14:04 -070060if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then
61 rm -f /usr/share/GeoIP/GeoLiteCity.*
62 wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
63 gzip -d /usr/share/GeoIP/GeoLiteCity*.gz
64fi
Scott Bakeredec3322014-04-14 23:51:04 -070065
Scott Baker91d769f2014-05-15 14:23:22 -070066if [ "$1" == 2 ] ; then
Scott Baker8ccabb92014-06-25 23:07:54 -070067 if [[ -e /opt/planetstack/scripts/opencloud ]]; then
68 echo "UPGRADE - saving current state"
69 /opt/planetstack/scripts/opencloud dumpdata
70 fi
Scott Baker91d769f2014-05-15 14:23:22 -070071fi
72
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050073%install
74rm -rf %{buildroot}
75mkdir -p %{buildroot}
76install -d %{buildroot}/opt/planetstack
Sapan Bhatiaa4d3e382014-08-04 23:49:52 -040077install -d %{buildroot}/etc/init.d
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050078
79# in builddir
John H. Hartman7a3deca2014-08-11 16:46:27 -070080
81
82# don't copy symbolic links (they are handled in %post)
83rsync -rptgoD ./planetstack %{buildroot}/opt/.
Sapan Bhatia55049402014-08-04 23:45:59 -040084cp observer-initscript %{buildroot}/etc/init.d/plstackobserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050085
Scott Baker140f15a2014-05-15 15:14:23 -070086find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist
John H. Hartman7a3deca2014-08-11 16:46:27 -070087echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist
88
89# remove config files from the file list (see %config below)
90cat > %{_tmppath}/config-files << "EOF"
91/opt/planetstack/plstackapi_config
92/opt/planetstack/deployment_auth.py
93EOF
94
95sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted
96sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted
97comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist
98
Scott Baker140f15a2014-05-15 15:14:23 -070099cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500100
101%clean
102rm -rf %{buildroot}
103
104%files -f %{_tmppath}/tmp-filelist
105%defattr(-,root,root,-)
Scott Baker140f15a2014-05-15 15:14:23 -0700106%config /opt/planetstack/plstackapi_config
Scott Baker8ccabb92014-06-25 23:07:54 -0700107%config /opt/planetstack/deployment_auth.py
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500108
109%post
John H. Hartman7a3deca2014-08-11 16:46:27 -0700110ln -s ec2_observer /opt/planetstack/observer
111ln -s config-opencloud.py /opt/planetstack/syndicate_observer/syndicatelib_config/config.py
112
Scott Bakere7df4a12014-05-15 14:21:31 -0700113if [ "$1" == 1 ] ; then
114 echo "NEW INSTALL - initializing database"
115 /opt/planetstack/scripts/opencloud initdb
116else
117 echo "UPGRADE - doing evolution"
118 /opt/planetstack/scripts/opencloud evolvedb
119fi
Scott Baker87ef01a2014-09-11 00:25:49 -0700120
121if [ ! -f /opt/planetstack/public_keys ]; then
122 cd /opt/planetstack
123 scripts/opencloud genkeys
124fi
125
Scott Bakere7df4a12014-05-15 14:21:31 -0700126# start the server
127/opt/planetstack/scripts/opencloud runserver
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500128
129%preun
Scott Baker4cd29252014-04-08 23:47:11 -0700130if [ "$1" = 0 ] ; then
Scott Bakere7df4a12014-05-15 14:21:31 -0700131 echo "UNINSTALL - destroying planetstack"
Scott Baker4cd29252014-04-08 23:47:11 -0700132 rm -rf /opt/planetstack
133fi
Siobhan Tully44fd4cc2014-02-23 00:07:12 -0500134
135%changelog
136* Sat Feb 22 2014 Siobhan Tully 1.0.0
137- First Build
138