3.6 KiB
3.6 KiB
osTicket Docker Setup with Email Integration
Complete Docker Compose setup for osTicket with integrated email piping via docker-mailserver.
🚀 Features
- osTicket v1.18.2 with PHP 8.2 and Apache
- MariaDB for persistent database storage
- docker-mailserver for complete email handling
- Automatic ticket creation from emails via API piping
- SSL/TLS support with Let's Encrypt certificates
- Persistent volumes for data retention
📋 Prerequisites
- Docker Engine 20.10+
- Docker Compose 2.0+
- Domain with proper DNS records (MX, A, SPF, DKIM, DMARC)
- SSL certificates (or use Let's Encrypt)
🔧 Quick Start
1. Clone & Configure
git clone https://gitea.matthu.net/matt/osticket-docker.git
cd osticket-docker
cp .env.example .env
Edit .env with your values:
- Database credentials
- Domain name
- SSL certificate paths
- Network IPs (if needed)
2. Start Services
docker-compose up -d
3. Install osTicket
- Navigate to
http://your-domain - Follow installation wizard
- Database settings:
- Host:
mysql - Database: (from .env)
- User: (from .env)
- Password: (from .env)
- Host:
4. Configure API Key
- Login to osTicket admin panel
- Go to Admin Panel → Manage → API Keys
- Click Add New API Key:
- IP Address:
172.20.0.30(mailserver IP) - Can Create Tickets: ✓ Checked
- Status: Active
- IP Address:
- Copy the API key to
.envasOSTICKET_API_KEY - Restart:
docker-compose restart mailserver
5. Create Email Account
docker exec ost-mailserver setup email add support@yourdomain.com
Enter a password when prompted.
📁 Project Structure
.
├── docker-compose.yml # Service orchestration
├── apache.dockerfile # Custom Apache/PHP image
├── .env # Environment variables (not in git)
├── .env.example # Template for .env
├── reset-ost.sh # Reset script (⚠️ deletes all data)
├── osTicket-v1.18.2/ # osTicket application
├── mariadb/ # Database storage (persistent)
└── docker-data/
└── dms/
├── config/
│ ├── user-patches.sh # Postfix configuration
│ └── scripts/
│ └── pipe-to-osticket.sh # Email→API bridge
├── mail-data/ # Mail storage (persistent)
├── mail-state/ # Mail state (persistent)
└── mail-logs/ # Mail logs
🔍 Troubleshooting
Check Email Piping
# View pipe logs
docker exec ost-mailserver cat /tmp/osticket-pipe.log
# View mail server logs
docker exec ost-mailserver tail -f /var/log/mail/mail.log
# Send test email
docker exec ost-mailserver sendmail support@yourdomain.com <<EOF
Subject: Test Ticket
From: test@example.com
This is a test.
EOF
Check Service Health
docker-compose ps
docker logs ost-apache
docker logs ost-mysql
docker logs ost-mailserver
Reset Installation
⚠️ WARNING: This deletes ALL data!
./reset-ost.sh
docker-compose down
docker-compose up -d
🌐 Network Configuration
Services communicate on 172.20.0.0/16:
- Apache:
172.20.0.10:80 - MySQL:
172.20.0.20:3306 - Mailserver:
172.20.0.30(25, 465, 587, 993)
🔐 Security Notes
- Never commit
.envfile - Change all default passwords
- Keep API key secure
- Restrict API by IP (172.20.0.30)
- Use strong passwords for email accounts
- Keep osTicket and containers updated
📄 License
[Add your license here]