Skip to content

Commit

Permalink
Merge pull request #27 from nguyenmp/main
Browse files Browse the repository at this point in the history
Synchronously run ./bin/control.sh setup to avoid race conditions when starting up with mounted data volume
  • Loading branch information
soulteary authored Dec 21, 2024
2 parents 548bad5 + 551b579 commit 93ec631
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Say goodbye to troublesome configuration and installation, and start your Schedu
# use the latest version on DockerHub
docker pull soulteary/cronicle
# or specified version
docker pull soulteary/cronicle:0.9.59
docker pull soulteary/cronicle:0.9.61
# Use GHCR mirror instead
docker pull ghcr.io/soulteary/cronicle:latest
```
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# 使用 DockerHub 最新版本
docker pull soulteary/cronicle
# 或者,使用指定版本
docker pull soulteary/cronicle:0.9.59
docker pull soulteary/cronicle:0.9.61
# 使用 GHCR 镜像
docker pull ghcr.io/soulteary/cronicle:latest
```
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:

cronicle:
image: soulteary/cronicle:0.9.59
image: soulteary/cronicle:0.9.61
restart: always
expose:
- 3012
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:

cronicle:
image: soulteary/cronicle:0.9.59
image: soulteary/cronicle:0.9.61
restart: always
hostname: cronicle
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:18-bullseye AS Builder
ENV CRONICLE_VERSION=0.9.59
ENV CRONICLE_VERSION=0.9.61
WORKDIR /opt/cronicle
RUN curl -L -o /tmp/Cronicle-${CRONICLE_VERSION}.tar.gz https://github.com/jhuckaby/Cronicle/archive/refs/tags/v${CRONICLE_VERSION}.tar.gz
# COPY Cronicle-${CRONICLE_VERSION}.tar.gz /tmp/
Expand Down
19 changes: 9 additions & 10 deletions docker/docker-entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ if(require("fs").existsSync("./data/users") || process.env["IS_WORKER"] === "tru
} else {
const { existsSync, unlinkSync } = require("fs");
const { dirname } = require("path");
const { exec } = require("child_process");
const { spawnSync } = require("child_process");
const { hostname, networkInterfaces } = require("os");
const StandaloneStorage = require("pixl-server-storage/standalone");

if (existsSync("./logs/cronicled.pid")) unlinkSync("./logs/cronicled.pid");

if (!existsSync("./data/users")) {
exec("/opt/cronicle/bin/control.sh setup", (error, stdout, stderr) => {
console.log("Storage init.");
if (error || stderr) {
console.log("init strorage failed");
console.log(error.message || stderr);
process.exit(1);
}
console.log(`stdout: ${stdout}`);
});
console.log("Storage init.");
const result = spawnSync("/opt/cronicle/bin/control.sh", ["setup"]);
if (result.error || result.stderr.length !== 0) {
console.log("init strorage failed");
console.log(result.error?.message || result.stderr.toString());
process.exit(1);
}
console.log(`stdout: ${result.stdout}`);
}

process.chdir(dirname(__dirname));
Expand Down

0 comments on commit 93ec631

Please sign in to comment.