Files
2026-04-23 06:58:54 +00:00

129 lines
2.4 KiB
Markdown

# RemnaWave VPN Panel (Go)
MVP panel on Go with:
- main page
- registration
- authorization
- personal cabinet
- VPN config purchase via real external API and permanent key
## One-click install/uninstall/reinstall (Ubuntu)
Requirements:
- Docker Engine + Docker Compose plugin installed
- `bash` available (default on Ubuntu)
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:
```bash
chmod +x install.sh uninstall.sh reinstall.sh
```
One-click commands:
```bash
./install.sh
./uninstall.sh
./reinstall.sh
```
- `install.sh` - build and start panel
- `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
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:3050`
## Run in Docker Compose manually
```bash
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}`
Headers:
- `Authorization: Bearer <API_KEY>`
- `Content-Type: application/json`
Request JSON:
```json
{
"email": "user@example.com",
"plan": "monthly"
}
```
## 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
{
"config": "vpn://...."
}
```