Spaces:
Paused
Paused
docs: update README with setup instructions and common commands
Browse files
README.md
CHANGED
|
@@ -10,3 +10,97 @@ short_description: AB MPI services
|
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
|
| 13 |
+
## Getting Started
|
| 14 |
+
|
| 15 |
+
### Prerequisites
|
| 16 |
+
- Python 3.13+
|
| 17 |
+
- Docker & Docker Compose
|
| 18 |
+
- Git
|
| 19 |
+
|
| 20 |
+
### Setup & Installation
|
| 21 |
+
|
| 22 |
+
#### Option 1: Using Docker Compose (Recommended)
|
| 23 |
+
```bash
|
| 24 |
+
# Navigate to the app directory
|
| 25 |
+
cd app
|
| 26 |
+
|
| 27 |
+
# Start the application with database
|
| 28 |
+
make start
|
| 29 |
+
# or
|
| 30 |
+
docker-compose -f docker/docker-compose.yml up --build
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The application will be available at `http://localhost:8000`
|
| 34 |
+
|
| 35 |
+
#### Option 2: Local Development Setup
|
| 36 |
+
|
| 37 |
+
1. **Install Python Dependencies**
|
| 38 |
+
```bash
|
| 39 |
+
pip install -r requirements.txt
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
2. **Set up Environment Variables**
|
| 43 |
+
Create a `.env` file in the root directory:
|
| 44 |
+
```
|
| 45 |
+
SQLSERVER_HOST=localhost
|
| 46 |
+
SQLSERVER_PORT=1433
|
| 47 |
+
SQLSERVER_USER=sa
|
| 48 |
+
SQLSERVER_PASSWORD=YourStrong!Passw0rd
|
| 49 |
+
SQLSERVER_DB=aquabarrier
|
| 50 |
+
SECRET_KEY=your-secret-key-here
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
3. **Start the Application**
|
| 54 |
+
```bash
|
| 55 |
+
# From the app directory
|
| 56 |
+
uvicorn app:app --reload --host 0.0.0.0 --port 8000
|
| 57 |
+
|
| 58 |
+
# for debug
|
| 59 |
+
uvicorn app.app:app --reload --port 8000 --log-level debug
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### Common Commands
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
# Run database migrations
|
| 66 |
+
make migrate
|
| 67 |
+
# or
|
| 68 |
+
alembic upgrade head
|
| 69 |
+
|
| 70 |
+
# Run linting
|
| 71 |
+
make lint
|
| 72 |
+
# or
|
| 73 |
+
ruff app/
|
| 74 |
+
|
| 75 |
+
# Run type checking
|
| 76 |
+
make typecheck
|
| 77 |
+
# or
|
| 78 |
+
mypy app/
|
| 79 |
+
|
| 80 |
+
# Run tests
|
| 81 |
+
make test
|
| 82 |
+
# or
|
| 83 |
+
pytest app/tests/unit
|
| 84 |
+
|
| 85 |
+
# Stop running containers
|
| 86 |
+
make stop
|
| 87 |
+
# or
|
| 88 |
+
docker-compose -f docker/docker-compose.yml down
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Development Workflow
|
| 92 |
+
|
| 93 |
+
1. **Access API Documentation**
|
| 94 |
+
- OpenAPI (Swagger): `http://localhost:8000/docs`
|
| 95 |
+
- ReDoc: `http://localhost:8000/redoc`
|
| 96 |
+
|
| 97 |
+
2. **Database Connection**
|
| 98 |
+
- Host: `localhost`
|
| 99 |
+
- Port: `31433` (Docker) or `1433` (Local MSSQL)
|
| 100 |
+
- Database: `aquabarrier`
|
| 101 |
+
- Username: `sa`
|
| 102 |
+
- Password: `YourStrong!Passw0rd`
|
| 103 |
+
|
| 104 |
+
3. **Logs**
|
| 105 |
+
- Docker logs: `docker-compose -f docker/docker-compose.yml logs -f app`
|
| 106 |
+
|