Compare commits
14 Commits
f27f7b9ab5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca5d3cc3e0 | ||
|
|
7d3c68066c | ||
|
|
7437e109fe | ||
|
|
eb1d6daf2c | ||
|
|
4f2dc5110f | ||
|
|
607074eb33 | ||
|
|
1202e3464f | ||
|
|
96a934a3de | ||
|
|
318f21c826 | ||
|
|
19a3de9eb9 | ||
|
|
1925adaf42 | ||
|
|
74d9eb6124 | ||
|
|
b6c0ada4a5 | ||
|
|
7f32130e27 |
@@ -39,6 +39,18 @@ jobs:
|
|||||||
runs-on: host
|
runs-on: host
|
||||||
needs: build_image
|
needs: build_image
|
||||||
steps:
|
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
|
- name: Deploy stack
|
||||||
run: |
|
run: |
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: localhost:9999/${PROJECT_NAME}:${CI_PIPELINE_ID}
|
image: ${REGISTRY}/${IMAGE_NAME}:${TAG}
|
||||||
container_name: scheduler-app
|
container_name: scheduler-app
|
||||||
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
deploy: {} # optional (ignored by compose, boleh hapus)
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- /home/script:/home/script
|
- /home/script:/home/script
|
||||||
|
|
||||||
mem_limit: 50m
|
mem_limit: 50m
|
||||||
cpus: 0.01
|
cpus: 0.01
|
||||||
|
networks:
|
||||||
|
- scheduler-net
|
||||||
|
|
||||||
|
networks:
|
||||||
|
scheduler-net:
|
||||||
|
external: true
|
||||||
|
|||||||
38
index.js
38
index.js
@@ -13,25 +13,9 @@ cron.schedule(
|
|||||||
"0 9 * * *",
|
"0 9 * * *",
|
||||||
async () => {
|
async () => {
|
||||||
const module = "Birthday Notification";
|
const module = "Birthday Notification";
|
||||||
try {
|
|
||||||
let res = await axios.get("http://36.66.3.44:7010/birthday-notification");
|
|
||||||
console.log(module, "success", res.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(module, "error", error.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
timezone: "Asia/Jakarta",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cron.schedule(
|
|
||||||
"1 9 * * *",
|
|
||||||
async () => {
|
|
||||||
const module = "Workanniversary";
|
|
||||||
try {
|
try {
|
||||||
let res = await axios.get(
|
let res = await axios.get(
|
||||||
"http://36.66.3.44:7010/workanniversary-notification"
|
"http://email-notification:9997/birthday-notification",
|
||||||
);
|
);
|
||||||
console.log(module, "success", res.data);
|
console.log(module, "success", res.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -40,7 +24,25 @@ cron.schedule(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
timezone: "Asia/Jakarta",
|
timezone: "Asia/Jakarta",
|
||||||
}
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
cron.schedule(
|
||||||
|
"1 9 * * *",
|
||||||
|
async () => {
|
||||||
|
const module = "Workanniversary";
|
||||||
|
try {
|
||||||
|
let res = await axios.get(
|
||||||
|
"http://email-notification:9997/workanniversary-notification",
|
||||||
|
);
|
||||||
|
console.log(module, "success", res.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(module, "error", error.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timezone: "Asia/Jakarta",
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use((req, res) => {
|
app.use((req, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user