Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 1 | Summary: OpenCloud core services |
| 2 | Name: opencloud |
Scott Baker | 7e277d3 | 2014-12-19 12:31:35 -0800 | [diff] [blame] | 3 | Version: 1.0.29 |
| 4 | Release: 1 |
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 |
Sapan Bhatia | 6082a66 | 2014-10-06 16:59:26 -0400 | [diff] [blame] | 21 | requires: wget |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 22 | |
| 23 | %description |
| 24 | %{summary} |
| 25 | |
| 26 | %prep |
| 27 | %setup -q |
| 28 | |
| 29 | %build |
| 30 | # Empty section. |
| 31 | |
| 32 | %pre |
Scott Baker | 4bb7cbc | 2014-09-17 22:19:54 -0700 | [diff] [blame] | 33 | pip-python install django==1.7 |
Scott Baker | 97a71c3 | 2014-12-22 08:28:55 -0800 | [diff] [blame] | 34 | pip-python install djangorestframework==2.4.4 |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 35 | pip-python install markdown # Markdown support for the browseable API. |
| 36 | pip-python install pyyaml # YAML content-type support. |
| 37 | pip-python install django-filter # Filtering support |
| 38 | pip-python install lxml # XML manipulation library |
| 39 | pip-python install netaddr # IP Addr library |
| 40 | pip-python install pytz |
| 41 | pip-python install django-timezones |
| 42 | pip-python install requests |
| 43 | pip-python install django-crispy-forms |
| 44 | pip-python install django-geoposition |
| 45 | pip-python install django-extensions |
| 46 | pip-python install django-suit |
| 47 | pip-python install django-evolution |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 48 | pip-python install django-bitfield |
Scott Baker | 09c7af4 | 2014-04-14 11:00:25 -0700 | [diff] [blame] | 49 | pip-python install django-ipware |
Sapan Bhatia | 56ceec4 | 2014-09-08 11:00:29 -0400 | [diff] [blame] | 50 | pip-python install django-encrypted-fields |
Scott Baker | 87ef01a | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 51 | pip-python install python-keyczar |
Tony Mack | c88cbe2 | 2014-10-08 13:47:54 -0400 | [diff] [blame] | 52 | pip-python install python-keystoneclient |
| 53 | pip-python install python-novaclient |
| 54 | pip-python install python-neutronclient |
| 55 | pip-python install python-glanceclient |
| 56 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 57 | |
| 58 | easy_install django_evolution |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 59 | easy_install python_gflags |
| 60 | easy_install google_api_python_client |
| 61 | |
Scott Baker | 87ef01a | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 62 | if [ ! -f /usr/lib/python2.7/site-packages/suit/static/suit/js/jquery-1.9.1.min.js ]; then |
| 63 | wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js |
| 64 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 65 | |
Scott Baker | 566c002 | 2014-04-18 16:14:04 -0700 | [diff] [blame] | 66 | if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then |
| 67 | rm -f /usr/share/GeoIP/GeoLiteCity.* |
| 68 | wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz |
| 69 | gzip -d /usr/share/GeoIP/GeoLiteCity*.gz |
| 70 | fi |
Scott Baker | edec332 | 2014-04-14 23:51:04 -0700 | [diff] [blame] | 71 | |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 72 | if [ "$1" == 2 ] ; then |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 73 | if [[ -e /opt/planetstack/scripts/opencloud ]]; then |
| 74 | echo "UPGRADE - saving current state" |
| 75 | /opt/planetstack/scripts/opencloud dumpdata |
| 76 | fi |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 77 | fi |
| 78 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 79 | %install |
| 80 | rm -rf %{buildroot} |
| 81 | mkdir -p %{buildroot} |
| 82 | install -d %{buildroot}/opt/planetstack |
Sapan Bhatia | a4d3e38 | 2014-08-04 23:49:52 -0400 | [diff] [blame] | 83 | install -d %{buildroot}/etc/init.d |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 84 | |
| 85 | # in builddir |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 86 | |
| 87 | |
| 88 | # don't copy symbolic links (they are handled in %post) |
| 89 | rsync -rptgoD ./planetstack %{buildroot}/opt/. |
Sapan Bhatia | 5504940 | 2014-08-04 23:45:59 -0400 | [diff] [blame] | 90 | cp observer-initscript %{buildroot}/etc/init.d/plstackobserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 91 | |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 92 | 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] | 93 | echo /etc/init.d/plstackobserver >> %{_tmppath}/tmp-filelist |
| 94 | |
| 95 | # remove config files from the file list (see %config below) |
| 96 | cat > %{_tmppath}/config-files << "EOF" |
| 97 | /opt/planetstack/plstackapi_config |
| 98 | /opt/planetstack/deployment_auth.py |
| 99 | EOF |
| 100 | |
| 101 | sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted |
| 102 | sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted |
| 103 | comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist |
| 104 | |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 105 | cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 106 | |
Sapan Bhatia | ce52e24 | 2014-11-05 10:38:15 -0500 | [diff] [blame] | 107 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 108 | %clean |
| 109 | rm -rf %{buildroot} |
| 110 | |
| 111 | %files -f %{_tmppath}/tmp-filelist |
| 112 | %defattr(-,root,root,-) |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 113 | %config /opt/planetstack/plstackapi_config |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 114 | %config /opt/planetstack/deployment_auth.py |
Sapan Bhatia | 3f7e251 | 2014-11-14 15:27:33 -0500 | [diff] [blame] | 115 | %config /opt/planetstack/model-deps |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 116 | |
| 117 | %post |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 118 | ln -s ec2_observer /opt/planetstack/observer |
| 119 | ln -s config-opencloud.py /opt/planetstack/syndicate_observer/syndicatelib_config/config.py |
| 120 | |
Scott Baker | ff544f3 | 2014-09-12 15:38:24 -0700 | [diff] [blame] | 121 | if [ ! -e /opt/planetstack/public_keys ]; then |
| 122 | cd /opt/planetstack |
| 123 | scripts/opencloud genkeys |
| 124 | fi |
| 125 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 126 | if [ "$1" == 1 ] ; then |
| 127 | echo "NEW INSTALL - initializing database" |
| 128 | /opt/planetstack/scripts/opencloud initdb |
| 129 | else |
Scott Baker | 4bb7cbc | 2014-09-17 22:19:54 -0700 | [diff] [blame] | 130 | # scripts/opencloud will choose evolve or migrate depending on django version |
| 131 | echo "UPGRADE - doing evolution/migration" |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 132 | /opt/planetstack/scripts/opencloud evolvedb |
Scott Baker | 87ef01a | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 133 | fi |
| 134 | |
Sapan Bhatia | 3f7e251 | 2014-11-14 15:27:33 -0500 | [diff] [blame] | 135 | # Clone ansible with latest openstack modules |
| 136 | git clone --recursive git://github.com/ansible/ansible.git /opt/ansible |
| 137 | mkdir -p /etc/ansible |
| 138 | echo > /etc/ansible/hosts << "EOF" |
| 139 | [localhost] |
| 140 | 127.0.0.1 |
| 141 | EOF |
| 142 | |
| 143 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 144 | # start the server |
| 145 | /opt/planetstack/scripts/opencloud runserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 146 | |
| 147 | %preun |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 148 | if [ "$1" = 0 ] ; then |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 149 | echo "UNINSTALL - destroying planetstack" |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 150 | rm -rf /opt/planetstack |
| 151 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 152 | |
| 153 | %changelog |
| 154 | * Sat Feb 22 2014 Siobhan Tully 1.0.0 |
| 155 | - First Build |
| 156 | |