mirror of
https://github.com/coderofsalvation/podi.git
synced 2025-12-16 11:57:45 +01:00
recipe app/simple
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
container=$(which podman || which docker || echo echo podman )
|
||||
|
||||
build(){
|
||||
header .pod/start/containerize
|
||||
$container build . -t $PODI_APP
|
||||
}
|
||||
|
||||
start(){
|
||||
header .pod/start/containerize
|
||||
$container run -d --rm -e PORT -p $PORT:80 --name $PODI_APP $PODI_APP
|
||||
}
|
||||
|
||||
#on build build_container
|
||||
@@ -1,14 +0,0 @@
|
||||
daemonize(){
|
||||
while sleep 1s; do
|
||||
set +e
|
||||
./app
|
||||
echo "$(tail -n200 app.log)" > app.log
|
||||
done
|
||||
}
|
||||
|
||||
start(){
|
||||
test -f .pid && { print "stopping $PODI_APP"; silent try kill -15 $(cat .pid); }
|
||||
nohup ./podi daemonize $PODI_APP:$PORT &> app.log &
|
||||
echo $! > .pid
|
||||
print "started $PODI_APP [PID $(cat .pid)]"
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
daemonize(){
|
||||
while sleep 1s; do
|
||||
set +e
|
||||
TTL=3600 # send SIGTERM after 3 hours
|
||||
BOOTTIME=1 # wait 1 second to boot app
|
||||
echo starting
|
||||
timeout 2>&1 | silent grep BusyBox && TTL="-t $TTL"
|
||||
timeout -s 15 ${TTL} ./podi start
|
||||
echo "$(tail -n200 app.log)" > app.log
|
||||
echo sleeping on port $PORT
|
||||
echo "HTTP/1.1 302 OK\nrefresh:$BOOTTIME;url=/\n\n" | nc -lp $PORT
|
||||
done
|
||||
}
|
||||
|
||||
start(){
|
||||
test -f .pid && { print "stopping $PODI_APP"; silent try kill -15 $(cat .pid); }
|
||||
nohup ./podi daemonize $PODI_APP:$PORT ${APP} &> app.log &
|
||||
echo $! > .pid
|
||||
print "started $PODI_APP: $APP [PID $(cat .pid)]"
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
daemonize(){
|
||||
while sleep 1s; do
|
||||
set +e
|
||||
TTL=3600 # send SIGTERM after 3 hours
|
||||
BOOTTIME=1 # wait 1 second to boot app
|
||||
ENGINE=$(which podman || which docker)
|
||||
echo starting
|
||||
test -z $($ENGINE ps -a --filter=name=$APPNAME| head -n-1) && \
|
||||
$ENGINE run -d --rm -p "$PORT:80" --name $APPNAME $APPNAME
|
||||
$ENGINE start $APPNAME
|
||||
sleep 3h; # go to sleep after 3 hours
|
||||
$ENGINE stop $APPNAME
|
||||
echo sleeping on port $PORT
|
||||
echo "HTTP/1.1 302 OK\nrefresh:$BOOTTIME;url=/\n\n" | nc -lp $PORT
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user