Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 1 | Summary: OpenCloud core services |
| 2 | Name: opencloud |
Scott Baker | d3b7297 | 2014-09-11 00:24:41 -0700 | [diff] [blame] | 3 | Version: 1.0.25 |
Scott Baker | c44f26c | 2014-09-12 15:38:24 -0700 | [diff] [blame] | 4 | Release: 8 |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 5 | License: GPL+ |
| 6 | Group: Development/Tools |
| 7 | Source0: %{_tmppath}/%{name}-%{version}.tar.gz |
| 8 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} |
| 9 | requires: postgresql |
| 10 | requires: postgresql-server |
| 11 | requires: python-psycopg2 |
| 12 | requires: graphviz |
| 13 | requires: graphviz-devel |
| 14 | requires: graphviz-python |
| 15 | requires: libxslt-devel |
| 16 | requires: python-pip |
| 17 | requires: tar |
| 18 | requires: gcc |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 19 | requires: python-httplib2 |
Scott Baker | 09c7af4 | 2014-04-14 11:00:25 -0700 | [diff] [blame] | 20 | requires: GeoIP |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 21 | |
| 22 | %description |
| 23 | %{summary} |
| 24 | |
| 25 | %prep |
| 26 | %setup -q |
| 27 | |
| 28 | %build |
| 29 | # Empty section. |
| 30 | |
| 31 | %pre |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 32 | #pip-python install django==1.5 |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 33 | pip-python install djangorestframework |
| 34 | pip-python install markdown # Markdown support for the browseable API. |
| 35 | pip-python install pyyaml # YAML content-type support. |
| 36 | pip-python install django-filter # Filtering support |
| 37 | pip-python install lxml # XML manipulation library |
| 38 | pip-python install netaddr # IP Addr library |
| 39 | pip-python install pytz |
| 40 | pip-python install django-timezones |
| 41 | pip-python install requests |
| 42 | pip-python install django-crispy-forms |
| 43 | pip-python install django-geoposition |
| 44 | pip-python install django-extensions |
| 45 | pip-python install django-suit |
| 46 | pip-python install django-evolution |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 47 | pip-python install django-bitfield |
Scott Baker | 09c7af4 | 2014-04-14 11:00:25 -0700 | [diff] [blame] | 48 | pip-python install django-ipware |
Sapan Bhatia | 1080a28 | 2014-09-08 11:00:29 -0400 | [diff] [blame] | 49 | pip-python install django-encrypted-fields |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 50 | pip-python install python-keyczar |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 51 | |
| 52 | easy_install django_evolution |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 53 | easy_install python_gflags |
| 54 | easy_install google_api_python_client |
| 55 | |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 56 | if [ ! -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 |
| 58 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 59 | |
Scott Baker | 566c002 | 2014-04-18 16:14:04 -0700 | [diff] [blame] | 60 | if [ ! -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 |
| 64 | fi |
Scott Baker | edec332 | 2014-04-14 23:51:04 -0700 | [diff] [blame] | 65 | |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 66 | if [ "$1" == 2 ] ; then |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 67 | if [[ -e /opt/planetstack/scripts/opencloud ]]; then |
| 68 | echo "UPGRADE - saving current state" |
| 69 | /opt/planetstack/scripts/opencloud dumpdata |
| 70 | fi |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 71 | fi |
| 72 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 73 | %install |
| 74 | rm -rf %{buildroot} |
| 75 | mkdir -p %{buildroot} |
| 76 | install -d %{buildroot}/opt/planetstack |
Sapan Bhatia | a4d3e38 | 2014-08-04 23:49:52 -0400 | [diff] [blame] | 77 | install -d %{buildroot}/etc/init.d |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 78 | |
| 79 | # in builddir |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 80 | |
| 81 | |
| 82 | # don't copy symbolic links (they are handled in %post) |
| 83 | rsync -rptgoD ./planetstack %{buildroot}/opt/. |
Sapan Bhatia | 5504940 | 2014-08-04 23:45:59 -0400 | [diff] [blame] | 84 | cp observer-initscript %{buildroot}/etc/init.d/plstackobserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 85 | |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 86 | find %{buildroot}/opt/planetstack -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 87 | echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist |
| 88 | |
| 89 | # remove config files from the file list (see %config below) |
| 90 | cat > %{_tmppath}/config-files << "EOF" |
| 91 | /opt/planetstack/plstackapi_config |
| 92 | /opt/planetstack/deployment_auth.py |
| 93 | EOF |
| 94 | |
| 95 | sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted |
| 96 | sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted |
| 97 | comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist |
| 98 | |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 99 | cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 100 | |
| 101 | %clean |
| 102 | rm -rf %{buildroot} |
| 103 | |
| 104 | %files -f %{_tmppath}/tmp-filelist |
| 105 | %defattr(-,root,root,-) |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 106 | %config /opt/planetstack/plstackapi_config |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 107 | %config /opt/planetstack/deployment_auth.py |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 108 | |
| 109 | %post |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 110 | ln -s ec2_observer /opt/planetstack/observer |
| 111 | ln -s config-opencloud.py /opt/planetstack/syndicate_observer/syndicatelib_config/config.py |
| 112 | |
Scott Baker | c44f26c | 2014-09-12 15:38:24 -0700 | [diff] [blame] | 113 | if [ ! -e /opt/planetstack/public_keys ]; then |
| 114 | cd /opt/planetstack |
| 115 | scripts/opencloud genkeys |
| 116 | fi |
| 117 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 118 | if [ "$1" == 1 ] ; then |
| 119 | echo "NEW INSTALL - initializing database" |
| 120 | /opt/planetstack/scripts/opencloud initdb |
| 121 | else |
| 122 | echo "UPGRADE - doing evolution" |
| 123 | /opt/planetstack/scripts/opencloud evolvedb |
Scott Baker | c44f26c | 2014-09-12 15:38:24 -0700 | [diff] [blame] | 124 | #echo "UPGRADE - doing migration" |
| 125 | #/opt/planetstack/scripts/opencloud migratedb |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 126 | fi |
| 127 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 128 | # start the server |
| 129 | /opt/planetstack/scripts/opencloud runserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 130 | |
| 131 | %preun |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 132 | if [ "$1" = 0 ] ; then |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 133 | echo "UNINSTALL - destroying planetstack" |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 134 | rm -rf /opt/planetstack |
| 135 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 136 | |
| 137 | %changelog |
| 138 | * Sat Feb 22 2014 Siobhan Tully 1.0.0 |
| 139 | - First Build |
| 140 | |