logic fixes
This commit is contained in:
parent
511704a90f
commit
26c3a15c81
@ -42,12 +42,18 @@ services:
|
|||||||
- MODE=manager
|
- MODE=manager
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Custom Scripts
|
||||||
|
|
||||||
|
This container automatically checks for scripts in `/config/init` and runs them at startup of the container. This could be useful if you need to install additional applications into a worker container so it can execute any jobs.
|
||||||
|
|
||||||
## Ports
|
## Ports
|
||||||
|
|
||||||
|Port |Description|
|
|Port |Description|
|
||||||
|-----|-----------|
|
|-----|-----------|
|
||||||
|3012 |WebUI and communication between manager and workers|
|
|3012 |WebUI and communication between manager and workers|
|
||||||
|
|
||||||
## Volumes
|
## Volumes
|
||||||
|
|
||||||
|Mount |Description|
|
|Mount |Description|
|
||||||
|------|-----------|
|
|------|-----------|
|
||||||
|/config |Persistent config file and job configurations|
|
|/config |Persistent config file and job configurations|
|
||||||
|
35
run.sh
35
run.sh
@ -6,40 +6,42 @@ then
|
|||||||
if [ "$(ls -A /config/init)" ]
|
if [ "$(ls -A /config/init)" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
echo "Running additional startup scripts"
|
echo "Running additional startup scripts."
|
||||||
|
|
||||||
bash /config/init/*
|
bash /config/init/*
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "/config/init is empty - no additional startup scripts detected"
|
echo "/config/init is empty - no additional startup scripts detected."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Directory /config/init not found. Recreating."
|
echo "Directory /config/init not found. Creating."
|
||||||
|
|
||||||
mkdir /config/init
|
mkdir /config/init
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Copying config.json to /config if it isn't there already, then linking it back into Cronicle
|
|
||||||
mv -n /opt/cronicle/conf/config.json /config/config.json
|
|
||||||
rm -rf /opt/cronicle/conf/config.json
|
|
||||||
ln -s /config/config.json /opt/cronicle/conf/config.json
|
|
||||||
|
|
||||||
#Detecting what mode Cronicle should be started in
|
#Detecting what mode Cronicle should be started in
|
||||||
if [ $MODE == "manager" ]
|
if [ $MODE == "manager" ]
|
||||||
then
|
then
|
||||||
echo "Cronicle is running in 'manager' mode"
|
echo "Cronicle is running in 'manager' mode."
|
||||||
|
|
||||||
|
#Copying config.json to /config if it isn't there already, then linking it back into Cronicle
|
||||||
|
mv -n /opt/cronicle/conf/config.json /config/config.json
|
||||||
|
rm -rf /opt/cronicle/conf/config.json
|
||||||
|
ln -s /config/config.json /opt/cronicle/conf/config.json
|
||||||
|
|
||||||
if [ ! -f /config/data/.setup_done ]
|
if [ ! -f /config/data/.setup_done ]
|
||||||
then
|
then
|
||||||
echo "Setup needed - running now"
|
|
||||||
|
echo "Setup needed - running now."
|
||||||
|
|
||||||
/opt/cronicle/bin/control.sh setup
|
/opt/cronicle/bin/control.sh setup
|
||||||
touch /opt/cronicle/data/.setup_done
|
touch /opt/cronicle/data/.setup_done
|
||||||
|
|
||||||
|
#Moving data dir to /config, then linking it back into Cronicle
|
||||||
mv -n /opt/cronicle/data /config/data
|
mv -n /opt/cronicle/data /config/data
|
||||||
rm -rf /opt/cronicle/data
|
rm -rf /opt/cronicle/data
|
||||||
ln -s /config/data /opt/cronicle/data
|
ln -s /config/data /opt/cronicle/data
|
||||||
@ -58,20 +60,27 @@ then
|
|||||||
elif [ $MODE == "worker" ]
|
elif [ $MODE == "worker" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
echo "Cronicle is running in 'worker' mode"
|
echo "Cronicle is running in 'worker' mode."
|
||||||
|
|
||||||
if [ ! -f /config/config.json ]
|
if [ ! -f /config/config.json ]
|
||||||
then
|
then
|
||||||
|
|
||||||
echo "No config found. Copy config.json from the manager server and place it in the /config dir"
|
echo "No config found. Copy config.json from the manager server and place it in the /config dir."
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
#Removing default config.json and linking provided one back into Cronicle
|
||||||
|
rm -rf /opt/cronicle/conf/config.json
|
||||||
|
ln -s /config/config.json /opt/cronicle/conf/config.json
|
||||||
|
|
||||||
exec node /opt/cronicle/lib/main.js --color 1
|
exec node /opt/cronicle/lib/main.js --color 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "'$MODE' is not a recognised option for MODE. Accepted options are 'manager' and 'worker'"
|
|
||||||
|
echo "'$MODE' is not a recognised option for the MODE environment variable. Accepted options are 'manager' and 'worker'."
|
||||||
|
|
||||||
fi
|
fi
|
Loading…
x
Reference in New Issue
Block a user