Files
malias-web/DOCKER.md

141 lines
2.8 KiB
Markdown

# Docker Quick Start Guide
## Prerequisites
- Docker installed on your system
- Docker Compose installed (usually comes with Docker Desktop)
## Quick Start
### 1. Start the application
```bash
docker-compose up -d
```
This will:
- Build the Docker image (first time only)
- Start the container in detached mode
- Create the `data` directory for the database
- Expose port 5172
### 2. Access the application
Open your browser and navigate to:
- Local: `http://localhost:5172`
- Network: `http://YOUR_SERVER_IP:5172`
### 3. Login
Default credentials:
- Password: `admin123`
**Important**: Change this password immediately after first login!
### 4. Configure Mailcow
1. Click "Configuration"
2. Enter your Mailcow server (without https://)
3. Enter your Mailcow API key
4. Click "Save Mailcow Config"
5. Click "Change Password" and set a secure password
### 5. Sync aliases
Click "Sync Aliases" to import your existing aliases from Mailcow.
## Common Commands
### View logs
```bash
docker-compose logs -f
```
### Stop the application
```bash
docker-compose down
```
### Restart the application
```bash
docker-compose restart
```
### Update after code changes
```bash
docker-compose up -d --build
```
### Remove everything (including data)
```bash
docker-compose down -v
rm -rf data/
```
## Data Persistence
The `./data` directory is mounted as a volume, containing:
- `malias2.db` - Your aliases database and configuration
- `malias2.log` - Application logs
This directory persists across container restarts and updates.
## Troubleshooting
### Container won't start
Check logs:
```bash
docker-compose logs mailcow-alias-manager
```
### Port already in use
Edit `docker-compose.yml` and change the port mapping:
```yaml
ports:
- "8080:5172" # Change 8080 to any available port
```
### Can't connect to Mailcow server
Make sure your Mailcow server is accessible from the Docker container. If Mailcow is running on `localhost`, you may need to use `host.docker.internal` instead.
### Reset to defaults
```bash
docker-compose down
rm -rf data/
docker-compose up -d
```
## Updating
To update to a new version:
1. Pull the latest code:
```bash
git pull
```
2. Rebuild and restart:
```bash
docker-compose up -d --build
```
Your data in the `./data` directory will be preserved.
## Security Notes
- Change the default password immediately
- The application is designed for internal networks
- For external access, use a reverse proxy with HTTPS (nginx, Traefik, etc.)
- Consider using Docker secrets for sensitive data in production
## Network Access
To access from other devices on your network:
1. Find your server's IP address
2. Access via `http://YOUR_IP:5172`
3. Make sure your firewall allows connections on port 5172
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.