-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial stab at packaging using ship_it
- Loading branch information
1 parent
688dbc7
commit 29658e9
Showing
7 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from ship_it import fpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
description: Sideboard Framework | ||
name: sideboard | ||
version: 0.1.0 | ||
before_install: package-support/preinstall.sh | ||
config_files: | ||
/etc/sideboard/sideboard-server.cfg: package-support/sideboard-server.cfg | ||
/etc/init.d/sideboard-server: package-support/sideboard-server | ||
build_dependencies: | ||
- rpm-build | ||
- prelink | ||
- ruby-devel | ||
run_dependencies: | ||
- python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if ! id -u sideboard &>/dev/null; then | ||
adduser sideboard | ||
fi | ||
|
||
mkdir -p /var/run/sideboard | ||
chown sideboard.sideboard /var/run/sideboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
RETVAL=0 | ||
prog="sideboard" | ||
|
||
DESC=sideboard | ||
VENV=/opt/sideboard | ||
PYTHON=$VENV/bin/python | ||
CHERRYD=$VENV/bin/cherryd | ||
USER=sideboard | ||
PID_FILE=/var/run/sideboard/$DESC.pid | ||
LOCK_FILE=/var/run/sideboard/$DESC.lock | ||
|
||
OPTIONS="-d --pidfile=$PID_FILE --import=sideboard.server" | ||
|
||
isrunning() { | ||
PID=`cat $PID_FILE 2>/dev/null` | ||
if [ -n "$PID" ]; then | ||
EXISTS=`ps aux | grep $PID | grep -v grep` | ||
if [ -n "$EXISTS" ]; then | ||
RETVAL=0 | ||
else | ||
RETVAL=1 | ||
fi | ||
else | ||
RETVAL=1 | ||
fi | ||
return $RETVAL | ||
} | ||
|
||
start() { | ||
if isrunning; then | ||
echo "Starting $prog: $prog is already running [FAIL]" | ||
RETVAL=1 | ||
else | ||
echo -n $"Starting $prog: " | ||
sudo -u $USER $CHERRYD $OPTIONS | ||
RETVAL=$? | ||
if [ $RETVAL -eq 0 ]; then | ||
touch $LOCK_FILE | ||
echo '[OK]' | ||
else | ||
echo '[FAIL]' | ||
fi | ||
fi | ||
return $RETVAL | ||
} | ||
|
||
stop() { | ||
PID=`cat $PID_FILE 2>/dev/null` | ||
if [ -n "$PID" ]; then | ||
echo -n $"Shutting down $prog: " | ||
kill $PID | ||
sleep 5 | ||
if isrunning; then | ||
echo '[FAIL]' | ||
RETVAL=1 | ||
else | ||
rm -f $LOCK_FILE | ||
echo '[OK]' | ||
RETVAL=0 | ||
fi | ||
else | ||
echo "$prog is not running" | ||
RETVAL=1 | ||
fi | ||
return $RETVAL | ||
} | ||
|
||
restart() { | ||
stop | ||
start | ||
} | ||
|
||
condrestart() { | ||
[-e $LOCK_FILE] && restart || : | ||
} | ||
|
||
status() { | ||
PID=`cat $PID_FILE 2>/dev/null` | ||
if [ -n "$PID" ]; then | ||
echo "$prog is running with pid $PID" | ||
RETVAL=0 | ||
else | ||
echo "$prog is not running" | ||
RETVAL=1 | ||
fi | ||
return $RETVAL | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status | ||
;; | ||
restart) | ||
restart | ||
;; | ||
condrestart|try-restart) | ||
condrestart | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|status|restart|condrestart}" | ||
RETVAL=1 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
ldap.url = "ldap://ldap.applied.sec" | ||
ldap.basedn = "ou=Users,dc=applied,dc=sec" | ||
|
||
[cherrypy] | ||
server.socket_host = "0.0.0.0" | ||
|
||
[loggers] | ||
root = "INFO" | ||
|
||
[handlers] | ||
[[syslog]] | ||
class = "logging.handlers.SysLogHandlers" | ||
address = "/dev/log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
configobj==5.0.5 | ||
cherrypy==3.2.5 | ||
cherrypy==3.2.2 | ||
#python-ldap==2.3.13 | ||
ws4py==0.3.2 | ||
SQLAlchemy==0.8.5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters