-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.example.yml
More file actions
170 lines (149 loc) · 6.39 KB
/
docker-compose.example.yml
File metadata and controls
170 lines (149 loc) · 6.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Contactly - Docker Compose Configuration Example
#
# Copy this file to docker-compose.yml and fill in your credentials.
# This is the recommended setup for end users deploying the contacts sync service.
#
# Quick Start:
# 1. Copy this file: cp docker-compose.example.yml docker-compose.yml
# 2. Follow GOOGLE_AUTH_SETUP.md to get Google credentials
# 3. Follow ICLOUD_AUTH_SETUP.md to get iCloud app-specific password
# 4. Edit docker-compose.yml with your actual credentials
# 5. Run: docker-compose up -d
#
# For detailed instructions, see README.md
version: '3.8'
services:
contacts-sync:
# Use the latest stable release from GitHub Container Registry
# Alternative tags:
# - ghcr.io/aayusharyan/contactly:nightly (latest development build)
# - ghcr.io/aayusharyan/contactly:1.2.3 (specific version)
image: ghcr.io/aayusharyan/contactly:latest
container_name: contactly
restart: unless-stopped
environment:
# ============================================================================
# iCloud Configuration
# ============================================================================
# Follow ICLOUD_AUTH_SETUP.md to generate an app-specific password
# Your Apple ID email address
ICLOUD_USERNAME: "your-email@icloud.com"
# App-specific password (NOT your main iCloud password)
# Follow ICLOUD_AUTH_SETUP.md for step-by-step guide
ICLOUD_APP_PASSWORD: "xxxx-xxxx-xxxx-xxxx"
# ============================================================================
# Google OAuth Configuration
# ============================================================================
# Follow GOOGLE_AUTH_SETUP.md to get these three values
# You'll use Google OAuth Playground (no Python/scripts needed)
# From your credentials.json file
GOOGLE_CLIENT_ID: "123456789-abcdefghijklmnop.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET: "GOCSPX-your_client_secret_here"
# From Google OAuth Playground
GOOGLE_REFRESH_TOKEN: "1//your_refresh_token_here"
# ============================================================================
# PBX Database Configuration
# ============================================================================
# Your MySQL/MariaDB database connection details
# The service will create/update the pbx_cnam table
PBX_DB_HOST: "192.168.1.100" # MySQL server IP or hostname
PBX_DB_PORT: "3306" # MySQL port (default: 3306)
PBX_DB_NAME: "asterisk" # Database name (usually: asterisk)
PBX_DB_USER: "asterisk" # Database user
PBX_DB_PASSWORD: "your_mysql_password" # Database password
# ============================================================================
# Optional Configuration
# ============================================================================
# Phone number region for normalization (ISO 3166-1 alpha-2 country code)
# Examples: US, GB, CA, AU, DE, FR, IN
DEFAULT_PHONE_REGION: "US"
# How often to sync contacts (in hours)
# Default: 6 hours (recommended for staying within API limits)
SYNC_INTERVAL_HOURS: "6"
# Logging level: DEBUG, INFO, WARNING, ERROR
# Use INFO for production, DEBUG for troubleshooting
LOG_LEVEL: "INFO"
volumes:
# Persistent storage for sync state and internal database
# This volume stores:
# - SQLite database with sync cursors and canonical contacts
# - Sync state to enable incremental updates
# DO NOT delete this volume unless you want to start fresh
- contactly-data:/app/data
# Optional: Resource limits to prevent container from consuming too much
# Uncomment and adjust based on your contact count and system resources
# deploy:
# resources:
# limits:
# cpus: '0.5' # Max 50% of one CPU core
# memory: 512M # Max 512MB RAM
# reservations:
# cpus: '0.25' # Guaranteed 25% of one CPU core
# memory: 256M # Guaranteed 256MB RAM
# Optional: Health check to monitor container status
# Uncomment to enable automatic health monitoring
# healthcheck:
# test: ["CMD", "python", "-c", "import sqlite3; sqlite3.connect('/app/data/contacts_sync.db').execute('SELECT 1')"]
# interval: 30s
# timeout: 10s
# retries: 3
# start_period: 10s
# Volumes definition
volumes:
contactly-data:
driver: local
# Optional: Specify a custom mount point on the host
# Uncomment to store data in a specific location
# driver_opts:
# type: none
# device: /path/on/host/contactly-data
# o: bind
# Optional: Networks configuration
# Uncomment if you need to connect to other containers or custom networks
# networks:
# default:
# name: pbx-network
# external: true # Use existing network
# ============================================================================
# Security Best Practices
# ============================================================================
#
# 1. Never commit docker-compose.yml with real credentials to version control
# Add docker-compose.yml to .gitignore if using this file directly
#
# 2. For production, use Docker secrets instead of environment variables:
# secrets:
# google_refresh_token:
# external: true
# Then reference: GOOGLE_REFRESH_TOKEN: /run/secrets/google_refresh_token
#
# 3. Use a dedicated MySQL user with minimal permissions:
# GRANT SELECT, INSERT, UPDATE, DELETE ON asterisk.pbx_cnam TO 'contactly'@'%';
#
# 4. Enable MySQL SSL/TLS for remote connections
#
# 5. Regularly rotate your iCloud app-specific password and Google refresh token
#
# ============================================================================
# Troubleshooting
# ============================================================================
#
# View logs:
# docker-compose logs -f contacts-sync
#
# Check container status:
# docker-compose ps
#
# Restart the service:
# docker-compose restart contacts-sync
#
# Run a manual sync:
# docker-compose exec contacts-sync python -m src.cli.sync
#
# Access the internal database:
# docker-compose exec contacts-sync sqlite3 /app/data/contacts_sync.db
#
# For more help, see:
# - README.md - Quick start guide
# - GOOGLE_AUTH_SETUP.md - Google OAuth setup
# - ICLOUD_AUTH_SETUP.md - iCloud app-specific password