Compare commits
10 Commits
d1b28f6486
...
56cd2dde79
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56cd2dde79 | ||
|
|
de7fc52b67 | ||
|
|
19816cdad1 | ||
|
|
5037b3ea03 | ||
|
|
08c8783d45 | ||
|
|
c23b0f211b | ||
|
|
4921d765d5 | ||
|
|
69fd98e4fb | ||
|
|
b9522aa783 | ||
|
|
cf5676a674 |
@@ -1,5 +1,9 @@
|
|||||||
# Gunakan Node.js 22 sebagai base image
|
# Gunakan Node.js 22 sebagai base image
|
||||||
FROM node:22-alpine
|
FROM node:22-alpine
|
||||||
|
ENV TZ="Asia/Jakarta"
|
||||||
|
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
RUN apk add --no-cache grep
|
||||||
|
|
||||||
# Atur working directory
|
# Atur working directory
|
||||||
WORKDIR /app/scheduler-app
|
WORKDIR /app/scheduler-app
|
||||||
|
|||||||
14
compose.yml
14
compose.yml
@@ -1,14 +1,14 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_ID
|
image: localhost:9999/$PROJECT_NAME:$CI_PIPELINE_ID
|
||||||
deploy:
|
deploy:
|
||||||
replicas : 1
|
replicas: 1
|
||||||
restart_policy :
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "0.01"
|
cpus: "0.01"
|
||||||
memory: "50m"
|
memory: "50m"
|
||||||
restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /home/script:/home/script
|
||||||
|
|||||||
18
index.js
18
index.js
@@ -43,24 +43,6 @@ cron.schedule(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
cron.schedule("* * * * *", async () => {
|
|
||||||
exec(
|
|
||||||
'bash /home/script/script.sh',
|
|
||||||
(error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
console.error(`Gagal menjalankan script: ${error.message}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stderr) {
|
|
||||||
console.error(`Stderr: ${stderr}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Output: ${stdout}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use((req, res) => {
|
app.use((req, res) => {
|
||||||
res.json("What are you looking for?!");
|
res.json("What are you looking for?!");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user