more dev
This commit is contained in:
parent
78f681fb41
commit
ee7034cba3
14
Dockerfile
14
Dockerfile
@ -1,16 +1,14 @@
|
|||||||
FROM debian:bullseye-slim
|
FROM alpine:latest
|
||||||
|
|
||||||
ENV CRONICLE_foreground=1
|
ENV CRONICLE_foreground=1
|
||||||
ENV CRONICLE_echo=1
|
ENV CRONICLE_echo=1
|
||||||
ENV CRONICLE_color=1
|
ENV CRONICLE_color=1
|
||||||
ENV EDITOR=vi
|
ENV EDITOR=vi
|
||||||
ENV MODE=master
|
ENV MODE=manager
|
||||||
|
|
||||||
RUN apt update && apt install -y tini curl git
|
#RUN apt update && apt install -y tini curl git procps
|
||||||
|
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
|
RUN apk update && apk add bash tini git procps nodejs npm
|
||||||
|
|
||||||
RUN apt install nodejs
|
|
||||||
|
|
||||||
RUN git clone https://github.com/cronicle-edge/cronicle-edge.git /opt/cronicle
|
RUN git clone https://github.com/cronicle-edge/cronicle-edge.git /opt/cronicle
|
||||||
|
|
||||||
@ -24,10 +22,12 @@ COPY run.sh /
|
|||||||
|
|
||||||
RUN chmod +x /run.sh
|
RUN chmod +x /run.sh
|
||||||
|
|
||||||
|
RUN mkdir /config
|
||||||
|
|
||||||
#RUN ln -sf /dev/stdout /opt/cronicle/logs/Cronicle.log
|
#RUN ln -sf /dev/stdout /opt/cronicle/logs/Cronicle.log
|
||||||
|
|
||||||
EXPOSE 3012
|
EXPOSE 3012
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
|
||||||
CMD [ "/run.sh" ]
|
CMD [ "/run.sh" ]
|
26
README.md
26
README.md
@ -4,14 +4,21 @@
|
|||||||
|
|
||||||
Dockerised Cronicle, based on the [Cronicle-Edge](https://github.com/cronicle-edge/cronicle-edge) fork.
|
Dockerised Cronicle, based on the [Cronicle-Edge](https://github.com/cronicle-edge/cronicle-edge) fork.
|
||||||
|
|
||||||
Can function in both the **master** and **worker** role.
|
Can function in both the **manager** and **worker** role.
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
|
`config.json`, located in `/config/config.json`, is automatically generated on the first run of Cronicle in 'manager' mode. This file must be kept identical between the manager and any workers it controls.
|
||||||
|
|
||||||
|
NOTE: You need to define the hostname of the container if using `docker run`. Cronicle expects the hostname to remain the same, so the randomly-generated container hostname can cause problems if it changes. Docker Compose containers inherit their hostname from the `container_name` parameter, but it can also be defined using `hostname: xyz`.
|
||||||
|
|
||||||
### Docker CLI
|
### Docker CLI
|
||||||
```
|
```
|
||||||
docker run -d --name cronicle \
|
docker run -d --name cronicle \
|
||||||
|
--hostname cronicle-docker \
|
||||||
-p 3012:3012 \
|
-p 3012:3012 \
|
||||||
-e MODE=master \
|
-e MODE=manager \
|
||||||
|
-v {path on host}:/config
|
||||||
git.mrmeeb.stream/mrmeeb/cronicle:latest
|
git.mrmeeb.stream/mrmeeb/cronicle:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -26,16 +33,23 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 3012:3012
|
- 3012:3012
|
||||||
|
volumes:
|
||||||
|
- {path on host}:/config
|
||||||
environment:
|
environment:
|
||||||
- MODE=master
|
- MODE=manager
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ports
|
## Ports
|
||||||
|Port |Purpose |
|
|Port |Purpose |
|
||||||
|-----|--------- |
|
|-----|----------|
|
||||||
|3012 |WebUI |
|
|3012 |WebUI and communication between manager and workers|
|
||||||
|
|
||||||
|
## Volumes
|
||||||
|
|Mount |Purpose |
|
||||||
|
|-----|-----------|
|
||||||
|
|/config |Persistent config file and job configurations|
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|Variable|Options|Default|Description|
|
|Variable|Options|Default|Description|
|
||||||
|--------|-------|-------|-------|
|
|--------|-------|-------|-------|
|
||||||
|MODE |master, worker|master|Determines what mode Cronicle runs in
|
|MODE |manager, worker|manager|Determines what mode Cronicle runs in
|
42
run.sh
42
run.sh
@ -1,17 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo $MODE
|
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 [ $MODE == "master" ]
|
if [ $MODE == "manager" ]
|
||||||
then
|
then
|
||||||
echo "Cronicle is running in 'master' mode"
|
echo "Cronicle is running in 'manager' mode"
|
||||||
|
|
||||||
|
if [ ! -f /config/data/.setup_done ]
|
||||||
|
then
|
||||||
|
echo "Setup needed - running now"
|
||||||
|
|
||||||
|
/opt/cronicle/bin/control.sh setup
|
||||||
|
touch /opt/cronicle/data/.setup_done
|
||||||
|
|
||||||
|
mv -n /opt/cronicle/data /config/data
|
||||||
|
rm -rf /opt/cronicle/data
|
||||||
|
ln -s /config/data /opt/cronicle/data
|
||||||
|
|
||||||
|
exec node /opt/cronicle/lib/main.js --color 1
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
rm -rf /opt/cronicle/data
|
||||||
|
ln -s /config/data /opt/cronicle/data
|
||||||
|
|
||||||
|
exec node /opt/cronicle/lib/main.js --color 1
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ $MODE == "worker" ]
|
elif [ $MODE == "worker" ]
|
||||||
then
|
then
|
||||||
echo "Cronicle is running in 'worker' mode"
|
echo "Cronicle is running in 'worker' mode"
|
||||||
|
|
||||||
|
exec node /opt/cronicle/lib/main.js --color 1
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "This is not a recognised mode. Accepted options are 'master' and 'worker'"
|
echo "'$MODE' is not a recognised option for MODE. Accepted options are 'manager' and 'worker'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#/opt/cronicle/bin/control.sh setup
|
|
||||||
|
|
||||||
#exec node /opt/cronicle/lib/main.js --color 1
|
|
Loading…
x
Reference in New Issue
Block a user