2026-05-18 06:51:06 +07:00
|
|
|
# Telegram Bot Uploader Backend
|
2026-05-18 06:34:02 +07:00
|
|
|
|
2026-05-18 06:51:06 +07:00
|
|
|
Backend production-ready untuk upload file ke Telegram yang tersimpan di private channel.
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
2026-08-02 16:19:30 +07:00
|
|
|
1. Siapkan PostgreSQL database (produksi: database `uploader` via PgBouncer pool di `100.121.180.82:6432`)
|
|
|
|
|
2. Setup environment: `cp .env.example .env`
|
|
|
|
|
3. Edit `.env` dengan nilai yang sesuai (lihat `DATABASE_URL`, `PORT=4000`)
|
|
|
|
|
4. Create table: `bun run db:migrate`
|
|
|
|
|
5. Install dependencies: `bun install`
|
2026-05-18 06:51:06 +07:00
|
|
|
|
|
|
|
|
## Telegram Private Channel Setup
|
|
|
|
|
|
|
|
|
|
1. Buat private channel Telegram
|
|
|
|
|
2. Tambah bot sebagai admin di channel
|
|
|
|
|
3. Dapatkan `STORAGE_CHANNEL_ID` (misalnya -1001234567890)
|
|
|
|
|
|
|
|
|
|
## Running
|
2026-05-18 06:34:02 +07:00
|
|
|
|
|
|
|
|
```bash
|
2026-05-18 06:51:06 +07:00
|
|
|
bun run dev # Development mode
|
|
|
|
|
bun run start # Production mode
|
2026-05-18 06:34:02 +07:00
|
|
|
```
|
|
|
|
|
|
2026-08-02 16:19:30 +07:00
|
|
|
## Deployment (Produksi — Nix + systemd)
|
|
|
|
|
|
|
|
|
|
> Infra lama berbasis Docker + Traefik sudah dihapus dari orangevps (2026-08-02).
|
|
|
|
|
|
|
|
|
|
- **Host**: orangevps
|
|
|
|
|
- **Service**: systemd unit `teleuploader` (env via `/etc/teleuploader/env` / BWS secrets)
|
|
|
|
|
- **Build**: Nix flake (`flake.nix`) — `nix build .#teleuploader` → `nix copy` → `systemctl restart teleuploader`
|
|
|
|
|
- **CI**: `.github/workflows/deploy.yml` (Gitea Actions / GitHub Actions)
|
|
|
|
|
- **Port**: `4000` (`PORT` env)
|
|
|
|
|
- **Domain**: `https://upload.asepharyana.my.id`
|
|
|
|
|
- **Reverse proxy**: Caddy (bukan Traefik/Docker)
|
|
|
|
|
- **Database**: `postgresql://asephs:***@100.121.180.82:6432/uploader` (PgBouncer pool di imrnes, **bukan** 5432/localhost)
|
|
|
|
|
- `deploy.sh` & `Dockerfile` & `docker-compose.yml` bersifat **legacy** — jangan dipakai untuk deploy produksi.
|
|
|
|
|
|
2026-05-18 06:51:06 +07:00
|
|
|
## API Endpoints
|
2026-05-18 06:34:02 +07:00
|
|
|
|
2026-05-18 06:51:06 +07:00
|
|
|
- `POST /api/upload` - Upload file
|
|
|
|
|
- `GET /f/:public_id` - Download redirect
|
|
|
|
|
- `GET /file/:public_id/info` - File metadata
|
|
|
|
|
- `GET /health` - Health check
|
2026-05-18 06:34:02 +07:00
|
|
|
|
2026-05-18 06:51:06 +07:00
|
|
|
## FAQ
|
|
|
|
|
|
|
|
|
|
**URL permanen maksudnya apa?**
|
2026-08-02 16:19:30 +07:00
|
|
|
URL backend tetap permanen: `https://upload.asepharyana.my.id/f/{public_id}`
|
2026-05-18 06:51:06 +07:00
|
|
|
Ini berarti URL service Anda fix, bukan jaminan file Telegram abadi.
|
|
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
|
|
Gunakan bot Telegram untuk upload, atau upload API langsung via HTTP.
|