Files
archived-teslamate-cn-image/script/README.md
yekk 77ae7b5dd9 Feature/mytess restructure (#6)
* Restructure repository for Mytess SEO optimization

## Changes

### File Reorganization
- Move docker-compose files and images to new `script/` directory
- Create new English root README.md with Mytess showcase
- Add simplified Chinese README.zh.md as redirect
- Add comprehensive English deployment guide in script/README.md

### Docker Compose Updates
- Remove Chinese mirror sources (docker.1ms.run) from all images
- Use official Docker registry for global compatibility
- Add cache headers for Dash static assets (1-year cache)
- Configure caching for Next.js static files and PWA assets

### SEO & Documentation
- Feature Mytess prominently with screenshots and links
- Include App Store and mytess.net references
- Natural keyword integration for TeslaMate iOS/mobile searches
- Comprehensive troubleshooting and configuration guides
- Architecture diagrams for both deployment options

### Benefits
- Improved global search visibility for Mytess
- Better user experience with clear English documentation
- Performance improvements via static asset caching
- Maintained backward compatibility for existing users

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Remove emojis and add showcase images to README

## Changes

- Remove all emoji icons from both English and Chinese READMEs
- Add actual showcase images from mytess-web project
- Update feature descriptions with paired screenshots
- Include images for: drive insights, cost management, map mode, and notifications
- Maintain professional and clean documentation style

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Switch to official TeslaMate images and clarify version differences

## Changes

### Docker Compose Updates
- **Basic version (docker-compose.yml)**: Now uses official images
  - teslamate/teslamate:latest (was mytesla/teslamate:v2.2)
  - teslamate/grafana:latest (was mytesla/grafana:v2.2)
- **Mytesla version (docker-compose-with-mytesla.yml)**: Unchanged, continues using mytesla images

### Documentation Updates
- **English README**: Clarify two deployment options with clear use cases
  - Option 1: Official version for international users
  - Option 2: Mytesla optimized for China (with problem solutions listed)
- **Chinese README**: Add detailed explanation of mytesla version benefits
  - OpenStreetMap proxy solution
  - Baidu Maps support
  - Chinese localization
  - Unified authentication
- **script/README.md**: Update deployment instructions with version comparison

### Benefits
- Users can now choose between official and optimized versions
- Clear guidance on which version to use based on location
- Mytesla version value proposition clearly explained (China-specific fixes)
- Maintains flexibility for different user needs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Add Mytesla Dash licensing information

## Changes

- Add FAQ entry about Mytesla Dash license requirement
- Direct users to contact hi@mytesla.cc for licensing inquiries
- Add note in script/README.md for Mytesla Dash option
- Replace Chinese-specific licensing link with international email contact

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Use official TeslaMate/Grafana images in both configurations

## Changes

### Docker Compose Updates
Both versions now use official TeslaMate and Grafana images:
- `teslamate/teslamate:v2.2` (official)
- `teslamate/grafana:v2.2` (official)

**Basic version (docker-compose.yml)**:
- Official TeslaMate + Grafana only

**Mytesla version (docker-compose-with-mytesla.yml)**:
- Official TeslaMate + Grafana as base
- Plus Mytesla enhancement components:
  - mytesla/auth - Unified authentication
  - mytesla/dash - Modern web dashboard
  - mytesla/teslamateapi - Enhanced API
  - mytesla/env-adapter - Environment adapter

### Documentation Updates
- Update all READMEs to reflect official image usage
- Clarify that Mytesla version = Official base + Mytesla components
- Explain advantages of Mytesla components in Chinese docs
- Remove "China-specific" positioning, focus on feature benefits

### Benefits
- Both versions stay up-to-date with official TeslaMate releases
- Mytesla version provides additional value through enhancement components
- Clear separation: official base vs. enhanced features
- Users can choose based on feature needs, not geography

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Add TeslaMateAPI to basic docker-compose configuration

## Changes

### Docker Compose
- Add official TeslaMateAPI service to basic version
- Image: tobiasehlert/teslamateapi:latest
- Port: 8080 (standard TeslaMateAPI port)
- Enable API commands and token authentication
- Configure database and MQTT connections

### Documentation Updates
- Update all port references from 3030 to 8080
- Add TeslaMateAPI to basic version service list
- Update firewall instructions to include port 8080
- Clarify that basic version now supports Mytess iOS app

### Benefits
- Basic version now fully supports Mytess iOS app connectivity
- Users can choose between:
  - Basic: Separate ports (4000, 3000, 8080)
  - Mytesla: Unified port 80 with reverse proxy
- No need to use Mytesla version just for API access

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix basic version TeslaMateAPI configuration

## Changes

### Docker Compose
- Change image to mytesla/teslamateapi:latest (match with-mytesla version)
- Update port mapping to 3030:8080 (consistent with documentation)
- Align environment variables with with-mytesla version:
  - Add API_TOKEN configuration
  - Add teslamateapi-data volume
  - Add teslamate dependency
- Remove unnecessary logging configuration

### Documentation
- Update all API port references back to 3030
- Ensure consistency across all README files

### Result
- Basic version now uses same API image as Mytesla version
- Configuration is consistent and simpler
- Port 3030 is standard for TeslaMateAPI external access

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix TeslaMateAPI authentication description

## Changes

- Correct API access description from "(no auth required)" to "(requires API token)"
- TeslaMateAPI does require API_TOKEN for authentication
- Although it bypasses Traefik ForwardAuth, it still needs token validation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Remove China-specific language and TeslaMateAPI reference from English docs

## Changes

### README.md
- Remove "optimized for mainland China" from subtitle
- Replace "China-Specific Optimizations" with generic feature benefits
- Remove China-related notes about map loading issues
- Remove TeslaMateAPI GitHub link from Related Projects
- Focus on universal features: Mytess integration, modern interface

### script/README.md
- Change "recommended for China" to "recommended" (universal)
- Remove China-specific troubleshooting (Baidu Maps references)
- Use generic network troubleshooting guidance

### Rationale
- Make English documentation internationally focused
- Chinese-specific information remains in README.zh.md
- Avoid geographic positioning in global documentation
- Remove redundant API reference (already integrated in project)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Update repository URLs to new location

## Changes

- Update all git clone URLs from old repository to new location
- Old: github.com/gococonut/teslamate-cn-image
- New: github.com/yekk-me/teslamate-mytess-docker
- Update directory names in cd commands to match new repo name
- Update GitHub Issues links

### Files Updated
- README.md (English)
- README.zh.md (Chinese)
- script/README.md

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Recommend mytesla images for Chinese users and explain benefits

## Changes in README.zh.md

### Image Recommendations
- Change to recommend mytesla/teslamate:v2.2 for Chinese users
- Change to recommend mytesla/grafana:v2.2 for Chinese users
- Keep official images as "Option 1" for international users

### Added "Mytesla 镜像解决的问题" Section
Clearly explain China-specific problems solved by mytesla images:
- ✓ OpenStreetMap proxy for map loading in mainland China
- ✓ Baidu Maps geocoding integration for accurate locations
- ✓ Complete Chinese localization and pre-configured dashboards
- ✓ Network optimizations for China

### Positioning
- Chinese README now recommends mytesla images (China-optimized)
- English README uses official images (international)
- Clear value proposition for Chinese users

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix PostgreSQL data directory mount path

## Changes

- Fix database volume mount in docker-compose-with-mytesla.yml
- Change from `/var/lib/postgresql` to `/var/lib/postgresql/data`
- PostgreSQL official image stores data in `/var/lib/postgresql/data`
- Now consistent with basic version configuration

### Impact
- Ensures data is properly persisted in the correct directory
- Prevents potential data loss issues
- Matches PostgreSQL best practices

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix PostgreSQL mount and add Baidu Maps configuration guide

## Changes

### PostgreSQL Volume Mount Fix
- Remove `/data` from PostgreSQL mount paths in both files
- Correct path: `/var/lib/postgresql` (not `/var/lib/postgresql/data`)
- Applies to both docker-compose.yml and docker-compose-with-mytesla.yml

### Chinese README Enhancement
Add Baidu Maps configuration section for accurate geocoding:
- Instructions to obtain BD_MAP_AK and BD_MAP_SK
- Step-by-step guide for Chinese users
- Explains benefit: accurate Chinese location names vs English addresses
- Example configuration in teslamate service environment

### Rationale
- PostgreSQL 18 uses `/var/lib/postgresql` as data directory
- Baidu Maps improves location accuracy for Chinese users
- Solves reverse geocoding issues in mainland China

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 10:25:33 +08:00

11 KiB

TeslaMate Deployment Scripts

← Back to Main README

This directory contains Docker Compose configurations for deploying TeslaMate.

Files

  • docker-compose.yml - Official TeslaMate version (basic setup)
  • docker-compose-with-mytesla.yml - Mytesla enhanced version (recommended)
  • images/ - Dashboard screenshots

Quick Deployment

Option 1: Official Version (International Users)

Uses official TeslaMate and Grafana images.

docker compose up -d

Services included:

  • TeslaMate web interface (official)
  • PostgreSQL database
  • Grafana dashboards (official)
  • TeslaMateAPI (official - for Mytess iOS app)
  • Mosquitto MQTT broker

Best for: Users preferring separate service ports and official images only.

Official TeslaMate/Grafana with Mytesla enhancement components.

docker compose -f docker-compose-with-mytesla.yml up -d

Image composition:

  • TeslaMate: teslamate/teslamate:v2.2 (official)
  • Grafana: teslamate/grafana:v2.2 (official)
  • Mytesla components:
    • mytesla/auth - Unified authentication service
    • mytesla/dash - Modern web dashboard
    • mytesla/teslamateapi - Enhanced API (full Mytess support)
    • mytesla/env-adapter - Environment adapter

Additional features:

  • Traefik reverse proxy with unified authentication
  • Modern Mytesla Dash web interface (mobile-friendly)
  • Enhanced TeslaMateAPI with full Mytess iOS app support
  • Single-port access to all services (port 80)
  • Production-ready security architecture

Best for: Users wanting modern web interface, mobile app integration, and unified authentication.

Note: Mytesla Dash requires a one-time authorization. For licensing inquiries, contact hi@mytesla.cc.

Configuration

Required Environment Variables

Important: Change these before production deployment!

# Authentication (Mytesla Dash version)
AUTH_USERNAME=admin              # Change this!
AUTH_PASSWORD=admin123           # Change this!
SECRET_KEY=change-me-random-32   # Change this!

# TeslaMate encryption
ENCRYPTION_KEY=change-me-random  # Change this!

# Database
POSTGRES_PASSWORD=teslamate      # Change this!

# API Token (for Mytess app)
API_TOKEN=change-me-token        # Change this!

Generate Secure Random Keys

Use OpenSSL to generate secure random strings:

openssl rand -base64 32

This will output a 32-character random string. Use this for ENCRYPTION_KEY, SECRET_KEY, and API_TOKEN.

Important Notes

  • ENCRYPTION_KEY: Used to encrypt sensitive data like Tesla API tokens. If you lose this key, you cannot recover your data!
  • API_TOKEN: Used by Mytess app to authenticate with TeslaMateAPI. Must match between config and app.
  • Database Password: Change from default to prevent unauthorized access.

Architecture

Basic Version

┌─────────────────────────────────────────────────────────────┐
│                    Your Network                              │
│                                                              │
│  ┌──────────┐   ┌──────────┐   ┌──────────┐                │
│  │TeslaMate │   │ Grafana  │   │   API    │                │
│  │  :4000   │   │  :3000   │   │  :3030   │                │
│  └────┬─────┘   └────┬─────┘   └────┬─────┘                │
│       │              │              │                        │
│       └──────────────┼──────────────┘                        │
│                      │                                       │
│              ┌───────▼────────┐                              │
│              │   PostgreSQL   │                              │
│              └────────────────┘                              │
└─────────────────────────────────────────────────────────────┘

Mytesla Dash Version

┌─────────────────────────────────────────────────────────────┐
│                    Your Network                              │
│                                                              │
│                    ┌──────────┐                              │
│                    │ Traefik  │ :80 (Unified Entry)          │
│                    └────┬─────┘                              │
│                         │                                    │
│         ┌───────────────┼───────────────┐                    │
│         │               │               │                    │
│    ┌────▼─────┐   ┌────▼────┐   ┌──────▼─────┐              │
│    │TeslaMate │   │  Dash   │   │    API     │              │
│    │/teslamate│   │    /    │   │/mytesla/api│              │
│    └────┬─────┘   └────┬────┘   └──────┬─────┘              │
│         │              │               │                     │
│         └──────────────┼───────────────┘                     │
│                        │                                     │
│                ┌───────▼────────┐                            │
│                │   PostgreSQL   │                            │
│                └────────────────┘                            │
│                                                              │
│         ┌──────────────┐                                     │
│         │ Auth Service │ (ForwardAuth)                       │
│         └──────────────┘                                     │
└─────────────────────────────────────────────────────────────┘

Access Points

Basic Version

  • TeslaMate: http://your-ip:4000
  • Grafana: http://your-ip:3000 (default: admin/admin)
  • TeslaMateAPI: http://your-ip:3030

Mytesla Dash Version

  • Unified entry: http://your-ip (redirects to Dashboard)
  • Dashboard: http://your-ip/
  • TeslaMate: http://your-ip/teslamate
  • Grafana: http://your-ip/grafana
  • TeslaMateAPI: http://your-ip/mytesla/api (requires API token)
  • Settings: http://your-ip/settings (change auth credentials)
  • Default login: admin / admin123

Connecting Mytess iOS App

Step 1: Note Your TeslaMateAPI Endpoint

  • Basic version: http://your-server-ip:3030
  • Mytesla Dash version: http://your-server-ip/mytesla/api

Replace your-server-ip with:

  • Your local IP (e.g., 192.168.1.100) for home network access
  • Your public IP or domain name for internet access

Step 2: Open Mytess App

  1. Download Mytess from App Store
  2. Open the app
  3. Go to SettingsServer Configuration

Step 3: Enter Server Information

  1. Server URL: Enter your TeslaMateAPI endpoint from Step 1
  2. API Token: Enter the API_TOKEN value from your docker-compose file
  3. Tap Test Connection
  4. If successful, you'll see your vehicle data

Troubleshooting Connection

  • Connection timeout: Check firewall allows port 3030 (basic) or 80 (Mytesla Dash)
  • 401 Unauthorized: API_TOKEN mismatch - ensure it matches your config
  • 404 Not Found: Check URL format - must include http:// prefix

For detailed Mytess setup, visit mytess.net.

Troubleshooting

Services Not Starting

Check logs to diagnose issues:

# View all service logs
docker compose logs

# View specific service logs
docker compose logs teslamate
docker compose logs database

# Follow logs in real-time
docker compose logs -f

Restart services:

# Restart all services
docker compose restart

# Restart specific service
docker compose restart teslamate

Cannot Connect from Mobile

Check firewall:

# Allow port 3030 (basic version)
sudo ufw allow 3030

# Allow port 80 (Mytesla Dash version)
sudo ufw allow 80

Verify services are running:

docker compose ps

Test connectivity:

  • From same network: Try accessing from web browser first
  • From internet: Ensure router port forwarding is configured

Map Not Loading

  • Check TeslaMate logs: docker compose logs teslamate
  • Verify network connectivity to OpenStreetMap servers
  • Ensure no firewall blocking external map tile requests

Database Connection Failed

Check database is running:

docker compose ps database

Check database password matches:

  • POSTGRES_PASSWORD in database service
  • DATABASE_PASS in teslamate service
  • Must be identical!

Reset database (WARNING: deletes all data):

docker compose down -v  # Remove volumes
docker compose up -d    # Start fresh

Grafana Dashboard Missing Data

Check Grafana can connect to database:

docker compose logs grafana

Verify database credentials match:

  • DATABASE_USER, DATABASE_PASS, DATABASE_NAME, DATABASE_HOST in grafana service
  • Should match database service configuration

Maintenance

Backup Database

docker compose exec database pg_dump -U teslamate teslamate > backup.sql

Restore Database

docker compose exec -T database psql -U teslamate teslamate < backup.sql

Update Services

# Pull latest images
docker compose pull

# Restart with new images
docker compose up -d

View Resource Usage

docker compose stats

Documentation

Support