initial commit cronicle edge install and deploy

conf/ data/ should be comitted to master branch
master
David Kebler 2024-07-20 08:36:21 -07:00
commit ef1274b227
6 changed files with 59 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
package.json
bin/
nodejs/
logs/
htdocs/

3
control Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
cdir=$(dirname "$(realpath "$BASH_SOURCE")")
$cdir/bin/control.sh "$@"

3
cronicle.env Normal file
View File

@ -0,0 +1,3 @@
SNAPSHOTS_LOG=/snapshots/log
SNAPSHOTS_CONF=/snapshots/conf
BACKUP_DIR=/snapshots/scripts

10
cronicle.service.tpl Normal file
View File

@ -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

35
install Executable file
View File

@ -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

3
start Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
cdir=$(dirname "$(realpath "$BASH_SOURCE")")
$cdir/control start "$@"