commit ef1274b22745009615966cbe00830f5d05f6c209 Author: David Kebler Date: Sat Jul 20 08:36:21 2024 -0700 initial commit cronicle edge install and deploy conf/ data/ should be comitted to master branch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8ff39a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +package.json +bin/ +nodejs/ +logs/ +htdocs/ \ No newline at end of file diff --git a/control b/control new file mode 100755 index 0000000..42c3df4 --- /dev/null +++ b/control @@ -0,0 +1,3 @@ +#!/bin/bash +cdir=$(dirname "$(realpath "$BASH_SOURCE")") +$cdir/bin/control.sh "$@" diff --git a/cronicle.env b/cronicle.env new file mode 100644 index 0000000..dc73f66 --- /dev/null +++ b/cronicle.env @@ -0,0 +1,3 @@ +SNAPSHOTS_LOG=/snapshots/log +SNAPSHOTS_CONF=/snapshots/conf +BACKUP_DIR=/snapshots/scripts diff --git a/cronicle.service.tpl b/cronicle.service.tpl new file mode 100644 index 0000000..c2fc425 --- /dev/null +++ b/cronicle.service.tpl @@ -0,0 +1,10 @@ +[Install] +WantedBy=multi-user.target + +[Service] +Type=forking +WorkingDirectory=@CDIR@ +EnvironmentFile=@CDIR@/cronicle.env +PIDFile=@CDIR@/logs/cronicled.pid +ExecStart=@BINDIR@/control.sh start +ExecStop=@BINDIR@/control.sh stop diff --git a/install b/install new file mode 100755 index 0000000..d6070c8 --- /dev/null +++ b/install @@ -0,0 +1,35 @@ +#!/bin/bash +CRONICLE_DIR=$(dirname "$(realpath "$BASH_SOURCE")") +unset CRONICLE_UPGRADE +if [[ $1 == "upgrade" ]]; then CRONICLE_UPGRADE=true; shift; fi +pushd $CRONICLE_DIR +if [[ ! -d bin ]] || [[ $CRONICLE_UPGRADE ]] ; then + if [[ ! -d $CRONICLE_DIR/cronicle-edge ]]; then + git clone https://github.com/cronicle-edge/cronicle-edge.git + fi + pushd cronicle-edge + git pull origin main + npm package update + ./bundle "$@" $CRONICLE_DIR -f + popd + if [[ ! -d "nodejs" ]]; then + echo "installing nodejs for cronicle" + bash bin/getnode.sh +fi +fi +# install systemd service +# if [[ ! -f /etc/systemd/system/cronicle.service ]]; then +export CRONICLE_DIR=$CRONICLE_DIR +sed 's|@BINDIR@|'"$CRONICLE_DIR"'/bin|g' cronicle.service.tpl | sed 's|@CDIR@|'"$CRONICLE_DIR"'|g' | sudo tee /etc/systemd/system/cronicle.service +# ls -la /etc/systemd/system | grep cronicle +# cat /etc/systemd/system/cronicle.service +# fi +if [[ ! -d data ]]; then +bash control setup +fi +# ln -s $CRONICLE_DIR/conf/ $CRONICLE_DIR/dist +# mkdir $CRONICLE_DIR/logs/ +# ln -s $CRONICLE_DIR/logs/ $CRONICLE_DIR/dist/ +# mkdir $CRONICLE_DIR/data/ +# ln -s $CRONICLE_DIR/data/ $CRONICLE_DIR/dist/ +popd \ No newline at end of file diff --git a/start b/start new file mode 100755 index 0000000..a5cfb9e --- /dev/null +++ b/start @@ -0,0 +1,3 @@ +#!/bin/bash +cdir=$(dirname "$(realpath "$BASH_SOURCE")") +$cdir/control start "$@"