diff --git a/README.md b/README.md index 6ba635c..3fd0cf0 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,15 @@ Requirements: First setup: 1. Copy `.env.example` to `.env` 2. Fill real values in `.env`: + - `POSTGRES_DB` + - `POSTGRES_USER` + - `POSTGRES_PASSWORD` + - `DATABASE_URL` - `API_BASE_URL` - `API_BUY_PATH` - `API_KEY` + - `ADMIN_EMAIL` + - `ADMIN_PASSWORD` Make scripts executable once: @@ -38,6 +44,13 @@ One-click commands: - `uninstall.sh` - stop and remove container(s) - `reinstall.sh` - full restart with rebuild +If you see `/usr/bin/env: 'bash\r': No such file or directory`, convert line endings: + +```bash +sed -i 's/\r$//' install.sh uninstall.sh reinstall.sh +chmod +x install.sh uninstall.sh reinstall.sh +``` + After install: `http://localhost:3050` ## Run locally without Docker @@ -45,16 +58,19 @@ After install: `http://localhost:3050` 1. Copy env file: - `.env.example` -> `.env` 2. Set real values: + - `DATABASE_URL` (example: `postgres://postgres:postgres@localhost:5432/remnawave?sslmode=disable`) - `API_BASE_URL` - `API_BUY_PATH` - `API_KEY` + - `ADMIN_EMAIL` + - `ADMIN_PASSWORD` 3. Start: ```bash go run . ``` -Open: `http://localhost:8080` +Open: `http://localhost:3050` ## Run in Docker Compose manually @@ -62,6 +78,18 @@ Open: `http://localhost:8080` docker compose up --build ``` +## Database (PostgreSQL 17) + +- PostgreSQL 17 runs as `postgres` service in `docker-compose.yml` +- App uses `DATABASE_URL` to connect +- Tables are auto-created on startup: + - `users` + - `purchases` + - `servers` +- Admin user is auto-created/updated from: + - `ADMIN_EMAIL` + - `ADMIN_PASSWORD` + ## External API contract expected POST `${API_BASE_URL}${API_BUY_PATH}` @@ -79,6 +107,18 @@ Request JSON: } ``` +## Roles and admin panel + +- Default registered users get role: `user` +- Built-in administrator is created from env: + - `ADMIN_EMAIL` + - `ADMIN_PASSWORD` +- Admin panel URL: `/admin` +- Admin features: + - Add VPN servers + - Toggle server status online/offline + - Delete servers + Response JSON: ```json