unifi-access-airbnb/README-DOCKER.md

99 lines
2.6 KiB
Markdown

# Docker Setup for UniFi Access Airbnb Integration
## Quick Start
1. **Build and run continuously** (checks every 6 hours):
```bash
docker-compose up -d
```
2. **Run once manually**:
```bash
docker-compose --profile manual up unifi-access-airbnb-once
```
3. **View logs**:
```bash
docker-compose logs -f
# Or check the logs directory: ./logs/unifi_access_airbnb.log
```
## Configuration
- **Config file**: Edit `unifi.conf` on the host - it's mounted read-only into the container
- **Logs**: Persistent in `./logs/` directory
- **Timezone**: Set in docker-compose.yml (default: America/New_York)
## Automation Options
### Option 1: Continuous Container (Recommended)
```bash
docker-compose up -d
```
Runs every 6 hours automatically. Change interval by modifying `sleep 21600` in docker-compose.yml.
### Option 2: Cron Job + Manual Container
```bash
# Add to crontab to run daily at 8 AM:
0 8 * * * cd /path/to/project && docker-compose --profile manual up unifi-access-airbnb-once
```
### Option 3: Windows Task Scheduler
Create a scheduled task that runs:
```cmd
docker-compose --profile manual up unifi-access-airbnb-once
```
## Commands
- **Stop**: `docker-compose down`
- **Rebuild**: `docker-compose build`
- **View container status**: `docker-compose ps`
- **Interactive shell**: `docker-compose exec unifi-access-airbnb sh`
## Raspberry Pi Deployment
### Compatibility
**Raspberry Pi 4/5** (ARM64) - Full support
**Raspberry Pi 3B+** (ARM32/ARMv7) - Full support
**Raspberry Pi Zero 2 W** (ARM64) - Works but slower
### Pi-Specific Setup
```bash
# 1. Install Docker (if not already installed)
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
# 2. Install docker-compose
sudo apt update
sudo apt install docker-compose-plugin
# 3. Clone and run your project
git clone <your-repo>
cd unifi-access-airbnb
docker-compose up -d
```
### Performance Notes
- **Pi 4/5**: Excellent performance, recommended for production
- **Pi 3B+**: Good performance, slightly slower container startup
- **Pi Zero 2**: Functional but slower, consider running less frequently
### Power Management
For reliable operation on Pi:
```yaml
# Add to docker-compose.yml services section:
restart: always
deploy:
resources:
limits:
memory: 128M
```
## Troubleshooting
- **Check logs**: `docker-compose logs unifi-access-airbnb`
- **Test config**: `docker-compose --profile manual up unifi-access-airbnb-once`
- **Network issues**: Ensure container can reach UniFi controller IP (10.0.1.20)
- **Pi-specific**: Check `docker --version` and ensure Docker is running: `sudo systemctl status docker`