@@ -1,5 +0,0 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /var/www/html/
|
||||
|
||||
CMD pip install -r requirements.txt && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
@@ -27,7 +27,7 @@ The portal is then available on `http://HOST:8000`.
|
||||
services:
|
||||
backend:
|
||||
hostname: backend
|
||||
image: git.shihaam.dev/sarlink/radadmin/backed
|
||||
image: git.shihaam.dev/sarlink/radadmin/backend
|
||||
env_file:
|
||||
- backend.env
|
||||
frontend:
|
||||
|
||||
@@ -6,10 +6,10 @@ services:
|
||||
args:
|
||||
VITE_API_TARGET: ${VITE_API_TARGET}
|
||||
hostname: frontend
|
||||
image: git.shihaam.dev/sarlink/radadmin/backend
|
||||
image: git.shihaam.dev/sarlink/radadmin/frontend
|
||||
backend:
|
||||
build:
|
||||
context: ../../
|
||||
dockerfile: .build/prod/backend.Dockerfile
|
||||
hostname: backend
|
||||
image: git.shihaam.dev/sarlink/radadmin/frontend
|
||||
image: git.shihaam.dev/sarlink/radadmin/backend
|
||||
|
||||
@@ -21,6 +21,22 @@ frontend collects the key on a login screen and the backend validates it.
|
||||
|
||||
## Quick start
|
||||
|
||||
### With Docker (dev)
|
||||
|
||||
Runs both services with hot-reload — the frontend on Vite, the backend on
|
||||
`uvicorn --reload`, each with its source volume-mounted from the host.
|
||||
|
||||
```bash
|
||||
cp backend/.env.example backend/.env # edit DB credentials + API_KEY
|
||||
docker compose up --build # frontend :5173, backend :8000
|
||||
```
|
||||
|
||||
The frontend proxies `/api/*` to the `backend` service over the compose
|
||||
network, so log in at http://localhost:5173 with the `API_KEY` from
|
||||
`backend/.env`.
|
||||
|
||||
### Manual
|
||||
|
||||
**Backend** (see [`backend/README.md`](backend/README.md) for details):
|
||||
|
||||
```bash
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: .build/dev
|
||||
volumes:
|
||||
- ./:/app
|
||||
ports:
|
||||
- 8000:8000
|
||||
env_file:
|
||||
- .env
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
adding a new device
|
||||
example post /device/new
|
||||
macaddress,group
|
||||
removing an existing device
|
||||
|
||||
listing vlans
|
||||
GET /vlan/
|
||||
SELECT * FROM `radgroupreply`
|
||||
this will return 3 duplicate "groupnames" with different attribute and vlaue
|
||||
only need to return group name and value for Tunnel-Private-Group-Id
|
||||
|
||||
adding new vlan
|
||||
need to add 3 items with different attribute and value,
|
||||
for example to add staff vlan with vlan ID 55
|
||||
api call should be like POST vlan/add and json data vlanid:55, alias staff
|
||||
|
||||
'INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
||||
VALUES ('staff', 'Tunnel-Type', '=', 'VLAN');
|
||||
|
||||
INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
||||
VALUES ('staff', 'Tunnel-Medium-Type', '=', 'IEEE-802');
|
||||
|
||||
INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
||||
VALUES ('staff', 'Tunnel-Private-Group-Id', '=', '55');
|
||||
'
|
||||
deleting existing vlan
|
||||
you get api call to delete vlan
|
||||
DELETE vlan/55
|
||||
and the sqlcommands should you looking for Tunnel-Private-Group-Id=55 and then deleting all the maching group names
|
||||
|
||||
edit existing vlan (alias)
|
||||
post request, and allow to edit alias
|
||||
|
||||
disallow to add duplicate vlans or alias
|
||||
|
||||
listing existing devices
|
||||
get /device/
|
||||
SELECT * FROM `radusergroup`
|
||||
and then
|
||||
SELECT * FROM `customers`
|
||||
return mac address, groupname and status
|
||||
|
||||
adding new device
|
||||
this input feils are
|
||||
'
|
||||
POST /device/add with mac address and group and it involves few Commands
|
||||
`
|
||||
SELECT * FROM `radgroupreply`
|
||||
# and see if the group in the device add command exists
|
||||
# respond 4xx (whatever needed with reason group not found)
|
||||
# else continue
|
||||
|
||||
INSERT INTO `radcheck` (`username`, `attribute`, `op`, `value`)
|
||||
VALUES ('14-99-3E-74-CB-7F', 'Cleartext-Password', ':=', '14-99-3E-74-CB-7F');
|
||||
|
||||
INSERT INTO `radusergroup` (`username`, `groupname`, `priority`)
|
||||
VALUES ('14-99-3E-74-CB-7F', 'staff', '1');
|
||||
|
||||
INSERT INTO `customers` (`username`, `mac_address`, `status`, `created_at`)
|
||||
VALUES ('14-99-3E-74-CB-7F', '14-99-3E-74-CB-7F', 'paid', now());
|
||||
`
|
||||
|
||||
deleting existing deivce
|
||||
edit existing device (input macaddress, edit groupname, edit status. do allow to edit just 1 feild)
|
||||
use sesnible commands based on add devices
|
||||
|
||||
i would also like a device alias, added to customers table like
|
||||
"Customer name, device name, phone number"
|
||||
these are to be ignored by radius server, but helpful for human review
|
||||
and add input fields during adding device and also listing devices
|
||||
+3
-8
@@ -1,8 +1,3 @@
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: .build/dev
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
ports:
|
||||
- 5173:5173
|
||||
include:
|
||||
- frontend/compose.yml
|
||||
- backend/compose.yml
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: .build/dev
|
||||
dockerfile: frontend.Dockerfile
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
ports:
|
||||
- 5173:5173
|
||||
env_file:
|
||||
- .env
|
||||
Reference in New Issue
Block a user