Fix Coolify startup and add GitHub-to-Gitea deploy walkthrough

This commit is contained in:
dwindown
2026-03-15 06:46:36 +07:00
parent 661da7a0fe
commit 540e4200bb
4 changed files with 56 additions and 5 deletions

View File

@@ -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.

2
app.js
View File

@@ -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));

View File

@@ -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);
/**

View File

@@ -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",