Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 1 | Summary: OpenCloud core services |
Scott Baker | 709bb59 | 2015-02-03 15:54:34 -0800 | [diff] [blame] | 2 | Name: xos |
Scott Baker | e8cb93b | 2015-02-11 22:13:49 -0800 | [diff] [blame] | 3 | Version: 1.2.0 |
Scott Baker | 9faf51b | 2015-04-20 14:45:57 -0700 | [diff] [blame^] | 4 | Release: 4 |
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 | 897d92c | 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 | baf6256 | 2014-09-17 22:19:54 -0700 | [diff] [blame] | 33 | pip-python install django==1.7 |
Scott Baker | 6b50cb2 | 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 | 1080a28 | 2014-09-08 11:00:29 -0400 | [diff] [blame] | 50 | pip-python install django-encrypted-fields |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 51 | pip-python install python-keyczar |
Tony Mack | 1d7fb8e | 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 |
Tony Mack | fea4997 | 2014-12-25 19:17:54 -0500 | [diff] [blame] | 56 | pip-python install python-ceilometerclient |
Scott Baker | 5e140a3 | 2015-01-30 15:41:39 -0800 | [diff] [blame] | 57 | pip-python install django_rest_swagger |
Tony Mack | 1d7fb8e | 2014-10-08 13:47:54 -0400 | [diff] [blame] | 58 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 59 | |
| 60 | easy_install django_evolution |
Scott Baker | 524acdb | 2014-03-19 23:45:49 -0700 | [diff] [blame] | 61 | easy_install python_gflags |
| 62 | easy_install google_api_python_client |
| 63 | |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 64 | if [ ! -f /usr/lib/python2.7/site-packages/suit/static/suit/js/jquery-1.9.1.min.js ]; then |
| 65 | wget -P /usr/lib/python2.7/site-packages/suit/static/suit/js http://code.jquery.com/jquery-1.9.1.min.js |
| 66 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 67 | |
Scott Baker | 566c002 | 2014-04-18 16:14:04 -0700 | [diff] [blame] | 68 | if [ ! -f /usr/share/GeoIP/GeoLiteCity.dat ]; then |
| 69 | rm -f /usr/share/GeoIP/GeoLiteCity.* |
| 70 | wget -P /usr/share/GeoIP http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz |
| 71 | gzip -d /usr/share/GeoIP/GeoLiteCity*.gz |
| 72 | fi |
Scott Baker | edec332 | 2014-04-14 23:51:04 -0700 | [diff] [blame] | 73 | |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 74 | if [ "$1" == 2 ] ; then |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 75 | if [[ -e /opt/xos/scripts/opencloud ]]; then |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 76 | echo "UPGRADE - saving current state" |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 77 | /opt/xos/scripts/opencloud dumpdata |
Scott Baker | 8ccabb9 | 2014-06-25 23:07:54 -0700 | [diff] [blame] | 78 | fi |
Scott Baker | 91d769f | 2014-05-15 14:23:22 -0700 | [diff] [blame] | 79 | fi |
| 80 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 81 | %install |
| 82 | rm -rf %{buildroot} |
| 83 | mkdir -p %{buildroot} |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 84 | install -d %{buildroot}/opt/xos |
Sapan Bhatia | a4d3e38 | 2014-08-04 23:49:52 -0400 | [diff] [blame] | 85 | install -d %{buildroot}/etc/init.d |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 86 | |
| 87 | # in builddir |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 88 | |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 89 | rm -rf %{buildroot}/opt/xos |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 90 | # don't copy symbolic links (they are handled in %post) |
Scott Baker | 2939741 | 2015-02-18 22:30:22 -0800 | [diff] [blame] | 91 | rsync -rptgoD ./xos %{buildroot}/opt/. |
Scott Baker | b1a951d | 2015-02-19 13:24:52 -0800 | [diff] [blame] | 92 | cp observer-initscript %{buildroot}/etc/init.d/xosobserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 93 | |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 94 | find %{buildroot}/opt/xos -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > %{_tmppath}/tmp-filelist |
Scott Baker | b1a951d | 2015-02-19 13:24:52 -0800 | [diff] [blame] | 95 | echo /etc/init.d/xosobserver >> %{_tmppath}/tmp-filelist |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 96 | |
| 97 | # remove config files from the file list (see %config below) |
| 98 | cat > %{_tmppath}/config-files << "EOF" |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 99 | /opt/xos/xos_config |
| 100 | /opt/xos/deployment_auth.py |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 101 | EOF |
| 102 | |
| 103 | sort %{_tmppath}/tmp-filelist > %{_tmppath}/tmp-filelist.sorted |
| 104 | sort %{_tmppath}/config-files > %{_tmppath}/config-files.sorted |
| 105 | comm -13 %{_tmppath}/config-files.sorted %{_tmppath}/tmp-filelist.sorted > %{_tmppath}/tmp-filelist |
| 106 | |
Scott Baker | 140f15a | 2014-05-15 15:14:23 -0700 | [diff] [blame] | 107 | cp %{_tmppath}/tmp-filelist /tmp/tmp-filelist |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 108 | |
Sapan Bhatia | 8fd7b6f | 2014-11-05 10:38:15 -0500 | [diff] [blame] | 109 | |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 110 | %clean |
| 111 | rm -rf %{buildroot} |
| 112 | |
| 113 | %files -f %{_tmppath}/tmp-filelist |
| 114 | %defattr(-,root,root,-) |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 115 | %config /opt/xos/xos_config |
| 116 | %config /opt/xos/deployment_auth.py |
| 117 | %config /opt/xos/model-deps |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 118 | |
| 119 | %post |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 120 | ln -s openstack_observer /opt/xos/observer |
| 121 | #ln -s config-opencloud.py /opt/xos/syndicate_observer/syndicatelib_config/config.py |
John H. Hartman | 7a3deca | 2014-08-11 16:46:27 -0700 | [diff] [blame] | 122 | |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 123 | if [ ! -e /opt/xos/public_keys ]; then |
| 124 | cd /opt/xos |
Scott Baker | c44f26c | 2014-09-12 15:38:24 -0700 | [diff] [blame] | 125 | scripts/opencloud genkeys |
| 126 | fi |
| 127 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 128 | if [ "$1" == 1 ] ; then |
| 129 | echo "NEW INSTALL - initializing database" |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 130 | /opt/xos/scripts/opencloud initdb |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 131 | else |
Scott Baker | baf6256 | 2014-09-17 22:19:54 -0700 | [diff] [blame] | 132 | # scripts/opencloud will choose evolve or migrate depending on django version |
| 133 | echo "UPGRADE - doing evolution/migration" |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 134 | /opt/xos/scripts/opencloud evolvedb |
Scott Baker | a1f7280 | 2014-09-11 00:25:49 -0700 | [diff] [blame] | 135 | fi |
| 136 | |
Sapan Bhatia | c6aacf1 | 2014-11-14 15:27:33 -0500 | [diff] [blame] | 137 | # Clone ansible with latest openstack modules |
| 138 | git clone --recursive git://github.com/ansible/ansible.git /opt/ansible |
| 139 | mkdir -p /etc/ansible |
| 140 | echo > /etc/ansible/hosts << "EOF" |
| 141 | [localhost] |
| 142 | 127.0.0.1 |
| 143 | EOF |
| 144 | |
| 145 | |
Scott Baker | e7df4a1 | 2014-05-15 14:21:31 -0700 | [diff] [blame] | 146 | # start the server |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 147 | /opt/xos/scripts/opencloud runserver |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 148 | |
| 149 | %preun |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 150 | if [ "$1" = 0 ] ; then |
Scott Baker | 709bb59 | 2015-02-03 15:54:34 -0800 | [diff] [blame] | 151 | echo "UNINSTALL - destroying xos" |
Scott Baker | da74fba | 2015-02-06 00:18:07 -0800 | [diff] [blame] | 152 | rm -rf /opt/xos |
Scott Baker | 4cd2925 | 2014-04-08 23:47:11 -0700 | [diff] [blame] | 153 | fi |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 154 | |
| 155 | %changelog |
| 156 | * Sat Feb 22 2014 Siobhan Tully 1.0.0 |
| 157 | - First Build |
| 158 | |