Production:

1. Copy `.env.example` to `.env` and put the real values for:

POSTGRES_PASSWORD / TICKET_PG_PASSWORD
TICKET_MYSQL_HOST, TICKET_MYSQL_PORT, TICKET_MYSQL_DATABASE, TICKET_MYSQL_USER, TICKET_MYSQL_PASSWORD
TICKET_TELEGRAM_TOKEN, TICKET_ADMIN_ID, TICKET_ENABLE_NOTIFICATIONS
TICKET_WEB_ADMIN_USERNAME, TICKET_WEB_ADMIN_PASSWORD



2. Start everything:

docker compose up -d --build

3. Open the web ticket console:

http://<server-ip>:8080

The web UI is an Angular Material app served by FastAPI. It can approve Telegram users, manage filters and notification settings in PostgreSQL, search the AI index in PostgreSQL, and browse ticket details from MySQL with read-only SELECT queries.

4. Build or refresh the AI index from MySQL into Postgres:

docker compose run --rm bot python api/ai_index.py 2000

Useful production commands:

docker compose logs -f bot
docker compose logs -f web
docker compose restart bot
docker compose restart web
docker compose ps

The bot creates the required PostgreSQL tables automatically on startup.
The web service also verifies the required PostgreSQL tables on startup.

Build or refresh the AI index from the local MySQL copy into the local PostgreSQL DB:

docker run --rm --network host fis python api/ai_index.py 2000

Telegram command documentation:

COMMANDS.md

Run the bot:

docker run -it -d --restart always --network host --name c-ticket \
  -e TICKET_TELEGRAM_TOKEN=<telegram-token> \
  -e TICKET_ADMIN_ID=<your-telegram-user-id> \
  fis

For local manual testing without the automatic 30-second notification scan:

docker run --rm -it --network host --name c-ticket-local-ai \
  -e TICKET_TELEGRAM_TOKEN=<telegram-token> \
  -e TICKET_ADMIN_ID=<your-telegram-user-id> \
  -e TICKET_ENABLE_NOTIFICATIONS=false \
  fis

Default local development databases:

MySQL ticket copy: 127.0.0.1:3307 / smits / root / localpassword
PostgreSQL bot and AI DB: 127.0.0.1:5433 / ticket / postgres / localpassword

Override with environment variables when needed:

TICKET_MYSQL_HOST, TICKET_MYSQL_PORT, TICKET_MYSQL_DATABASE, TICKET_MYSQL_USER, TICKET_MYSQL_PASSWORD
TICKET_PG_HOST, TICKET_PG_PORT, TICKET_PG_DATABASE, TICKET_PG_USER, TICKET_PG_PASSWORD
TICKET_TELEGRAM_TOKEN, TICKET_ADMIN_ID, TICKET_ENABLE_NOTIFICATIONS
