From 9dabc6dc9c93a5393c8cd77bc14b1fdb1af45e42 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 12 Aug 2014 13:10:45 +0200 Subject: [PATCH] Update rpm builds refs #6401 refs #6403 --- .gitignore | 3 + icingaweb2.spec | 77 +++++++--------- packages/rhel/README | 57 ------------ packages/rhel/etc/httpd/conf.d/icingaweb.conf | 12 --- .../rhel/usr/share/icingaweb/public/.htaccess | 7 -- .../rhel/usr/share/icingaweb/public/index.php | 6 -- packages/rpm/README.md | 88 +++++++++++++++++++ packages/rpm/etc/httpd/conf.d/icingaweb.conf | 32 +++++++ packages/rpm/etc/icingaweb/authentication.ini | 6 ++ .../icingaweb/modules/monitoring/backends.ini | 8 ++ .../modules/monitoring/instances.ini | 2 + packages/rpm/etc/icingaweb/resources.ini | 28 ++++++ packages/rpm/usr/bin/icingacli | 6 ++ 13 files changed, 206 insertions(+), 126 deletions(-) delete mode 100644 packages/rhel/README delete mode 100644 packages/rhel/etc/httpd/conf.d/icingaweb.conf delete mode 100644 packages/rhel/usr/share/icingaweb/public/.htaccess delete mode 100644 packages/rhel/usr/share/icingaweb/public/index.php create mode 100644 packages/rpm/README.md create mode 100644 packages/rpm/etc/httpd/conf.d/icingaweb.conf create mode 100644 packages/rpm/etc/icingaweb/authentication.ini create mode 100644 packages/rpm/etc/icingaweb/modules/monitoring/backends.ini create mode 100644 packages/rpm/etc/icingaweb/modules/monitoring/instances.ini create mode 100644 packages/rpm/etc/icingaweb/resources.ini create mode 100755 packages/rpm/usr/bin/icingacli diff --git a/.gitignore b/.gitignore index ef44d81c9..1444ecfb2 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ config/preferences/*.ini # Application logfiles var/log/*.log +# Packaging /debian +*.tar.gz +*.komodoproject diff --git a/icingaweb2.spec b/icingaweb2.spec index b1cb3d2e5..6d9109f02 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -3,14 +3,14 @@ # Upstream: The icinga devel team # ExcludeDist: el4 el3 -%define revision 0 +%define revision 1 %define configdir %{_sysconfdir}/icingaweb %define sharedir %{_datadir}/icingaweb %define prefixdir %{_datadir}/icingaweb %define logdir %{sharedir}/log %define usermodparam -a -G -#%define logdir %{_localstatedir}/log/icingaweb +%define logdir %{_localstatedir}/log/icingaweb %if "%{_vendor}" == "suse" %define phpname php5 @@ -37,15 +37,15 @@ %define apacheconfdir %{_sysconfdir}/apache2/conf.d %define apacheuser wwwrun %define apachegroup www -%define extcmdfile1x %{_localstatedir}/icinga/rw/icinga.cmd -%define livestatussocket1x %{_localstatedir}/icinga/rw/live +%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd +%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus %endif %if "%{_vendor}" == "redhat" %define apacheconfdir %{_sysconfdir}/httpd/conf.d %define apacheuser apache %define apachegroup apache -%define extcmdfile-1x %{_localstatedir}/spool/icinga/cmd/icinga.cmd -%define livestatussocket1x %{_localstatedir}/spool/icinga/cmd/live +%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd +%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus %endif Summary: Open Source host, service and network monitoring Web UI @@ -109,8 +109,8 @@ Requires: php-Icinga %description -IcingaWeb for Icinga 2 or Icinga 1.x using status data, -IDOUtils or Livestatus as backend provider. +Icinga Web 2 for Icinga 2 or Icinga 1.x using multiple backends +for example DB IDO. %package -n icingacli Summary: Icinga CLI @@ -130,58 +130,54 @@ Requires: %{phpzendname} %description -n php-Icinga -Icinga Web 2 PHP Libraries shared with icingacli. - - +Icinga Web 2 PHP Libraries required by the web frontend and cli tool. %prep -#%setup -q -n %{name}-%{version} -%setup -q -n %{name} +#VERSION=0.0.1; git archive --format=tar --prefix=icingaweb2-$VERSION/ HEAD | gzip >icingaweb2-$VERSION.tar.gz +%setup -q -n %{name}-%{version} %build -cat > README.RHEL.SUSE <<"EOF" -IcingaWeb for RHEL and SUSE -=========================== - -Please check ./doc/installation.md -for requirements and database setup. -EOF - %install [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot} # prepare configuration for sub packages # install rhel apache config -install -D -m0644 packages/rhel/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf +install -D -m0644 packages/rpm/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf # install public, library, modules %{__mkdir} -p %{buildroot}/%{sharedir} %{__mkdir} -p %{buildroot}/%{logdir} +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/dashboard +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/modules +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring %{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules %{__cp} -r application library modules public %{buildroot}/%{sharedir}/ -# install index.php -install -m0644 packages/rhel/usr/share/icingaweb/public/index.php %{buildroot}/%{sharedir}/public/index.php - -# use the vagrant config for configuration for now - TODO -%{__cp} -r .vagrant-puppet/files/etc/icingaweb %{buildroot}/%{_sysconfdir}/ - -# we use the default 'icinga' database -sed -i 's/icinga2/icinga/g' %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini +## config +# use the default menu.ini for application and monitoring mobule +install -D -m0644 config/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/menu.ini +install -D -m0644 config/modules/monitoring/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/menu.ini +# authentication is db only +install -D -m0644 packages/rpm/etc/icingaweb/authentication.ini %{buildroot}/%{_sysconfdir}/icingaweb/authentication.ini +# custom resource paths +install -D -m0644 packages/rpm/etc/icingaweb/resources.ini %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini +# dashboard +install -D -m0644 config/dashboard/dashboard.ini %{buildroot}/%{_sysconfdir}/icingaweb/dashboard/dashboard.ini +# monitoring module (icinga2) +install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/backends.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/backends.ini +install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/instances.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/instances.ini # enable the monitoring module by default ln -s %{sharedir}/modules/monitoring %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules/monitoring +## config # install icingacli -install -D -m0755 bin/icingacli %{buildroot}/usr/bin/icingacli - -# install sql schema files as example - -# delete all *.in files +install -D -m0755 packages/rpm/usr/bin/icingacli %{buildroot}/usr/bin/icingacli %pre # Add apacheuser in the icingacmd group @@ -196,9 +192,6 @@ if [ $? -eq 0 ]; then %{_sbindir}/usermod %{usermodparam} icingacmd %{apacheuser} fi -# uncomment if building from git -# %{__rm} -rf %{buildroot}%{_datadir}/icinga2-web/.git - %preun %post @@ -209,14 +202,13 @@ fi %files # main dirs %defattr(-,root,root) -%doc etc/schema doc packages/rhel/README +%doc etc/schema doc packages/rpm/README.md %attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/public %attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/modules # configs %defattr(-,root,root) %config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf -%dir %{configdir} -%config(noreplace) %attr(775,%{apacheuser},%{apachegroup}) %{configdir} +%config(noreplace) %attr(-,%{apacheuser},%{apachegroup}) %{configdir} # logs %attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir} @@ -228,6 +220,3 @@ fi %attr(0755,root,root) /usr/bin/icingacli %changelog -* Tue May 11 2014 Michael Friedrich - 0.0.1-1 -- initial creation - diff --git a/packages/rhel/README b/packages/rhel/README deleted file mode 100644 index 4e04875bb..000000000 --- a/packages/rhel/README +++ /dev/null @@ -1,57 +0,0 @@ -Requirements -============ - -Disabled SELinux for sending commands via external command pipe -provided by Icinga (2) Core. - -# setenforce 0 - - -Webinterface Login -================== - -The default credentials using the internal MySQL database are - -icingaadmin:icinga - - -Internal MySQL DB Setup -======================= - -# mysql -u root -p - CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb'; - CREATE DATABASE `icingaweb`; - GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`; - FLUSH PRIVILEGES; - quit - -# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/accounts.mysql.sql -# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/preferences.mysql.sql - - -Modules -======= - -The monitoring module is enabled by default. - - -Backend configuration -===================== - -/etc/icingaweb/resources.ini - -contains the database backend information. By default -the Icinga IDO DB is used by the monitoring module in - -/etc/icingaweb/modules/monitoring/backends.ini - -The external command pipe is required for sending commands -and configured for Icinga 2 in - -/etc/icingaweb/modules/monitoring/instances.ini - - -Support -======= - -Please use one of the listed support channels at https://support.icinga.org diff --git a/packages/rhel/etc/httpd/conf.d/icingaweb.conf b/packages/rhel/etc/httpd/conf.d/icingaweb.conf deleted file mode 100644 index 47d408a67..000000000 --- a/packages/rhel/etc/httpd/conf.d/icingaweb.conf +++ /dev/null @@ -1,12 +0,0 @@ -Alias /icingaweb /usr/share/icingaweb/public - - Options -Indexes - - AllowOverride All - - Order allow,deny - Allow from all - - EnableSendfile Off - - diff --git a/packages/rhel/usr/share/icingaweb/public/.htaccess b/packages/rhel/usr/share/icingaweb/public/.htaccess deleted file mode 100644 index 8588fbbe1..000000000 --- a/packages/rhel/usr/share/icingaweb/public/.htaccess +++ /dev/null @@ -1,7 +0,0 @@ -RewriteEngine on -RewriteBase /icingaweb -RewriteCond %{REQUEST_FILENAME} -s [OR] -RewriteCond %{REQUEST_FILENAME} -l [OR] -RewriteCond %{REQUEST_FILENAME} -d -RewriteRule ^.*$ - [NC,L] -RewriteRule ^.*$ index.php [NC,L] diff --git a/packages/rhel/usr/share/icingaweb/public/index.php b/packages/rhel/usr/share/icingaweb/public/index.php deleted file mode 100644 index be6847bc8..000000000 --- a/packages/rhel/usr/share/icingaweb/public/index.php +++ /dev/null @@ -1,6 +0,0 @@ - + Options SymLinksIfOwnerMatch + AllowOverride None + + + # Apache 2.4 + + Require all granted + + + + + # Apache 2.2 + Order allow,deny + Allow from all + + + SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb + + EnableSendfile Off + + RewriteEngine on + RewriteBase /icingaweb/ + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ index.php [NC,L] + + diff --git a/packages/rpm/etc/icingaweb/authentication.ini b/packages/rpm/etc/icingaweb/authentication.ini new file mode 100644 index 000000000..3ec9c033a --- /dev/null +++ b/packages/rpm/etc/icingaweb/authentication.ini @@ -0,0 +1,6 @@ +[autologin] +backend = autologin + +[internal_db_authentication] +backend = db +resource = internal_db diff --git a/packages/rpm/etc/icingaweb/modules/monitoring/backends.ini b/packages/rpm/etc/icingaweb/modules/monitoring/backends.ini new file mode 100644 index 000000000..6dd67d4b5 --- /dev/null +++ b/packages/rpm/etc/icingaweb/modules/monitoring/backends.ini @@ -0,0 +1,8 @@ +[localdb] +type = ido +resource = "ido" + +[locallive] +disabled = "1" +type = livestatus +resource = livestatus diff --git a/packages/rpm/etc/icingaweb/modules/monitoring/instances.ini b/packages/rpm/etc/icingaweb/modules/monitoring/instances.ini new file mode 100644 index 000000000..037baa8b9 --- /dev/null +++ b/packages/rpm/etc/icingaweb/modules/monitoring/instances.ini @@ -0,0 +1,2 @@ +[icinga] +path = "/var/run/icinga2/cmd/icinga2.cmd" diff --git a/packages/rpm/etc/icingaweb/resources.ini b/packages/rpm/etc/icingaweb/resources.ini new file mode 100644 index 000000000..1c1e62eb1 --- /dev/null +++ b/packages/rpm/etc/icingaweb/resources.ini @@ -0,0 +1,28 @@ +[internal_db] +type = db +db = mysql +host = localhost +port = 3306 +password = icingaweb +username = icingaweb +dbname = icingaweb + +[ido] +type = db +db = mysql +host = localhost +port = 3306 +password = icinga +username = icinga +dbname = icinga + +[livestatus] +type = livestatus +socket = /var/run/icinga2/cmd/livestatus + +[logfile] +type = file +filename = "/var/log/icingaweb/icingaweb.log" +fields = "/^(?[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}(\\+[0-9]{2}:[0-9]{2})?) - (?[A-Za-z]+) - (?.*)$/" +; format: PCRE +; diff --git a/packages/rpm/usr/bin/icingacli b/packages/rpm/usr/bin/icingacli new file mode 100755 index 000000000..03ed43116 --- /dev/null +++ b/packages/rpm/usr/bin/icingacli @@ -0,0 +1,6 @@ +#!/usr/bin/php +dispatch();