docker.recipes

Appwrite Backend as a Service

intermediate

Self-hosted Firebase alternative with authentication, databases, storage, and functions.

Overview

Appwrite is an open-source Backend-as-a-Service platform that provides developers with a comprehensive set of APIs and tools to build web, mobile, and Flutter applications. Originally created as a self-hosted alternative to Firebase, Appwrite offers authentication, real-time databases, file storage, cloud functions, and webhooks through a unified REST API and dashboard interface. The platform emerged from the need for developers to have full control over their backend infrastructure while maintaining the convenience of managed services. This stack combines Appwrite with a robust data layer consisting of MariaDB for primary application data storage, Redis for high-performance caching and session management, and InfluxDB for time-series analytics and monitoring data. Telegraf acts as the metrics collection agent, gathering system and application performance data and feeding it into InfluxDB for analysis. This configuration creates a production-grade backend infrastructure that can handle authentication, data persistence, real-time features, and comprehensive monitoring in a single deployment. This configuration is ideal for startups and development teams who want the convenience of Firebase-like services but require data sovereignty, custom business logic, or cost predictability. The combination is particularly valuable for building mobile applications, SaaS platforms, or any application requiring user authentication, file uploads, real-time updates, and detailed usage analytics. Unlike managed services, this self-hosted approach eliminates vendor lock-in while providing enterprise-grade monitoring and observability through the InfluxDB and Telegraf integration.

Key Features

  • Multi-tenancy support with project isolation and API key management through Appwrite Console
  • Real-time database subscriptions and webhooks powered by Appwrite's event system
  • OAuth integration with 30+ providers including Google, GitHub, Facebook, and custom SAML
  • Built-in file storage with image transformation, virus scanning, and CDN capabilities
  • Cloud Functions runtime supporting Node.js, Python, PHP, Ruby, and custom Docker containers
  • MariaDB Galera Cluster readiness for high-availability database deployments
  • Redis-powered session management with automatic failover and clustering support
  • Time-series analytics collection via Telegraf monitoring Appwrite API usage and performance metrics

Common Use Cases

  • 1Mobile app backends requiring user authentication, push notifications, and offline data sync
  • 2SaaS applications needing multi-tenant user management with role-based access control
  • 3E-commerce platforms requiring file storage for product images and order processing workflows
  • 4IoT applications collecting sensor data through Appwrite APIs with InfluxDB time-series storage
  • 5Social media applications needing real-time messaging, user profiles, and content moderation
  • 6Enterprise applications requiring custom authentication flows and detailed usage analytics
  • 7Development agencies building multiple client applications with shared backend infrastructure

Prerequisites

  • Docker host with minimum 2GB RAM (4GB recommended) to support MariaDB, Redis, and InfluxDB simultaneously
  • Available ports 80 and 443 for Appwrite web console and API access
  • Valid domain name and SSL certificates for production deployments with OAuth providers
  • Understanding of REST APIs, JWT tokens, and basic database concepts for Appwrite configuration
  • Telegraf configuration file (telegraf.conf) with InfluxDB output and desired input plugins configured

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 appwrite:
3 image: appwrite/appwrite:latest
4 ports:
5 - "80:80"
6 - "443:443"
7 environment:
8 - _APP_ENV=production
9 - _APP_OPENSSL_KEY_V1=${OPENSSL_KEY}
10 - _APP_DOMAIN=localhost
11 - _APP_DOMAIN_TARGET=localhost
12 - _APP_REDIS_HOST=redis
13 - _APP_REDIS_PORT=6379
14 - _APP_DB_HOST=mariadb
15 - _APP_DB_PORT=3306
16 - _APP_DB_SCHEMA=appwrite
17 - _APP_DB_USER=${MYSQL_USER}
18 - _APP_DB_PASS=${MYSQL_PASSWORD}
19 - _APP_INFLUXDB_HOST=influxdb
20 - _APP_INFLUXDB_PORT=8086
21 volumes:
22 - appwrite_uploads:/storage/uploads
23 - appwrite_cache:/storage/cache
24 - appwrite_config:/storage/config
25 - appwrite_certificates:/storage/certificates
26 - appwrite_functions:/storage/functions
27 depends_on:
28 - mariadb
29 - redis
30 - influxdb
31 networks:
32 - appwrite-net
33 restart: unless-stopped
34
35 mariadb:
36 image: mariadb:11
37 environment:
38 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
39 MYSQL_DATABASE: appwrite
40 MYSQL_USER: ${MYSQL_USER}
41 MYSQL_PASSWORD: ${MYSQL_PASSWORD}
42 volumes:
43 - mariadb_data:/var/lib/mysql
44 networks:
45 - appwrite-net
46 restart: unless-stopped
47
48 redis:
49 image: redis:7-alpine
50 volumes:
51 - redis_data:/data
52 networks:
53 - appwrite-net
54 restart: unless-stopped
55
56 influxdb:
57 image: influxdb:2.7-alpine
58 volumes:
59 - influxdb_data:/var/lib/influxdb2
60 networks:
61 - appwrite-net
62 restart: unless-stopped
63
64 telegraf:
65 image: telegraf:alpine
66 volumes:
67 - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
68 depends_on:
69 - influxdb
70 networks:
71 - appwrite-net
72 restart: unless-stopped
73
74volumes:
75 appwrite_uploads:
76 appwrite_cache:
77 appwrite_config:
78 appwrite_certificates:
79 appwrite_functions:
80 mariadb_data:
81 redis_data:
82 influxdb_data:
83
84networks:
85 appwrite-net:
86 driver: bridge

.env Template

.env
1# Appwrite Configuration
2OPENSSL_KEY=$(openssl rand -hex 32)
3
4# MariaDB
5MYSQL_ROOT_PASSWORD=secure_root_password
6MYSQL_USER=appwrite
7MYSQL_PASSWORD=secure_mysql_password

Usage Notes

  1. 1Appwrite Console at http://localhost
  2. 2Create account on first visit
  3. 3SDKs available for all platforms
  4. 4Built-in OAuth, database, storage, and functions

Individual Services(5 services)

Copy individual services to mix and match with your existing compose files.

appwrite
appwrite:
  image: appwrite/appwrite:latest
  ports:
    - "80:80"
    - "443:443"
  environment:
    - _APP_ENV=production
    - _APP_OPENSSL_KEY_V1=${OPENSSL_KEY}
    - _APP_DOMAIN=localhost
    - _APP_DOMAIN_TARGET=localhost
    - _APP_REDIS_HOST=redis
    - _APP_REDIS_PORT=6379
    - _APP_DB_HOST=mariadb
    - _APP_DB_PORT=3306
    - _APP_DB_SCHEMA=appwrite
    - _APP_DB_USER=${MYSQL_USER}
    - _APP_DB_PASS=${MYSQL_PASSWORD}
    - _APP_INFLUXDB_HOST=influxdb
    - _APP_INFLUXDB_PORT=8086
  volumes:
    - appwrite_uploads:/storage/uploads
    - appwrite_cache:/storage/cache
    - appwrite_config:/storage/config
    - appwrite_certificates:/storage/certificates
    - appwrite_functions:/storage/functions
  depends_on:
    - mariadb
    - redis
    - influxdb
  networks:
    - appwrite-net
  restart: unless-stopped
mariadb
mariadb:
  image: mariadb:11
  environment:
    MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    MYSQL_DATABASE: appwrite
    MYSQL_USER: ${MYSQL_USER}
    MYSQL_PASSWORD: ${MYSQL_PASSWORD}
  volumes:
    - mariadb_data:/var/lib/mysql
  networks:
    - appwrite-net
  restart: unless-stopped
redis
redis:
  image: redis:7-alpine
  volumes:
    - redis_data:/data
  networks:
    - appwrite-net
  restart: unless-stopped
influxdb
influxdb:
  image: influxdb:2.7-alpine
  volumes:
    - influxdb_data:/var/lib/influxdb2
  networks:
    - appwrite-net
  restart: unless-stopped
telegraf
telegraf:
  image: telegraf:alpine
  volumes:
    - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
  depends_on:
    - influxdb
  networks:
    - appwrite-net
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 appwrite:
5 image: appwrite/appwrite:latest
6 ports:
7 - "80:80"
8 - "443:443"
9 environment:
10 - _APP_ENV=production
11 - _APP_OPENSSL_KEY_V1=${OPENSSL_KEY}
12 - _APP_DOMAIN=localhost
13 - _APP_DOMAIN_TARGET=localhost
14 - _APP_REDIS_HOST=redis
15 - _APP_REDIS_PORT=6379
16 - _APP_DB_HOST=mariadb
17 - _APP_DB_PORT=3306
18 - _APP_DB_SCHEMA=appwrite
19 - _APP_DB_USER=${MYSQL_USER}
20 - _APP_DB_PASS=${MYSQL_PASSWORD}
21 - _APP_INFLUXDB_HOST=influxdb
22 - _APP_INFLUXDB_PORT=8086
23 volumes:
24 - appwrite_uploads:/storage/uploads
25 - appwrite_cache:/storage/cache
26 - appwrite_config:/storage/config
27 - appwrite_certificates:/storage/certificates
28 - appwrite_functions:/storage/functions
29 depends_on:
30 - mariadb
31 - redis
32 - influxdb
33 networks:
34 - appwrite-net
35 restart: unless-stopped
36
37 mariadb:
38 image: mariadb:11
39 environment:
40 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
41 MYSQL_DATABASE: appwrite
42 MYSQL_USER: ${MYSQL_USER}
43 MYSQL_PASSWORD: ${MYSQL_PASSWORD}
44 volumes:
45 - mariadb_data:/var/lib/mysql
46 networks:
47 - appwrite-net
48 restart: unless-stopped
49
50 redis:
51 image: redis:7-alpine
52 volumes:
53 - redis_data:/data
54 networks:
55 - appwrite-net
56 restart: unless-stopped
57
58 influxdb:
59 image: influxdb:2.7-alpine
60 volumes:
61 - influxdb_data:/var/lib/influxdb2
62 networks:
63 - appwrite-net
64 restart: unless-stopped
65
66 telegraf:
67 image: telegraf:alpine
68 volumes:
69 - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
70 depends_on:
71 - influxdb
72 networks:
73 - appwrite-net
74 restart: unless-stopped
75
76volumes:
77 appwrite_uploads:
78 appwrite_cache:
79 appwrite_config:
80 appwrite_certificates:
81 appwrite_functions:
82 mariadb_data:
83 redis_data:
84 influxdb_data:
85
86networks:
87 appwrite-net:
88 driver: bridge
89EOF
90
91# 2. Create the .env file
92cat > .env << 'EOF'
93# Appwrite Configuration
94OPENSSL_KEY=$(openssl rand -hex 32)
95
96# MariaDB
97MYSQL_ROOT_PASSWORD=secure_root_password
98MYSQL_USER=appwrite
99MYSQL_PASSWORD=secure_mysql_password
100EOF
101
102# 3. Start the services
103docker compose up -d
104
105# 4. View logs
106docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/appwrite-backend/run | bash

Troubleshooting

  • Appwrite Console shows 'Service Unavailable': Check MariaDB container health and ensure database schema initialization completed successfully
  • OAuth authentication fails with redirect URI mismatch: Update _APP_DOMAIN and _APP_DOMAIN_TARGET environment variables to match your actual domain
  • File uploads return 500 errors: Verify appwrite_uploads volume permissions and available disk space for large file storage
  • InfluxDB connection timeouts in Appwrite logs: Ensure InfluxDB container is fully initialized and create required buckets and tokens
  • Redis connection refused errors: Check Redis container status and verify network connectivity between Appwrite and Redis containers
  • Telegraf not collecting metrics: Validate telegraf.conf file syntax and ensure proper InfluxDB authentication credentials are configured

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space