Update rpm builds

refs #6401
refs #6403
This commit is contained in:
Michael Friedrich 2014-08-12 13:10:45 +02:00
parent 7958a81975
commit 9dabc6dc9c
13 changed files with 206 additions and 126 deletions

3
.gitignore vendored
View File

@ -36,6 +36,9 @@ config/preferences/*.ini
# Application logfiles
var/log/*.log
# Packaging
/debian
*.tar.gz
*.komodoproject

View File

@ -3,14 +3,14 @@
# Upstream: The icinga devel team <icinga-devel at lists.icinga.org>
# 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 <michael.friedrich@netways.de> - 0.0.1-1
- initial creation

View File

@ -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

View File

@ -1,12 +0,0 @@
Alias /icingaweb /usr/share/icingaweb/public
<Directory "/usr/share/icingaweb/public">
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
EnableSendfile Off
</Directory>

View File

@ -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]

View File

@ -1,6 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
require_once dirname(__DIR__). '/library/Icinga/Application/webrouter.php';

88
packages/rpm/README.md Normal file
View File

@ -0,0 +1,88 @@
# Icinga Web 2 README for RPM Packages
This file will describe how to install Icinga Web 2 from an RPM
package (RHEL/CentOS/Fedora, SLES/OpenSUSE).
## Requirements
* Apache 2.2+
* PHP 5.3+, Zend Framework, PHP PDO MySQL/PostgreSQL, PHP LDAP (optional)
* MySQL or PostgreSQL for internal DB
* Icinga 1.x or 2.x providing an IDO database (default: `icinga`)
* Icinga 1.x or 2.x providing an external command pipe (default: `icinga2.cmd`)
### SELinux
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`
## Support
Please use one of the listed support channels at https://support.icinga.org
## Internal DB Setup
Decide whether to use MySQL or PostgreSQL.
### MySQL
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 -u root -p icingaweb < /usr/share/doc/icingaweb2-*/schema/accounts.mysql.sql
mysql -u root -p icingaweb < /usr/share/doc/icingaweb2-*/schema/preferences.mysql.sql
### PostgreSQL
sudo su postgres
psql
postgres=# CREATE USER icingaweb WITH PASSWORD 'icingaweb';
postgres=# CREATE DATABASE icingaweb;
postgres=# \q
Add the `cingaweb` user for trusted authentication to your `pg_hba.conf` file
in `/var/lib/pgsql/data/pg_hba.conf` and restart the PostgreSQL server.
local icingaweb icingaweb trust
host icingaweb icingaweb 127.0.0.1/32 trust
host icingaweb icingaweb ::1/128 trust
Now install the `icingaweb` schema
bash$ psql -U icingaweb -a -f /usr/share/doc/icingaweb2-*/schema/accounts.pgsql.sql
bash$ psql -U icingaweb -a -f /usr/share/doc/icingaweb2-*/schema/preferences.pgsql.sql
## Configuration
### Module Configuration
The monitoring module is enabled by default.
### Backend configuration
`/etc/icingaweb/resources.ini` contains the database backend information.
By default the Icinga 2 DB IDO 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`
### Authentication configuration
The `/etc/icingaweb/authentication.ini` file uses the internal database as
default. This requires the database being installed properly before
allowing users to login via web console.

View File

@ -0,0 +1,32 @@
Alias /icingaweb "/usr/share/icingaweb/public"
<Directory "/usr/share/icingaweb/public">
Options SymLinksIfOwnerMatch
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
</IfModule>
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]
</Directory>

View File

@ -0,0 +1,6 @@
[autologin]
backend = autologin
[internal_db_authentication]
backend = db
resource = internal_db

View File

@ -0,0 +1,8 @@
[localdb]
type = ido
resource = "ido"
[locallive]
disabled = "1"
type = livestatus
resource = livestatus

View File

@ -0,0 +1,2 @@
[icinga]
path = "/var/run/icinga2/cmd/icinga2.cmd"

View File

@ -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 = "/^(?<datetime>[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}(\\+[0-9]{2}:[0-9]{2})?) - (?<loglevel>[A-Za-z]+) - (?<message>.*)$/"
; format: PCRE
;

6
packages/rpm/usr/bin/icingacli Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/php
<?php
use Icinga\Application\Cli;
require_once '/usr/share/icingaweb/library/Icinga/Application/Cli.php';
Cli::start()->dispatch();