docs: update README and Copilot instructions for new DB init workflow
Replace placeholder clone URL with actual repo URL: https://github.com/RobbStarkAustria/infoscreen_2025.git Add first-run step to initialize the database using the one-shot script: python server/initialize_database.py Mention initialize_database.py in project structure Add a one-shot DB init command to the “Database Management” section Update Copilot instructions: Prefer initialize_database.py for local dev (migrations + defaults + academic periods) Note legacy init scripts were removed; use Alembic + initialize_database.py going forward No runtime/code changes; documentation only
This commit is contained in:
4
.github/copilot-instructions.md
vendored
4
.github/copilot-instructions.md
vendored
@@ -73,7 +73,8 @@ Note: Syncfusion usage in the dashboard is already documented above; if a UI for
|
|||||||
- Mosquitto: allows anonymous in dev; WebSocket on :9001.
|
- Mosquitto: allows anonymous in dev; WebSocket on :9001.
|
||||||
- Common env vars: `DB_CONN`, `DB_USER`, `DB_PASSWORD`, `DB_HOST=db`, `DB_NAME`, `ENV`, `MQTT_USER`, `MQTT_PASSWORD`.
|
- Common env vars: `DB_CONN`, `DB_USER`, `DB_PASSWORD`, `DB_HOST=db`, `DB_NAME`, `ENV`, `MQTT_USER`, `MQTT_PASSWORD`.
|
||||||
- Alembic: prod compose runs `alembic ... upgrade head` and `server/init_defaults.py` before gunicorn.
|
- Alembic: prod compose runs `alembic ... upgrade head` and `server/init_defaults.py` before gunicorn.
|
||||||
- Use `server/init_academic_periods.py` to populate default Austrian school years after migration.
|
- Local dev: prefer `python server/initialize_database.py` for one-shot setup (migrations + defaults + academic periods).
|
||||||
|
- `server/init_academic_periods.py` remains available to (re)seed school years.
|
||||||
|
|
||||||
## Production
|
## Production
|
||||||
- `docker-compose.prod.yml` uses prebuilt images (`ghcr.io/robbstarkaustria/*`).
|
- `docker-compose.prod.yml` uses prebuilt images (`ghcr.io/robbstarkaustria/*`).
|
||||||
@@ -100,6 +101,7 @@ Note: Syncfusion usage in the dashboard is already documented above; if a UI for
|
|||||||
4) Return JSON-safe values (serialize enums and datetimes).
|
4) Return JSON-safe values (serialize enums and datetimes).
|
||||||
- When extending media types, update `MediaType` and any logic in `eventmedia` and dashboard that depends on it.
|
- When extending media types, update `MediaType` and any logic in `eventmedia` and dashboard that depends on it.
|
||||||
- Academic periods: Events/media can be optionally associated with periods for educational organization. Only one period should be active at a time (`is_active=True`).
|
- Academic periods: Events/media can be optionally associated with periods for educational organization. Only one period should be active at a time (`is_active=True`).
|
||||||
|
- Initialization scripts: legacy DB init scripts were removed; use Alembic and `initialize_database.py` going forward.
|
||||||
|
|
||||||
## Quick examples
|
## Quick examples
|
||||||
- Add client description persists to DB and publishes group via MQTT: see `PUT /api/clients/<uuid>/description` in `routes/clients.py`.
|
- Add client description persists to DB and publishes group via MQTT: see `PUT /api/clients/<uuid>/description` in `routes/clients.py`.
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -82,7 +82,7 @@ A comprehensive multi-service digital signage solution for educational instituti
|
|||||||
|
|
||||||
1. **Clone the repository**
|
1. **Clone the repository**
|
||||||
```bash
|
```bash
|
||||||
git clone <repository-url>
|
git clone https://github.com/RobbStarkAustria/infoscreen_2025.git
|
||||||
cd infoscreen_2025
|
cd infoscreen_2025
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -98,7 +98,13 @@ A comprehensive multi-service digital signage solution for educational instituti
|
|||||||
# or: docker compose up -d --build
|
# or: docker compose up -d --build
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Access the services**
|
4. **Initialize the database (first run only)**
|
||||||
|
```bash
|
||||||
|
# One-shot: runs all Alembic migrations, creates default admin/group, and seeds academic periods
|
||||||
|
python server/initialize_database.py
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Access the services**
|
||||||
- Dashboard: http://localhost:5173
|
- Dashboard: http://localhost:5173
|
||||||
- API: http://localhost:8000
|
- API: http://localhost:8000
|
||||||
- Database: localhost:3306
|
- Database: localhost:3306
|
||||||
@@ -177,6 +183,7 @@ infoscreen_2025/
|
|||||||
│ ├── routes/ # API endpoints
|
│ ├── routes/ # API endpoints
|
||||||
│ ├── alembic/ # Database migrations
|
│ ├── alembic/ # Database migrations
|
||||||
│ ├── media/ # File storage
|
│ ├── media/ # File storage
|
||||||
|
│ ├── initialize_database.py # All-in-one DB initialization (dev)
|
||||||
│ └── worker.py # Background jobs
|
│ └── worker.py # Background jobs
|
||||||
├── listener/ # MQTT listener service
|
├── listener/ # MQTT listener service
|
||||||
├── scheduler/ # Event scheduling service
|
├── scheduler/ # Event scheduling service
|
||||||
@@ -213,6 +220,9 @@ make fix-perms # Fix file permissions
|
|||||||
### Database Management
|
### Database Management
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# One-shot initialization (schema + defaults + academic periods)
|
||||||
|
python server/initialize_database.py
|
||||||
|
|
||||||
# Access database directly
|
# Access database directly
|
||||||
docker exec -it infoscreen-db mysql -u${DB_USER} -p${DB_PASSWORD} ${DB_NAME}
|
docker exec -it infoscreen-db mysql -u${DB_USER} -p${DB_PASSWORD} ${DB_NAME}
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Script to connect this workspace to your existing GitHub repository
|
|
||||||
|
|
||||||
echo "🔗 Connecting workspace to GitHub repository..."
|
|
||||||
echo "================================================="
|
|
||||||
|
|
||||||
# Check if repository name is provided
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "❌ Error: Repository name required"
|
|
||||||
echo ""
|
|
||||||
echo "Usage: $0 <repository-name>"
|
|
||||||
echo ""
|
|
||||||
echo "Examples:"
|
|
||||||
echo " $0 infoscreen_2025"
|
|
||||||
echo " $0 infoscreen-2025"
|
|
||||||
echo " $0 infoscreen_server_2025"
|
|
||||||
echo ""
|
|
||||||
echo "Your GitHub username appears to be: robbstarkaustria"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
REPO_NAME="$1"
|
|
||||||
GITHUB_USER="robbstarkaustria"
|
|
||||||
REPO_URL="https://github.com/${GITHUB_USER}/${REPO_NAME}.git"
|
|
||||||
|
|
||||||
echo "Repository: ${REPO_URL}"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Add the remote origin
|
|
||||||
echo "🔄 Adding remote origin..."
|
|
||||||
git remote add origin "$REPO_URL"
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "✅ Remote origin added successfully"
|
|
||||||
else
|
|
||||||
echo "⚠️ Remote might already exist, removing and re-adding..."
|
|
||||||
git remote remove origin 2>/dev/null
|
|
||||||
git remote add origin "$REPO_URL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Show current remotes
|
|
||||||
echo ""
|
|
||||||
echo "📋 Current remotes:"
|
|
||||||
git remote -v
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "🔄 Fetching from remote repository..."
|
|
||||||
git fetch origin
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "🔄 Setting upstream and pushing..."
|
|
||||||
git branch --set-upstream-to=origin/main main
|
|
||||||
|
|
||||||
# Try to push (might require authentication)
|
|
||||||
echo ""
|
|
||||||
echo "🚀 Pushing to GitHub..."
|
|
||||||
echo "Note: You may need to authenticate with GitHub"
|
|
||||||
git push -u origin main
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "🎉 Successfully connected and pushed to GitHub!"
|
|
||||||
echo "Repository URL: https://github.com/${GITHUB_USER}/${REPO_NAME}"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ Push failed. This might be because:"
|
|
||||||
echo "1. You need to authenticate with GitHub"
|
|
||||||
echo "2. The repository doesn't exist"
|
|
||||||
echo "3. You don't have push permissions"
|
|
||||||
echo ""
|
|
||||||
echo "Try running: git push -u origin main"
|
|
||||||
echo "Or use GitHub CLI: gh auth login"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user