145 lines
3.6 KiB
Markdown
145 lines
3.6 KiB
Markdown
# 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
|
|
```bash
|
|
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
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
### 3. Install osTicket
|
|
|
|
1. Navigate to `http://your-domain`
|
|
2. Follow installation wizard
|
|
3. Database settings:
|
|
- Host: `mysql`
|
|
- Database: (from .env)
|
|
- User: (from .env)
|
|
- Password: (from .env)
|
|
|
|
### 4. Configure API Key
|
|
|
|
1. Login to osTicket admin panel
|
|
2. Go to **Admin Panel** → **Manage** → **API Keys**
|
|
3. Click **Add New API Key**:
|
|
- IP Address: `172.20.0.30` (mailserver IP)
|
|
- Can Create Tickets: ✓ Checked
|
|
- Status: Active
|
|
4. Copy the API key to `.env` as `OSTICKET_API_KEY`
|
|
5. Restart: `docker-compose restart mailserver`
|
|
|
|
### 5. Create Email Account
|
|
```bash
|
|
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
|
|
```bash
|
|
# 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
|
|
```bash
|
|
docker-compose ps
|
|
docker logs ost-apache
|
|
docker logs ost-mysql
|
|
docker logs ost-mailserver
|
|
```
|
|
|
|
### Reset Installation
|
|
|
|
⚠️ **WARNING**: This deletes ALL data!
|
|
```bash
|
|
./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 `.env` file
|
|
- 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]
|