migrating repo from old host server
This commit is contained in:
45
backend/README.md
Normal file
45
backend/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
Backend startup quickstart:
|
||||
|
||||
-----------------------------> BEST
|
||||
## 1. brew services start postgresql@15
|
||||
|
||||
OR
|
||||
|
||||
/opt/homebrew/opt/postgresql@15/bin/pg_ctl -D /opt/homebrew/var/postgresql@15 start
|
||||
|
||||
## 2. ALLIN ONE:
|
||||
Make dev-all — Runs both the API and poller concurrently.
|
||||
-----------------------------> BEST
|
||||
|
||||
- OR -
|
||||
|
||||
|
||||
## 3. Option 1: Single command (both API + poller)
|
||||
cd /Users/kjannette/workspace/koin_ping_0.2.0/backendmake dev-all
|
||||
|
||||
## 4. Option 2: Two separate terminals
|
||||
Terminal 1 (API server):
|
||||
cd /Users/kjannette/workspace/koin_ping_0.2.0/backend go run ./cmd/api
|
||||
|
||||
make run — Builds and runs the API server.
|
||||
make dev — Runs the API server with auto-reload via air (falls back to go run if air isn't installed).
|
||||
|
||||
## 5. Terminal 2 (Poller):
|
||||
cd /Users/kjannette/workspace/koin_ping_0.2.0/backend
|
||||
go run ./cmd/poller
|
||||
|
||||
make poller — Builds and runs the poller.
|
||||
make poller-dev — Runs the poller with auto-reload.
|
||||
|
||||
## Production: `make build` + restart service
|
||||
|
||||
On the server, from this directory:
|
||||
|
||||
- **`make build`** — writes fresh **`bin/api`** and **`bin/poller`** (see the Makefile).
|
||||
- **`make build-api`** — API only; **`make build-poller`** — poller only.
|
||||
|
||||
Building alone does **not** reload a process that is already listening (e.g. on port 8080). After deploy:
|
||||
|
||||
1. Ensure **`systemctl`** (or your supervisor) **`ExecStart`** runs the binary you just built (e.g. **`.../backend/bin/api`**) or copy `bin/api` to that path.
|
||||
2. **`sudo systemctl restart <your-api-service>`** (and the poller service if you rebuilt it).
|
||||
3. Optional check: **`readlink -f /proc/<pid>/exe`** should show your **`bin/api`** path without **`(deleted)`** — if you see `(deleted)`, an old process is still running the previous binary from memory.
|
||||
Reference in New Issue
Block a user