Replaced env variable DATABASE_PATH with DATA_PATH and DATABASE_FILENAME

This commit is contained in:
2025-05-05 16:56:03 -05:00
parent 2be8865537
commit f062f72017
5 changed files with 61 additions and 21 deletions

View File

@@ -54,10 +54,13 @@ You can install and run the project either manually or using Docker.
```env
SUPER_ADMIN_USER=your_super_admin_username
SUPER_ADMIN_PASSWORD=your_super_admin_password
DATABASE_PATH=data/users.db
DATABASE_FILENAME=users.db
DATA_PATH=/data
CONTENT_PATH=/content
```
Note: The `DATABASE_PATH` uses a relative path. For persistence and consistency, it's recommended to use an absolute path or ensure the volume mount covers this path if using Docker. The `utils/database.py` script will attempt to create the directory `data` if it doesn't exist relative to where the script is run.
**Important Notes:**
* For Docker deployments, paths should match volume mounts from the `docker run` command
### Docker Installation
@@ -82,7 +85,7 @@ You can install and run the project either manually or using Docker.
### Running Manually
1. Ensure you have activated the virtual environment (if installed manually).
2. Ensure your environment variables (`SUPER_ADMIN_USER`, `SUPER_ADMIN_PASSWORD`, `DATABASE_PATH`) are set.
2. Ensure your environment variables (`SUPER_ADMIN_USER`, `SUPER_ADMIN_PASSWORD`, `DATABASE_FILENAME`, `DATA_PATH`, `CONTENT_PATH`) are set.
3. Run the application using uvicorn:
```bash
@@ -103,15 +106,33 @@ You can install and run the project either manually or using Docker.
--name user-service \
-p 8000:8000 \
-v user-service-data:/data \
-v user-service-content:/content \
-e SUPER_ADMIN_USER=your_super_admin_username \
-e SUPER_ADMIN_PASSWORD=your_super_admin_password \
user-registration-service
iptv-server
```
Replace `your_super_admin_username` and `your_super_admin_password` with your desired credentials. The `-v user-service-data:/data` maps a Docker volume for persistent storage of the SQLite database defined by `DATABASE_PATH=/data/users.db` in the Dockerfile.
Replace `your_super_admin_username` and `your_super_admin_password` with your desired credentials.
Key components:
* `-v user-service-data:/data` creates/manages a Docker volume for persistent database storage
* `-v user-service-content:/content` ensures content directory persistence
* Environment variables match those expected by the application (defined in Dockerfile)
The application will be available at `http://localhost:8000` (or your Docker host's IP).
**For bind mounts instead of named volumes** (useful for development):
```bash
docker run -d \
--name user-service \
-p 8000:8000 \
-v ./local/data:/data \
-v ./local/content:/content \
-e SUPER_ADMIN_USER=admin \
-e SUPER_ADMIN_PASSWORD=securepassword \
user-registration-service
## Usage
The API documentation will be available at `http://localhost:8000/docs` (Swagger UI) or `http://localhost:8000/redoc` (ReDoc) once the server is running.