From 540e4200bbf69290febc335c89b1f4329e8614b0 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 15 Mar 2026 06:46:36 +0700 Subject: [PATCH] Fix Coolify startup and add GitHub-to-Gitea deploy walkthrough --- COOLIFY_GITEA_WALKTHROUGH.md | 53 ++++++++++++++++++++++++++++++++++++ app.js | 2 -- bin/www | 2 +- package.json | 4 +-- 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 COOLIFY_GITEA_WALKTHROUGH.md diff --git a/COOLIFY_GITEA_WALKTHROUGH.md b/COOLIFY_GITEA_WALKTHROUGH.md new file mode 100644 index 0000000..4300705 --- /dev/null +++ b/COOLIFY_GITEA_WALKTHROUGH.md @@ -0,0 +1,53 @@ +# Coolify + Gitea Walkthrough + +This repository is set up so: +- `upstream` = GitHub source (`https://github.com/otangid/muslim-api.git`) +- `origin` = your Gitea repo (`https://git.backoffice.biz.id/dwindown/muslim-api.git`) + +## 1) One-time remote setup + +Run from this repo root: + +```bash +git remote rename origin upstream +git remote add origin https://git.backoffice.biz.id/dwindown/muslim-api.git +git remote -v +``` + +Expected: +- `upstream` points to GitHub +- `origin` points to Gitea + +## 2) First push to Gitea + +After your local commit is ready: + +```bash +git push -u origin main +``` + +## 3) Command flow for each update + +When GitHub has new commits and you want to redeploy via Coolify: + +```bash +git checkout main +git fetch upstream +git pull --ff-only upstream main +git push origin main +``` + +Coolify will redeploy when it detects the new commit on your Gitea branch. + +## 4) Optional quick checks before push + +```bash +git status +git log --oneline --decorate -n 5 +``` + +## Notes + +- App startup now does not require a physical `.env` file. +- Server uses `PORT` from environment, with fallback to `3000`. +- Configure your runtime environment variables in Coolify UI. diff --git a/app.js b/app.js index 69f7142..a651767 100644 --- a/app.js +++ b/app.js @@ -30,8 +30,6 @@ app.use("/js", express.static(path.join(__dirname, "public/js"))); app.use("/", apiRouter); app.use("/v1", apiV1Router); -// PW: dykq bppc wkon llmh - // catch 404 and forward to error handler app.use((req, res, next) => { next(createError(404)); diff --git a/bin/www b/bin/www index 99f414b..defea54 100755 --- a/bin/www +++ b/bin/www @@ -12,7 +12,7 @@ var http = require("http"); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT); +var port = normalizePort(process.env.PORT || "3000"); app.set("port", port); /** diff --git a/package.json b/package.json index c941ca5..21be1d8 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "Quran, Doa, Dzikir, Hadits Api", "private": true, "scripts": { - "start": "node --env-file=.env ./bin/www", - "devstart": "DEBUG=dikiotang:* nodemon --env-file=.env ./bin/www" + "start": "node ./bin/www", + "devstart": "DEBUG=dikiotang:* nodemon ./bin/www" }, "dependencies": { "body-parser": "^1.20.3",