Split packaging into ngcp-panel-[common|apache|nginx] packages to deal with webservers.

ngcp-panel-nginx has a separate fastcgi process.
The idea is to be able to choose how to serve the webapplication
just installing the proper package.
agranig/peering-route
Victor Seva 12 years ago
parent 5936b599d5
commit 1614858064

33
debian/control vendored

@ -44,8 +44,41 @@ Homepage: http://sipwise.com/
Package: ngcp-panel
Architecture: all
Depends: ngcp-panel-common (>= 1.0.15),
ngcp-panel-nginx | ngcp-panel-apache
Description: Catalyst based application
A completely overhauled provisioning interface for the
NGCP system.
.
This is a dependency package to install either ngpcp-panel-nginx
(by default) or ngcp-panel-apache.
Package: ngcp-panel-apache
Architecture: all
Pre-Depends: apache2.2-common,
libapache2-mod-perl2
Depends: ngcp-panel-common (= ${binary:Version}),
${misc:Depends}
Conflicts: ngcp-panel-nginx
Description: Catalyst based application. Using mod-perl
A completely overhauled provisioning interface for the
NGCP system.
Package: ngcp-panel-nginx
Architecture: all
Pre-Depends: nginx-common,
ngcp-panel-common (= ${binary:Version})
Depends: libfcgi-procmanager-perl,
${misc:Depends}
Conflicts: ngcp-panel-apache
Description: Catalyst based application. Using starman+nginx
A completely overhauled provisioning interface for the
NGCP system.
Package: ngcp-panel-common
Architecture: all
Replaces: ngcp-panel (<< 1.0.15)
Breaks: ngcp-panel (<< 1.0.15)
Depends: libcatalyst-actionrole-acl-perl,
libcatalyst-modules-perl,
libcatalyst-perl (>= 5.90040),

@ -0,0 +1 @@
etc/apache2/ngcp-panel etc/apache2/sites-available/

@ -26,13 +26,9 @@ if [ -e /etc/apache2/sites-enabled/default ]; then
a2dissite default
fi
# reload perl and/or apache modules
if [ -x /etc/init.d/apache2 ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d apache2 restart || true
else
/etc/init.d/apache2 restart || true
fi
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
exit 0

@ -0,0 +1,49 @@
#!/bin/sh
# preinst script for #PACKAGE#
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
if [ -e /etc/ningx/sites-enabled/ngcp-panel ]; then
echo "Deactivating ngcp-panel on nginx"
rm /etc/ningx/sites-enabled/ngcp-panel
flag_restart=1
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# reload nginx
if [ -x /etc/init.d/nginx ] && [ ! -z "$flag_restart" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d nginx restart || true
else
/etc/init.d/nginx restart || true
fi
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

@ -1,3 +1,3 @@
etc/apache2/ngcp-panel etc/apache2/sites-available/
ngcp_panel.conf etc/ngcp-panel/
share/* usr/share/ngcp-panel/
debian/tmp/usr/share/* usr/share/

@ -0,0 +1,103 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: ngcp-panel
# Required-Start: $syslog $network $local_fs $remote_fs $time mysql
# Required-Stop: $syslog $network $local_fs $remote_fs mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the ngcp-panel webapp
# Description: Start the ngcp-panel webapp
### END INIT INFO
. /lib/lsb/init-functions
DAEMON=/usr/share/ngcp-panel/ngcp_panel_fastcgi.pl
HOMEDIR=/usr/share/ngcp-panel
PIDFILE=/var/run/ngcp-panel.pid
USER=www-data
GROUP=www-data
NAME="ngcp_panel_fastcgi"
DESC="NGCP-Panel Webapp"
USOCKET=/var/run/ngcp-panel.sock
LOGERR=/var/log/ngcp/ngcp-panel.log
NPROC=1
OPTIONS="--listen $USOCKET --daemon --pidfile $PIDFILE --nproc $NPROC"
check_running() {
[ -s $PIDFILE ] && kill -0 $(cat $PIDFILE) >/dev/null 2>&1
}
_start() {
rm -f $PIDFILE 2>/dev/null
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON --chdir $HOMEDIR \
--user $USER --group $GROUP \
-- $OPTIONS || log_failure_msg "error"
}
start() {
log_daemon_msg "Starting $DESC: $NAME"
if check_running; then
log_progress_msg "already running"
log_end_msg 0
exit 0
fi
_start
log_end_msg $?
return $?
}
_stop() {
if [ -e $PIDFILE ]; then
if ! check_running ; then
log_daemon_msg " not running"
return 0
fi
kill `cat $PIDFILE`;
for i in 1 2 3 4 5 6 7; do
echo -n "."
sleep 1;
if check_running ; then
return 0
fi
done
if check_running ; then
return 1;
fi
fi
}
stop() {
log_daemon_msg "Stopping $DESC: $NAME"
_stop
log_end_msg $?
return $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
log_daemon_msg "Restarting web application" $NAME
_stop
_start
log_end_msg $?
return $?
;;
status)
log_daemon_msg "Status of $DESC: "
status_of_proc -p$PIDFILE $DAEMON $NAME
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,2 @@
ngcp_panel.psgi usr/share/ngcp-panel/
script/ngcp_panel_fastcgi.pl user/share/ngcp-panel/

@ -0,0 +1 @@
etc/nginx/sites-available/ngcp-panel etc/nginx/sites-enabled/ngcp-panel

@ -0,0 +1,32 @@
#!/bin/sh
set -e
# don't do anything when called with other argument than configure
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \$1'" >&2
exit 1
;;
esac
# reload nginx
if [ -x /etc/init.d/nginx ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d nginx restart || true
else
/etc/init.d/nginx restart || true
fi
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

@ -0,0 +1,49 @@
#!/bin/sh
# preinst script for #PACKAGE#
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
if [ -e /etc/apache2/sites-enabled/ngcp-panel ]; then
echo "Deactivating ngcp-panel on apache"
rm /etc/apache2/sites-enabled/ngcp-panel
flag_restart=1
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# reload nginx
if [ -x /etc/init.d/apache2 ] && [ ! -z "$flag_restart" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d apache2 restart || true
else
/etc/init.d/apache2 restart || true
fi
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

11
debian/rules vendored

@ -1,11 +1,12 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
%:
dh $@
override_dh_install:
dh_install
# remove all *.pl scripts, they are for development usage only
rm -rf ./debian/ngcp-panel/usr/bin
override_dh_auto_test:
echo "TODO / FIXME - skipping dh_auto_test"

@ -0,0 +1,17 @@
server {
listen 1443;
ssl on;
ssl_certificate /etc/apache2/ssl/myserver.crt;
ssl_certificate_key /etc/apache2/ssl/myserver.pem;
location / {
include fastcgi_params;
# adjust parameters for PSGI compatibility
fastcgi_param SCRIPT_NAME '';
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass 127.0.1.1:1433;
}
location /static {
root /usr/share/ngcp-panel;
}
}
Loading…
Cancel
Save