Compare commits

...

26 Commits

Author SHA1 Message Date
teddys48
ca5d3cc3e0 update
All checks were successful
Build and Deploy Scheduler / cleaning (push) Successful in 3s
Build and Deploy Scheduler / build_image (push) Successful in 1m31s
Build and Deploy Scheduler / deploy (push) Successful in 53s
2026-02-13 10:08:35 +07:00
teddys48
7d3c68066c 10
All checks were successful
Build and Deploy Scheduler / cleaning (push) Successful in 1s
Build and Deploy Scheduler / build_image (push) Successful in 1m5s
Build and Deploy Scheduler / deploy (push) Successful in 25s
2026-02-12 14:41:35 +07:00
teddys48
7437e109fe 9
All checks were successful
Build and Deploy Scheduler / cleaning (push) Successful in 1s
Build and Deploy Scheduler / build_image (push) Successful in 1m18s
Build and Deploy Scheduler / deploy (push) Successful in 12s
2026-02-12 14:37:50 +07:00
teddys48
eb1d6daf2c 9
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 3s
Build and Deploy Scheduler / build_image (push) Successful in 1m15s
Build and Deploy Scheduler / deploy (push) Failing after 1s
2026-02-12 14:35:43 +07:00
teddys48
4f2dc5110f 8
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m19s
Build and Deploy Scheduler / deploy (push) Failing after 1s
2026-02-12 14:31:38 +07:00
teddys48
607074eb33 8
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 6s
Build and Deploy Scheduler / build_image (push) Successful in 1m9s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 14:28:17 +07:00
teddys48
1202e3464f 7
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m32s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 14:09:21 +07:00
teddys48
96a934a3de 7
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m47s
Build and Deploy Scheduler / deploy (push) Failing after 1s
2026-02-12 14:05:17 +07:00
teddys48
318f21c826 6
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m14s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 12:16:11 +07:00
teddys48
19a3de9eb9 6
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 1s
Build and Deploy Scheduler / build_image (push) Successful in 1m8s
Build and Deploy Scheduler / deploy (push) Failing after 6s
2026-02-12 12:10:00 +07:00
teddys48
1925adaf42 5
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m18s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 12:07:16 +07:00
teddys48
74d9eb6124 first4
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m5s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 11:59:18 +07:00
teddys48
b6c0ada4a5 first3
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 2s
Build and Deploy Scheduler / build_image (push) Successful in 1m8s
Build and Deploy Scheduler / deploy (push) Failing after 1s
2026-02-12 11:47:31 +07:00
teddys48
7f32130e27 first3 2026-02-12 11:47:09 +07:00
teddys48
f27f7b9ab5 first2
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 3s
Build and Deploy Scheduler / build_image (push) Successful in 1m10s
Build and Deploy Scheduler / deploy (push) Failing after 1s
2026-02-12 11:27:50 +07:00
teddys48
bee0edbc52 first
Some checks failed
Build and Deploy Scheduler / cleaning (push) Successful in 1s
Build and Deploy Scheduler / build_image (push) Successful in 1m18s
Build and Deploy Scheduler / deploy (push) Failing after 0s
2026-02-12 11:23:48 +07:00
teddys48
56cd2dde79 update 2026-02-12 11:17:11 +07:00
teddys48
de7fc52b67 update 2025-10-20 14:03:32 +07:00
teddys48
19816cdad1 update 2025-10-10 15:11:58 +07:00
teddys48
5037b3ea03 update 2025-10-09 09:42:12 +07:00
teddys48
08c8783d45 update 2025-10-08 16:59:38 +07:00
teddys48
c23b0f211b update 2025-10-08 16:48:35 +07:00
teddys48
4921d765d5 update 2025-10-08 16:43:21 +07:00
teddys48
69fd98e4fb update 2025-10-08 16:36:07 +07:00
teddys48
b9522aa783 update 2025-10-08 16:32:24 +07:00
teddys48
cf5676a674 update 2025-10-08 16:24:19 +07:00
5 changed files with 96 additions and 48 deletions

56
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,56 @@
name: Build and Deploy Scheduler
on:
push:
branches:
- main
env:
REGISTRY: localhost:9999
IMAGE_NAME: ${{ secrets.PROJECT_NAME }}
jobs:
cleaning:
runs-on: host
steps:
- name: Cleanup docker
run: |
docker container prune -f
docker image prune -af
build_image:
runs-on: host
needs: cleaning
steps:
- name: Clone repo
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
git checkout ${{ gitea.ref_name }}
- name: Build image
run: |
docker build -t $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }} .
- name: Push image
run: |
docker push $REGISTRY/$IMAGE_NAME:${{ gitea.run_number }}
deploy:
runs-on: host
needs: build_image
steps:
- name: Clone repo
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
git checkout ${{ gitea.ref_name }}
- name: Prepare env for compose
run: |
echo "REGISTRY=$REGISTRY" > .env
echo "IMAGE_NAME=$IMAGE_NAME" >> .env
echo "TAG=${{ gitea.run_number }}" >> .env
cat .env
- name: Deploy stack
run: |
docker compose up -d

View File

@@ -1,5 +1,9 @@
# Gunakan Node.js 22 sebagai base image
FROM node:22-alpine
ENV TZ="Asia/Jakarta"
RUN apk add --no-cache curl
RUN apk add --no-cache grep
# Atur working directory
WORKDIR /app/scheduler-app

View File

@@ -1,14 +0,0 @@
version: '3.8'
services:
app:
image: 36.66.3.44:7007/$PROJECT_NAME:$CI_PIPELINE_ID
deploy:
replicas : 1
restart_policy :
condition: on-failure
resources:
limits:
cpus: "0.01"
memory: "50m"
restart: always

18
docker-compose.yaml Normal file
View File

@@ -0,0 +1,18 @@
services:
app:
image: ${REGISTRY}/${IMAGE_NAME}:${TAG}
container_name: scheduler-app
restart: always
volumes:
- /home/script:/home/script
mem_limit: 50m
cpus: 0.01
networks:
- scheduler-net
networks:
scheduler-net:
external: true

View File

@@ -14,7 +14,9 @@ cron.schedule(
async () => {
const module = "Birthday Notification";
try {
let res = await axios.get("http://36.66.3.44:7010/birthday-notification");
let res = await axios.get(
"http://email-notification:9997/birthday-notification",
);
console.log(module, "success", res.data);
} catch (error) {
console.error(module, "error", error.message);
@@ -22,7 +24,7 @@ cron.schedule(
},
{
timezone: "Asia/Jakarta",
}
},
);
cron.schedule(
@@ -31,7 +33,7 @@ cron.schedule(
const module = "Workanniversary";
try {
let res = await axios.get(
"http://36.66.3.44:7010/workanniversary-notification"
"http://email-notification:9997/workanniversary-notification",
);
console.log(module, "success", res.data);
} catch (error) {
@@ -40,27 +42,9 @@ cron.schedule(
},
{
timezone: "Asia/Jakarta",
}
},
);
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) => {
res.json("What are you looking for?!");
});