Files
lunchtime-web/README.md
T
simandClaude Sonnet 5.5 9d80e6d06e
Build and Push Lunchtime Images (Kaniko) / build-and-push (push) Successful in 7m9s
Add scheduled backups of database and uploads
The backend now writes a timestamped tar.gz of the SQLite snapshot and all
per-order files to BACKUP_DIR on a cron schedule (default 03:00), keeps the
newest BACKUP_KEEP archives, and catches up once on start if a slot was
missed. Configurable via BACKUP_CRON / BACKUP_KEEP / BACKUP_DIR / TZ.
Includes user-facing restore docs in docs/backups.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 22:31:28 +00:00

115 lines
3.0 KiB
Markdown

# Lunchtime
Lunchtime is a self-hosted lunch order app with a React frontend, a Python backend, and nginx for reverse proxying.
## Getting Started
1. Copy and adjust `config.yaml` for your environment.
2. Create a writable data folder (for SQLite and uploads), for example `.data`.
3. Start the stack with Docker Compose.
Example `compose.yml` (inspired by `src/compose.yml`) using images from the Gitea registry:
```yaml
services:
nginx:
image: nginx:alpine
ports:
- "8080:8080"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- backend
- frontend
restart: unless-stopped
backend:
image: git.sgruber.at/lunchtime/lunchtime-web:backend-latest
volumes:
- ./.data:/app/data
- ./.backups:/app/backups
- ./config.yaml:/app/config.yaml:ro
environment:
- APP_ENV=production
- LOG_LEVEL=info
- DB_PATH=/app/data
- TZ=Europe/Vienna # backup schedule follows this timezone
restart: unless-stopped
frontend:
image: git.sgruber.at/lunchtime/lunchtime-web:frontend-latest
restart: unless-stopped
```
Then run:
```bash
docker compose up -d
```
Open `http://localhost:8020`.
## Backups
The backend writes a nightly archive of the database and all uploaded files to `/app/backups` (mount it, as above). Schedule, retention and restore steps: [docs/backups.md](docs/backups.md).
## Development
### Quick Start with Docker Compose
Use the development compose file to run the full stack with hot reload:
```bash
cd src
docker compose up -d
```
This will start the backend and frontend, proxied through Nginx at `http://localhost:8020`. Also, a Mailpit instance at `http://localhost:8025` can be used for monitoring outgoing mail.
To use the same setup from VS Code, run `Dev Containers: Reopen in Container`. The devcontainer starts the full Compose stack, including Mailpit. Backend changes reload through Uvicorn and frontend changes are served through Vite HMR.
### Backend Development
The backend is a FastAPI application using SQLite and runs on Python 3.12.
**Dockerfile**: `src/backend/Containerfile` - Production build
**Development**:
```bash
cd src/backend
pip install -r requirements.txt
uvicorn app.main:app --reload
```
Changes to `app/` are automatically detected when running with `--reload`.
### Frontend Development
The frontend is a React + TypeScript application using Vite.
**Dockerfile**:
- `src/frontend/Containerfile`: Multi-target build with `dev` and `prod` stages
Use the `dev` target for hot reload and the `prod` target for the static production image.
**Development**:
```bash
cd src/frontend
npm install
npm run dev
```
Open `http://localhost:5173` (or the address shown in the terminal).
## Contributing
Contributions are welcome! Please follow these guidelines:
1. **Choose an existing issue** or create one first to discuss your changes
2. **Fork the repository** and create a feature branch
3. **Test your changes** in the development environment using `compose.yml`
4. **Submit a pull request** linking to the related issue