Merge branch 'feature/review-installation-4926'

resolves #4926
This commit is contained in:
Marius Hein 2013-10-22 11:57:46 +02:00
commit 7b3646e9fd
22 changed files with 659 additions and 185 deletions

View File

@ -1,4 +1,4 @@
<Directory "/var/www/html/icinga2-web">
<Directory "/var/www/html/icingaweb">
Options -Indexes
AllowOverride All

View File

@ -309,6 +309,12 @@ exec { 'install npm/should':
require => Exec['install nodejs']
}
exec { 'install npm/URIjs':
command => 'npm install -g URIjs',
creates => '/usr/lib/node_modules/URIjs',
require => Exec['install nodejs']
}
exec { 'install ZendFramework':
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework',
unless => 'rpm -qa | grep php-ZendFramework',
@ -329,14 +335,22 @@ cmmi { 'icinga2':
make_timeout => 900
}
file { 'icinga2-web-public':
configure { 'icingaweb':
path => '/vagrant',
flags => '--prefix=/vagrant \
--with-icinga-commandpipe="/usr/local/icinga-mysql/var/rw/icinga.cmd" \
--with-statusdat-file="/usr/local/icinga-mysql/var/status.dat" \
--with-httpd-config-path="/etc/httpd/conf.d"'
}
file { 'icingaweb-public':
ensure => '/vagrant/public',
path => '/var/www/html/icinga2-web',
path => '/var/www/html/icingaweb',
require => Class['apache']
}
file { '/etc/httpd/conf.d/icinga2-web.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icinga2-web.conf',
file { '/etc/httpd/conf.d/icingaweb.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf',
require => Package['apache'],
notify => Service['apache']
}

View File

@ -0,0 +1,17 @@
# Define: configure
#
# Run a gnu configure to prepare software for environment
#
# Parameters:
# [*flags*] - configure options.
# [*path*] - Target and working dir
#
define configure(
$path,
$flags
) {
exec { "configure-${name}":
cwd => $path,
command => "sh ./configure ${flags}"
}
}

View File

@ -1,7 +1,16 @@
SHELL=/bin/sh
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
prefix=@prefix@
exec_prefix=@exec_prefix@
WWW_CONF_PATH=@www_conf_path@
HTTPD_CONFIG_PATH=@httpd_config_path@
ICINGAWEB_CONFIG_PATH=@icingaweb_config_path@
ICINGAWEB_LOG_PATH=@icingaweb_log_path@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
INSTALL_OPTS_WEB=@INSTALL_OPTS_WEB@
@ -15,14 +24,22 @@ default:
#
# Installs the whole application w\o httpd configurations
#
install: install-static-files install-runtime-dirs ensure-writable-folders
install: install-config install-basic ensure-writable-folders
#
# Installs the whole application w\o configuration
#
install-basic: install-static-files install-runtime-dirs ensure-writable-folders
#
# Updates only the application
#
update: install-application
#
# Removes files created by ./configure
#
clean:
fi; \
if [ -f ./Makefile ];then \
rm ./Makefile; \
fi; \
@ -33,9 +50,27 @@ clean:
#
# Installs/copies all static files (executables, scripts, html, etc)
#
install-static-files: install-application copy-web-files-public copy-web-files-config copy-web-files-modules
install-static-files: install-application copy-web-files-public copy-web-files-modules
$(INSTALL) -m 644 $(INSTALL_OPTS) "./public/.htaccess" $(DESTDIR)$(prefix)/public/.htaccess;
#
# Installs all configuration files
#
install-config:
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
@dirs=`cd ./config ; find . -mindepth 1 -type d `;\
for dir in $$dirs; do \
$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$dir"; \
done;
@files=`cd ./config ; find . -mindepth 1 -type f \
-and ! -name ".*" -and ! -name "*.in"`; \
for file in $$files; do \
$(INSTALL) -m 644 $(INSTALL_OPTS_WEB) "./config/$$file" $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$file"; \
done
#
# Installs runtime directories like the application cache
#
@ -51,7 +86,8 @@ install-tests: copy-folder-tests
# Install configurations for apache2
#
install-apache-config:
$(INSTALL) -m 644 $(INSTALL_OPTS) "./etc/apache/icingaweb.conf" $(WWW_CONF_PATH)/icingaweb.conf;
$(INSTALL) -m 755 -d $(INSTALL_OPTS) $(DESTDIR)$(HTTPD_CONFIG_PATH)
$(INSTALL) -m 644 $(INSTALL_OPTS) "./etc/apache/icingaweb.conf" $(DESTDIR)$(HTTPD_CONFIG_PATH)/icingaweb.conf;
#
# Installs the php files to the prefix
@ -59,7 +95,7 @@ install-apache-config:
install-application: copy-web-files-application copy-web-files-library
#
# Rule for coying folders and containing files (arbitary types), hidden files are excluded
# Rule for copying folders and containing files (arbitary types), hidden files are excluded
#
copy-folder-%:
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/$*
@ -78,8 +114,8 @@ copy-folder-%:
ensure-writable-folders:
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/var/
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/var/log
chmod -R 775 $(DESTDIR)$(prefix)/config
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(ICINGAWEB_LOG_PATH)
chmod -R 775 $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
#
@ -97,10 +133,17 @@ copy-web-files-%:
-name "*.php" -or -name "*.ini" -or -name "*.*html" \
-or -name "*.js" -or -name "*.css" -or -name "*.less" \
-or -name "*.otf" -or -name "*.ttf" -or -name "*.otf" \
-or -name "*.svg" -or -name "*.woff" \
-or -name "*.svg" -or -name "*.woff" -or -name "*.png" \
-and ! -name ".*"`; \
for file in $$files; do \
$(INSTALL) -m 644 $(INSTALL_OPTS_WEB) "$$file" $(DESTDIR)$(prefix)/"$$file"; \
done
#
# Create release or snapshot tarball
#
create-tarball:
@./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/
create-tarball-nightly:
./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-`date +%Y%m%d`-`git rev-parse --short HEAD`/

View File

@ -21,7 +21,7 @@ have to do is install Vagrant and run:
> you'll download a plain CentOS base box and Vagrant will automatically
> provision the environment on the first go.
After you should be able to browse [localhost:8080/icinga2-web](http://localhost:8080/icinga2-web).
After you should be able to browse [localhost:8080/icingaweb](http://localhost:8080/icingaweb).
### Environment

198
bin/make-tarball Executable file
View File

@ -0,0 +1,198 @@
#!/bin/sh -
#
# File: make-tarball
#
# Description: A utility script that builds an archive file(s) of all
# git repositories and submodules in the current path.
# Useful for creating a single tarfile of a git super-
# project that contains other submodules.
# Derived from git-archive-all.sh, modified for Icinga
# DEBUGGING
set -e
set -C # noclobber
# TRAP SIGNALS
trap 'cleanup' QUIT EXIT
# For security reasons, explicitly set the internal field separator
# to newline, space, tab
OLD_IFS=$IFS
IFS='
'
cleanup () {
rm -f $TMPFILE
rm -f $TOARCHIVE
IFS="$OLD_IFS"
}
usage () {
echo "Usage is as follows:"
echo
echo "$PROGRAM <--version>"
echo " Prints the program version number on a line by itself and exits."
echo
echo "$PROGRAM <--usage|--help|-?>"
echo " Prints this usage output and exits."
echo
echo "$PROGRAM [--format <fmt>] [--prefix <path>] [--separate|-s] [output_file]"
echo " Creates an archive for the entire git superproject, and its submodules"
echo " using the passed parameters, described below."
echo
echo " If '--format' is specified, the archive is created with the named"
echo " git archiver backend. Obviously, this must be a backend that git-archive"
echo " understands. The format defaults to 'tar' if not specified."
echo
echo " If '--prefix' is specified, the archive's superproject and all submodules"
echo " are created with the <path> prefix named. The default is to not use one."
echo
echo " If '--separate' or '-s' is specified, individual archives will be created"
echo " for each of the superproject itself and its submodules. The default is to"
echo " concatenate individual archives into one larger archive."
echo
echo " If 'output_file' is specified, the resulting archive is created as the"
echo " file named. This parameter is essentially a path that must be writeable."
echo " When combined with '--separate' ('-s') this path must refer to a directory."
echo " Without this parameter or when combined with '--separate' the resulting"
echo " archive(s) are named with a dot-separated path of the archived directory and"
echo " a file extension equal to their format (e.g., 'superdir.submodule1dir.tar')."
}
version () {
echo "$PROGRAM version $VERSION"
}
# Internal variables and initializations.
readonly PROGRAM=`basename "$0"`
readonly VERSION=0.2
OLD_PWD="`pwd`"
TMPDIR=${TMPDIR:-/tmp}
TMPFILE=`mktemp "$TMPDIR/$PROGRAM.XXXXXX"` # Create a place to store our work's progress
TOARCHIVE=`mktemp "$TMPDIR/$PROGRAM.toarchive.XXXXXX"`
OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
SEPARATE=0
FORMAT=tar
PREFIX=
TREEISH=HEAD
# RETURN VALUES/EXIT STATUS CODES
readonly E_BAD_OPTION=254
readonly E_UNKNOWN=255
# Process command-line arguments.
while test $# -gt 0; do
case $1 in
--format )
shift
FORMAT="$1"
shift
;;
--prefix )
shift
PREFIX="$1"
shift
;;
--separate | -s )
shift
SEPARATE=1
;;
--version )
version
exit
;;
-? | --usage | --help )
usage
exit
;;
-* )
echo "Unrecognized option: $1" >&2
usage
exit $E_BAD_OPTION
;;
* )
break
;;
esac
done
if [ ! -z "$1" ]; then
OUT_FILE="$1"
shift
fi
# Validate parameters; error early, error often.
if [ $SEPARATE -eq 1 -a ! -d $OUT_FILE ]; then
echo "When creating multiple archives, your destination must be a directory."
echo "If it's not, you risk being surprised when your files are overwritten."
exit
elif [ `git config -l | grep -q '^core\.bare=false'; echo $?` -ne 0 ]; then
echo "$PROGRAM must be run from a git working copy (i.e., not a bare repository)."
exit
fi
# Create the superproject's git-archive
git archive --format=$FORMAT --prefix="$PREFIX" $TREEISH > $TMPDIR/$(basename $(pwd)).$FORMAT
echo $TMPDIR/$(basename $(pwd)).$FORMAT >| $TMPFILE # clobber on purpose
superfile=`head -n 1 $TMPFILE`
# DEACTIVATED: We do not have any exportable sub repositories
# find . -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' | grep -v '^$' >> $TOARCHIVE
while read path; do
TREEISH=$(git submodule | grep "^ .*${path%/}" | cut -d ' ' -f 2) # git-submodule does not list trailing slashes in $path
cd "$path"
git archive --format=$FORMAT --prefix="${PREFIX}$path" ${TREEISH:-HEAD} > "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT
if [ $FORMAT = 'zip' ]; then
# delete the empty directory entry; zipped submodules won't unzip if we don't do this
zip -d "$(tail -n 1 $TMPFILE)" "${PREFIX}${path%/}" >/dev/null # remove trailing '/'
fi
echo "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT >> $TMPFILE
cd "$OLD_PWD"
done < $TOARCHIVE
# Concatenate archives into a super-archive.
if [ $SEPARATE -eq 0 ]; then
if [ $FORMAT = 'tar' ]; then
sed -e '1d' $TMPFILE | while read file; do
tar --concatenate -f "$superfile" "$file" && rm -f "$file"
done
elif [ $FORMAT = 'zip' ]; then
sed -e '1d' $TMPFILE | while read file; do
# zip incorrectly stores the full path, so cd and then grow
cd `dirname "$file"`
zip -g "$superfile" `basename "$file"` && rm -f "$file"
done
cd "$OLD_PWD"
fi
echo "$superfile" >| $TMPFILE # clobber on purpose
fi
while read file; do
mv "$file" "$OUT_FILE"
done < $TMPFILE
CURRENTDIR=${PWD##*/}
gzip $OUT_FILE/$CURRENTDIR.tar
TAR_NAME=${PREFIX%/}
test -f $TAR_NAME.tar.gz && rm -f $TAR_NAME.tar.gz
mv $OUT_FILE/$CURRENTDIR.tar.gz ../$TAR_NAME.tar.gz
echo "../$TAR_NAME.tar.gz created for uploading..."
cd ..
test -f $TAR_NAME.tar.gz.md5 && rm $TAR_NAME.tar.gz.md5
md5sum $TAR_NAME.tar.gz > $TAR_NAME.tar.gz.md5
echo "../$TAR_NAME.tar.gz.md5 created for uploading..."

6
config/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
authentication.ini
config.ini
modules/monitoring/backends.ini
modules/monitoring/instances.ini
resources.ini

View File

@ -1,32 +0,0 @@
; authentication.ini
;
; Each section listed in this configuration represents a single backend
; that can be used to authenticate users or groups. Each databse backend must refer
; to a resource defined in resources.ini,
;
; The order of entries in this configuration is used to determine the fallback
; priority in case of an error. If the resource referenced in the first
; entry is not reachable, the next lower entry will be used for authentication.
; Please be aware that this behaviour is not valid for the authentication itself.
; The authentication will only be done against the one available resource with the highest
; priority.
[users-ldap]
backend = "ldap"
target = "user"
hostname = "localhost"
root_dn = "ou=people,dc=icinga,dc=org"
bind_dn = "cn=admin,cn=config"
bind_pw = "admin"
user_class = "inetOrgPerson"
user_name_attribute = "uid"
[users-pgsql]
backend = "db"
target = "user"
resource = "icingaweb-pgsql"
[users-mysql]
backend = "db"
target = "user"
resource = "icingaweb-mysql"

View File

@ -7,7 +7,7 @@ indexController = "dashboard"
; via the frontend and this file. With feature #4607 moduleFolder will
; be replaced with a configuration directive for locations of
; installed modules
moduleFolder = "/etc/icinga2-web/enabledModules"
moduleFolder = "@icingaweb_config_path@/enabledModules"
dateFormat = "d/m/Y"
timeFormat = "g:i A"
@ -17,13 +17,13 @@ timeFormat = "g:i A"
enable = "1"
type = "stream"
verbose = "1"
target = "{app}/var/log/icinga.log"
target = "@icingaweb_log_path@/icingaweb.log"
; For development and debug purposes: Logs additional (non critical) events to a
; seperate log
debug.enable = "1"
debug.type = "stream"
debug.target = "{app}/var/log/icinga.debug.log"
debug.target = "@icingaweb_log_path@/icingaweb.debug.log"
; Use ini store to store preferences on local disk
@ -35,4 +35,4 @@ type = "ini"
;type=db
;resource=icingaweb-mysql
configPath = "{app}/config/preferences"
configPath = "@icingaweb_config_path@/preferences"

View File

@ -1,22 +0,0 @@
[localdb]
type = ido
resource = "ido-mysql"
disabled = 0
[locallive]
type = livestatus
socket = "/var/lib/icinga/rw/live"
disabled = 0
[localfile]
type = statusdat
resource = "localfile-statusdat"
[localfailsafe]
type = combo
backends = localdb, locallive, localfile
disabled = 0

View File

@ -1,2 +0,0 @@
[icinga]
path = "/usr/local/icinga-mysql/var/rw/icinga.cmd"

View File

@ -0,0 +1,2 @@
[icinga]
path = "@icinga_commandpipe@"

View File

@ -1,54 +0,0 @@
; resources.ini
;
; The configuration file *resources.ini* contains data sources that
; can be referenced in other configurations. This allows you to manage
; all connections to SQL databases in one single place, avoiding the need
: to edit several different configuration files, when the connection
; information of a resource change.
;
; Each section represents a resource, with the section name being the
; identifier used to reference this certain section. Depending on the
; resource type, each section contains different properties. The property
; *type* defines the resource type and thus how the properties are going to
; be interpreted. Currently only the resource type *db* is available.
[icingaweb-pgsql]
type = db
db = pgsql ; PostgreSQL
host = localhost
password = icinga
username = icingaweb
dbname = icingaweb
[icingaweb-mysql]
type = db
db = mysql ; MySQL
host = localhost
password = icinga
username = icingaweb
dbname = icingaweb
[ido-pgsql]
type = db
db = pgsql ; PostgreSQL
host = localhost
password = icinga
username = icinga
port = 5432
dbname = icinga
[ido-mysql]
type = db
db = mysql ; MySQL
host = localhost
password = icinga
username = icinga
port = 3306
dbname = icinga
[localfile-statusdat]
type = statusdat
status_file = "/usr/local/icinga-mysql/var/status.dat"
object_file = "/usr/local/icinga-mysql/var/objects.cache"
disabled = 0

74
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for IcingaWeb 1.0.0.
# Generated by GNU Autoconf 2.69 for IcingaWeb2 1.0.0.
#
# Report bugs to <info@icinga.org>.
#
@ -578,10 +578,10 @@ MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='IcingaWeb'
PACKAGE_TARNAME='icingaweb'
PACKAGE_NAME='IcingaWeb2'
PACKAGE_TARNAME='icingaweb2'
PACKAGE_VERSION='1.0.0'
PACKAGE_STRING='IcingaWeb 1.0.0'
PACKAGE_STRING='IcingaWeb2 1.0.0'
PACKAGE_BUGREPORT='info@icinga.org'
PACKAGE_URL=''
@ -620,10 +620,11 @@ internal_db_port
internal_db_host
internal_db_name
internal_db_type
icingaweb_log_path
icingaweb_config_path
bin_group
bin_user
www_conf_path
httpd_config_path
web_path
web_group
web_user
@ -676,10 +677,11 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_icingaweb_config_path
with_icingaweb_log_path
with_web_user
with_web_group
with_web_path
with_www_conf_path
with_httpd_config_path
with_bin_user
with_bin_group
with_internal_db_type
@ -1256,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures IcingaWeb 1.0.0 to adapt to many kinds of systems.
\`configure' configures IcingaWeb2 1.0.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1304,7 +1306,7 @@ Fine tuning of the installation directories:
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/icingaweb]
--docdir=DIR documentation root [DATAROOTDIR/doc/icingaweb2]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
@ -1317,19 +1319,22 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of IcingaWeb 1.0.0:";;
short | recursive ) echo "Configuration of IcingaWeb2 1.0.0:";;
esac
cat <<\_ACEOF
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-icingaweb-config-path
Configuration path for icinga
--with-icingaweb-config-path=PATH
Configuration path for icinga web (default
$prefix/config)
--with-icingaweb-log-path=PATH
Log path for icinga web (default $prefix/var/log)
--with-web-user=USER username for web writable files (default www-data)
--with-web-group=GROUP group for web writable files (default www-data)
--with-web-path=PATH web sub path (default /icingaweb)
--with-http-configuration-path=PATH
--with-httpd-config-path=PATH
Include folder apache2 (default /etc/apache2/conf.d)
--with-bin-user=USER user for all other files (default root)
--with-bin-group=GROUP group for all other files (default bin)
@ -1485,7 +1490,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
IcingaWeb configure 1.0.0
IcingaWeb2 configure 1.0.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1502,7 +1507,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by IcingaWeb $as_me 1.0.0, which was
It was created by IcingaWeb2 $as_me 1.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2210,9 +2215,22 @@ fi
# Check whether --with-icingaweb_config_path was given.
if test "${with_icingaweb_config_path+set}" = set; then :
withval=$with_icingaweb_config_path; icingaweb_config_path="'$withval'"
withval=$with_icingaweb_config_path; icingaweb_config_path=$withval
else
icingaweb_config_path="'$prefix/config/'"
icingaweb_config_path=$prefix/config
fi
#
# Log files
#
# Check whether --with-icingaweb_log_path was given.
if test "${with_icingaweb_log_path+set}" = set; then :
withval=$with_icingaweb_log_path; icingaweb_log_path=$withval
else
icingaweb_log_path=$prefix/var/log
fi
@ -2278,18 +2296,18 @@ fi
# Check whether --with-www_conf_path was given.
if test "${with_www_conf_path+set}" = set; then :
withval=$with_www_conf_path; www_conf_path=$withval
# Check whether --with-httpd_config_path was given.
if test "${with_httpd_config_path+set}" = set; then :
withval=$with_httpd_config_path; httpd_config_path=$withval
else
www_conf_path=
www_conf_path=/etc/apache2/conf.d
for x in /etc/httpd/conf.d /etc/apache2/conf.d /etc/apache/conf.d; do
httpd_config_path=
httpd_config_path=/etc/apache2/conf.d
for x in /etc/httpd/conf.d /etc/apache2/conf-available /etc/apache2/conf.d /etc/apache/conf.d; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if path $x exists" >&5
$as_echo_n "checking if path $x exists... " >&6; }
if test -d $x; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
$as_echo "found" >&6; }; www_conf_path=$x; break
$as_echo "found" >&6; }; httpd_config_path=$x; break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
@ -2878,6 +2896,7 @@ fi
# Internal db setup
@ -2933,7 +2952,7 @@ fi
#
# Create config files
#
ac_config_files="$ac_config_files Makefile config/authentication.ini config/resources.ini config/modules/monitoring/backends.ini etc/apache/icingaweb.conf public/.htaccess"
ac_config_files="$ac_config_files Makefile config/authentication.ini config/config.ini config/resources.ini config/modules/monitoring/backends.ini config/modules/monitoring/instances.ini etc/apache/icingaweb.conf public/.htaccess public/index.php"
#
@ -3481,7 +3500,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by IcingaWeb $as_me 1.0.0, which was
This file was extended by IcingaWeb2 $as_me 1.0.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -3534,7 +3553,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
IcingaWeb config.status 1.0.0
IcingaWeb2 config.status 1.0.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -3647,10 +3666,13 @@ do
case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"config/authentication.ini") CONFIG_FILES="$CONFIG_FILES config/authentication.ini" ;;
"config/config.ini") CONFIG_FILES="$CONFIG_FILES config/config.ini" ;;
"config/resources.ini") CONFIG_FILES="$CONFIG_FILES config/resources.ini" ;;
"config/modules/monitoring/backends.ini") CONFIG_FILES="$CONFIG_FILES config/modules/monitoring/backends.ini" ;;
"config/modules/monitoring/instances.ini") CONFIG_FILES="$CONFIG_FILES config/modules/monitoring/instances.ini" ;;
"etc/apache/icingaweb.conf") CONFIG_FILES="$CONFIG_FILES etc/apache/icingaweb.conf" ;;
"public/.htaccess") CONFIG_FILES="$CONFIG_FILES public/.htaccess" ;;
"public/index.php") CONFIG_FILES="$CONFIG_FILES public/index.php" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([IcingaWeb], [1.0.0], [info@icinga.org])
AC_INIT([IcingaWeb2], [1.0.0], [info@icinga.org])
AC_PREFIX_DEFAULT(/usr/local/icingaweb)
if test "x$prefix" = "xNONE" ; then
@ -30,9 +30,18 @@ AC_CHECK_PHP_MODULE([sockets json])
# Configuration files
#
AC_ARG_WITH([icingaweb_config_path],
AS_HELP_STRING([--with-icingaweb-config-path], [Configuration path for icinga ]),
icingaweb_config_path="'$withval'",
icingaweb_config_path="'$prefix/config/'"
AS_HELP_STRING([--with-icingaweb-config-path=PATH], [Configuration path for icinga web (default $prefix/config)]),
icingaweb_config_path=$withval,
icingaweb_config_path=$prefix/config
)
#
# Log files
#
AC_ARG_WITH([icingaweb_log_path],
AS_HELP_STRING([--with-icingaweb-log-path=PATH], [Log path for icinga web (default $prefix/var/log)]),
icingaweb_log_path=$withval,
icingaweb_log_path=$prefix/var/log
)
#
@ -57,10 +66,10 @@ AC_ARG_WITH([web_path],
web_path=/icingaweb
)
AC_ARG_WITH([www_conf_path],
AS_HELP_STRING([--with-http-configuration-path=PATH], [Include folder apache2 (default /etc/apache2/conf.d)]),
www_conf_path=$withval,
www_conf_path=AC_PATH_GUESS([/etc/httpd/conf.d /etc/apache2/conf.d /etc/apache/conf.d], [www_conf_path], [/etc/apache2/conf.d])
AC_ARG_WITH([httpd_config_path],
AS_HELP_STRING([--with-httpd-config-path=PATH], [Include folder apache2 (default /etc/apache2/conf.d)]),
httpd_config_path=$withval,
httpd_config_path=AC_PATH_GUESS([/etc/httpd/conf.d /etc/apache2/conf-available /etc/apache2/conf.d /etc/apache/conf.d], [httpd_config_path], [/etc/apache2/conf.d])
)
#
@ -374,10 +383,11 @@ AC_SUBST(app_name)
AC_SUBST(web_user)
AC_SUBST(web_group)
AC_SUBST(web_path)
AC_SUBST(www_conf_path)
AC_SUBST(httpd_config_path)
AC_SUBST(bin_user)
AC_SUBST(bin_group)
AC_SUBST(icingaweb_config_path)
AC_SUBST(icingaweb_log_path)
# Internal db setup
AC_SUBST(internal_db_type)
@ -437,10 +447,13 @@ AC_SUBST(INSTALL_OPTS_WEB)
AC_CONFIG_FILES([
Makefile
config/authentication.ini
config/config.ini
config/resources.ini
config/modules/monitoring/backends.ini
config/modules/monitoring/instances.ini
etc/apache/icingaweb.conf
public/.htaccess
public/index.php
])
#

View File

@ -1,6 +1,17 @@
# Installation
## Requirements
* Apache2 with PHP >= 5.3.0 enabled
* PHP Zend Framework
* PHP with MySQL or PostgreSQL libraries
* MySQL or PostgreSQL server and client software
* Icinga 1.x or Icinga 2 as backend providers
RHEL/CentOS requires the EPEL repository enabled (which provides the `php-ZendFramework`
package). OpenSUSE requires the [server monitoring](https://build.opensuse.org/project/show/server:monitoring) repository (which provides the `php5-ZendFramework` package) enabled.
## configure && make
### Basic installation
@ -41,7 +52,7 @@ your backend, take a look at the various options described in `./configure --hel
It is required to set up all used Databases correctly, which basically means to create all needed user accounts and to
create all database tables. You will find the installation guides for the different databases in the sections below:
*IMPORTANT*: Select a secure password instead of "icinga" and alter the config/authentication.ini accordingly.
*IMPORTANT*: Select a secure password instead of "icingaweb" and alter the config/authentication.ini accordingly.
#### MySQL
@ -50,7 +61,7 @@ create all database tables. You will find the installation guides for the differ
mysql -u root -p
mysql> CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icinga';
mysql> CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb';
mysql> CREATE DATABASE `icingaweb`;
mysql> GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`;
mysql> FLUSH PRIVILEGES;
@ -59,8 +70,11 @@ create all database tables. You will find the installation guides for the differ
2. Create all tables (You need to be in the icinga2-web folder)
> **Note**
>
> RPM packages install the schema into /usr/share/doc/icingaweb-<version>/schema
bash$ mysql -u root -p icingaweb < etc/schema/users.mysql.sql
bash$ mysql -u root -p icingaweb < etc/schema/accounts.mysql.sql
#### PostgreSQL
@ -70,7 +84,7 @@ create all database tables. You will find the installation guides for the differ
sudo su postgres
psql
postgres=# CREATE USER icingaweb WITH PASSWORD 'icinga';
postgres=# CREATE USER icingaweb WITH PASSWORD 'icingaweb';
postgres=# CREATE DATABASE icingaweb;
postgres=# \q
@ -89,7 +103,11 @@ And restart your database ('service postgresql restart' or '/etc/init.d/postgres
3. Create all tables (You need to be in the icinga2-web folder)
bash$ psql -U icingaweb -a -f etc/schema/users.pgsql.sql
> **Note**
>
> RPM packages install the schema into /usr/share/doc/icingaweb-<version>/schema
bash$ psql -U icingaweb -a -f etc/schema/accounts.pgsql.sql

1
etc/apache/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
icingaweb.conf

262
icingaweb2.spec Normal file
View File

@ -0,0 +1,262 @@
# $Id$
# Authority: The icinga devel team <icinga-devel at lists.sourceforge.net>
# Upstream: The icinga devel team <icinga-devel at lists.sourceforge.net>
# ExcludeDist: el4 el3
%define revision 0
%define configdir %{_sysconfdir}/icingaweb
%define logdir %{_localstatedir}/log/icingaweb
%define sharedir %{_datadir}/icingaweb
%define prefixdir %{_datadir}/icingaweb
%if "%{_vendor}" == "suse"
%define phpname php5
%define phpzendname php5-ZendFramework
%endif
%if "%{_vendor}" == "redhat"
%define phpname php
%define phpzendname php-ZendFramework
%endif
# el5 requires newer php53 rather than php (5.1)
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
%define phpname php53
%endif
%if "%{_vendor}" == "suse"
%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
%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
%endif
Summary: Open Source host, service and network monitoring Web UI
Name: icingaweb2
Version: 1.0.0
Release: %{revision}%{?dist}
License: GPLv2
Group: Applications/System
URL: http://www.icinga.org
BuildArch: noarch
%if "%{_vendor}" == "suse"
AutoReqProv: Off
%endif
Source0: https://downloads.sourceforge.net/project/icinga/%{name}/%{version}/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{phpname} >= 5.3.0
BuildRequires: %{phpname}-devel >= 5.3.0
BuildRequires: %{phpname}-ldap
BuildRequires: %{phpname}-pdo
BuildRequires: %{phpzendname}
BuildRequires: %{phpzendname}-Db-Adapter-Pdo
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Mysql
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
%if "%{_vendor}" == "redhat"
%endif
%if "%{_vendor}" == "suse"
Requires: %{phpname}-devel >= 5.3.0
BuildRequires: %{phpname}-json
BuildRequires: %{phpname}-sockets
BuildRequires: %{phpname}-dom
%endif
Requires: %{phpname} >= 5.3.0
Requires: %{phpzendname}
Requires: %{phpname}-ldap
Requires: %{phpname}-pdo
%if "%{_vendor}" == "redhat"
Requires: %{phpname}-common
Requires: php-pear
%endif
%if "%{_vendor}" == "suse"
Requires: %{phpname}-pear
Requires: %{phpname}-dom
Requires: %{phpname}-tokenizer
Requires: %{phpname}-gettext
Requires: %{phpname}-ctype
Requires: %{phpname}-json
Requires: apache2-mod_php5
%endif
Requires: %{name}-doc
%description
IcingaWeb for Icinga 2 or Icinga 1.x using status data,
IDOUtils or Livestatus as backend provider.
%package config-internal-mysql
Summary: config for internal mysql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
%description config-internal-mysql
Configuration for internal mysql database.
%package config-internal-pgsql
Summary: config for internal pgsql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo
Requires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
%description config-internal-pgsql
Configuration for internal pgsql database.
%package config-backend-statusdata-1x
Summary: Backend config for status data
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-statusdata
%description config-backend-statusdata-1x
Backend config for status data provided by Icinga 1.x Core.
%package config-backend-ido-mysql-1x
Summary: Backend config for icinga 1.x ido mysql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-mysql
Provides: %{name}-config-ido-mysql
%description config-backend-ido-mysql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with MySQL.
%package config-backend-ido-pgsql-1x
Summary: Backend config for icinga 1.x ido pgsql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-pgsql
Provides: %{name}-config-ido-pgsql
%description config-backend-ido-pgsql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with PostgreSQL.
%package config-backend-livestatus-1x
Summary: Backend config for icinga 1.x livestatus
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-livestatus
%description config-backend-livestatus-1x
Backend config for livestatus provided by Icinga 1.x
with mk_livestatus NEB module.
%package config-backend-commands-1x
Summary: Backend config for icinga 1.x commands
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-commands
%description config-backend-commands-1x
Backend config for external command pipe provided by
Icinga 1.x
%prep
%setup -q -n %{name}-%{version}
%build
%configure \
--prefix="%{prefixdir}" \
--datadir="%{sharedir}" \
--datarootdir="%{sharedir}" \
--sysconfdir="%{configdir}" \
--with-icingaweb-config-path='%{configdir}' \
--with-icingaweb-log-path='%{logdir}' \
--with-web-path='/icingaweb' \
--with-httpd-config-path=%{apacheconfdir} \
--with-web-user='%{apacheuser}' \
--with-web-group='%{apachegroup}' \
--with-internal-db-type='mysql' \
--with-internal-db-name='icingaweb' \
--with-internal-db-host='localhost' \
--with-internal-db-port='3306' \
--with-internal-db-pass='icingaweb' \
--with-internal-db-user='icingaweb' \
--with-internal-authentication=yes \
--with-icinga-commandpipe='%{extcmdfile1x}' \
--with-livestatus-socket='%{livestatussocket1x}'
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}
%{__mkdir} -p %{buildroot}/%{apacheconfdir}
%{__make} install \
install-apache-config \
DESTDIR="%{buildroot}" \
INSTALL_OPTS="" \
COMMAND_OPTS="" \
INSTALL_OPTS_WEB="" \
INIT_OPTS=""
# prepare configuration for sub packages
%pre
# Add apacheuser in the icingacmd group
# If the group exists, add the apacheuser in the icingacmd group.
# It is not neccessary that icinga2-web is installed on the same system as
# icinga and only on systems with icinga installed the icingacmd
# group exists. In all other cases the user used for ssh access has
# to be added to the icingacmd group on the remote icinga server.
getent group icingacmd > /dev/null
if [ $? -eq 0 ]; then
%{_sbindir}/usermod -a -G icingacmd %{apacheuser}
fi
# uncomment if building from git
# %{__rm} -rf %{buildroot}%{_datadir}/icinga2-web/.git
%preun
%post
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%files
# main dirs
%defattr(-,root,root)
%doc etc/schema doc README.RHEL.SUSE
%{sharedir}/application
%{sharedir}/library
%{sharedir}/public
%{sharedir}/modules
# configs
%defattr(-,root,root)
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
%dir %{configdir}
%config(noreplace) %attr(775,%{apacheuser},%{apachegroup}) %{configdir}
# logs
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
%changelog
* Sun Oct 20 2013 Michael Friedrich <michael.friedrich@netways.de> - 1.0.0-1
- initial creation

2
public/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.htaccess
index.php

View File

@ -1,14 +0,0 @@
SetEnv APPLICATION_ENV development
RewriteEngine on
RewriteBase /icinga2-web
RewriteRule ^css/icinga.css css.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
php_flag short_open_tag on
php_value xdebug.idekey PHPSTORM

View File

@ -14,4 +14,4 @@ require_once dirname(__FILE__). '/../library/Icinga/Application/Web.php';
use Icinga\Application\Web;
Web::start(dirname(__FILE__) . '/../config/')->dispatch();
Web::start('@icingaweb_config_path@')->dispatch();

View File

@ -15,7 +15,7 @@ CASPERJS_HOST="localhost"
CASPERJS_PORT=80
CASPERJS_USER="jdoe"
CASPERJS_PASS="password"
CASPERJS_PATH="icinga2-web"
CASPERJS_PATH="icingaweb"
if [ ! -x $CASPER ]; then
echo "CasperJS is not installed but required to run frontend tests\n"\