deploy
This commit is contained in:
@@ -11,6 +11,8 @@ COPY backend/requirements.txt .
|
|||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
COPY backend/ .
|
COPY backend/ .
|
||||||
COPY --from=frontend-builder /app/frontend/dist /app/dist
|
COPY --from=frontend-builder /app/frontend/dist /app/dist
|
||||||
|
RUN chmod +x entrypoint.sh
|
||||||
RUN mkdir -p uploads
|
RUN mkdir -p uploads
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|||||||
49
README.md
49
README.md
@@ -66,10 +66,53 @@ Frontend will be available at: http://localhost:5173
|
|||||||
|
|
||||||
## Demo Accounts
|
## Demo Accounts
|
||||||
|
|
||||||
After seeding the database:
|
After seeding the database (runs automatically on container start):
|
||||||
|
|
||||||
- **Admin:** admin@example.com / adminpassword
|
| Email | Password | Role |
|
||||||
- **User:** user@example.com / userpassword
|
|-------|----------|------|
|
||||||
|
| admin@example.com | adminpassword | Superadmin |
|
||||||
|
| manager@example.com | managerpassword | Manager |
|
||||||
|
| user@example.com | userpassword | User |
|
||||||
|
|
||||||
|
## Docker Compose (local)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create .env from template
|
||||||
|
cp backend/.env.example backend/.env
|
||||||
|
# Edit .env with your values
|
||||||
|
|
||||||
|
# Start all services
|
||||||
|
docker compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
Frontend: http://localhost
|
||||||
|
Backend API: http://localhost:8000/docs
|
||||||
|
|
||||||
|
## Deploy (Dokploy)
|
||||||
|
|
||||||
|
```
|
||||||
|
Dokploy UI → New Service → Docker Compose → Git: space-booking repo
|
||||||
|
```
|
||||||
|
|
||||||
|
### Environment Variables (Dokploy → Environment tab)
|
||||||
|
|
||||||
|
| Variable | Required | Example |
|
||||||
|
|----------|----------|---------|
|
||||||
|
| `SECRET_KEY` | **Yes** | `python -c "import secrets; print(secrets.token_hex(32))"` |
|
||||||
|
| `FRONTEND_URL` | **Yes** | `https://space.roa.romfast.ro` |
|
||||||
|
| `SMTP_ENABLED` | No | `true` |
|
||||||
|
| `SMTP_HOST` | No* | `smtp.example.com` |
|
||||||
|
| `SMTP_PORT` | No* | `587` |
|
||||||
|
| `SMTP_USER` | No* | `user@example.com` |
|
||||||
|
| `SMTP_PASSWORD` | No* | `secret` |
|
||||||
|
| `SMTP_FROM_ADDRESS` | No* | `rezervari@romfast.ro` |
|
||||||
|
|
||||||
|
*Required only if `SMTP_ENABLED=true`
|
||||||
|
|
||||||
|
### Auto-seed
|
||||||
|
|
||||||
|
`entrypoint.sh` runs `seed_db.py` automatically on every container start.
|
||||||
|
The script is idempotent — skips if data already exists.
|
||||||
|
|
||||||
## Development Commands
|
## Development Commands
|
||||||
|
|
||||||
|
|||||||
@@ -25,3 +25,13 @@ FRONTEND_URL=http://localhost:5173
|
|||||||
GOOGLE_CLIENT_ID=your_google_client_id_here
|
GOOGLE_CLIENT_ID=your_google_client_id_here
|
||||||
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
|
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
|
||||||
GOOGLE_REDIRECT_URI=http://localhost:8000/api/integrations/google/callback
|
GOOGLE_REDIRECT_URI=http://localhost:8000/api/integrations/google/callback
|
||||||
|
|
||||||
|
# === PRODUCTION (Dokploy) ===
|
||||||
|
# SECRET_KEY=<python -c "import secrets; print(secrets.token_hex(32))">
|
||||||
|
# FRONTEND_URL=https://space.roa.romfast.ro
|
||||||
|
# SMTP_ENABLED=true
|
||||||
|
# SMTP_HOST=smtp.example.com
|
||||||
|
# SMTP_PORT=587
|
||||||
|
# SMTP_USER=user@example.com
|
||||||
|
# SMTP_PASSWORD=parola
|
||||||
|
# SMTP_FROM_ADDRESS=rezervari@romfast.ro
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN chmod +x entrypoint.sh
|
||||||
|
|
||||||
RUN mkdir -p uploads
|
RUN mkdir -p uploads
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|||||||
6
backend/entrypoint.sh
Normal file
6
backend/entrypoint.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
echo "[entrypoint] Running database seed..."
|
||||||
|
python seed_db.py
|
||||||
|
echo "[entrypoint] Starting application..."
|
||||||
|
exec "$@"
|
||||||
@@ -11,6 +11,9 @@ services:
|
|||||||
- SMTP_HOST=${SMTP_HOST:-localhost}
|
- SMTP_HOST=${SMTP_HOST:-localhost}
|
||||||
- SMTP_PORT=${SMTP_PORT:-1025}
|
- SMTP_PORT=${SMTP_PORT:-1025}
|
||||||
- SMTP_ENABLED=${SMTP_ENABLED:-false}
|
- SMTP_ENABLED=${SMTP_ENABLED:-false}
|
||||||
|
- SMTP_USER=${SMTP_USER:-}
|
||||||
|
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
|
||||||
|
- SMTP_FROM_ADDRESS=${SMTP_FROM_ADDRESS:-noreply@space-booking.local}
|
||||||
volumes:
|
volumes:
|
||||||
- backend_data:/data
|
- backend_data:/data
|
||||||
- uploads_data:/app/uploads
|
- uploads_data:/app/uploads
|
||||||
|
|||||||
Reference in New Issue
Block a user