Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dokploy/dokploy/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Dokploy templates provide one-click deployment of popular applications and services. Templates include pre-configured settings, environment variables, and resource definitions to get services running quickly.

Using Templates

1

Access templates

Navigate to Templates in the Dokploy dashboard.
2

Choose template

Browse available templates and select one to deploy.
3

Configure settings

Review and customize:
  • Project name
  • Environment variables
  • Resource limits
  • Domain configuration
4

Deploy

Click Deploy to launch the service.

Template Structure

Templates are defined with the following components:
interface Template {
  envs?: string[];              // Environment variables
  mounts?: {
    filePath: string;           // Mount path
    content?: string;           // File content
  }[];
  domains?: DomainSchema[];     // Pre-configured domains
}

Environment Variables

Templates can define required or optional environment variables:
{
  envs: [
    "DATABASE_URL=postgresql://user:pass@db:5432/mydb",
    "REDIS_URL=redis://redis:6379",
    "SECRET_KEY=${generatePassword(32)}",
    "APP_URL=https://${generateRandomDomain({ serverIp, projectName })}"
  ]
}
Template variables support dynamic generation through helper functions like generatePassword() and generateRandomDomain().

File Mounts

Templates can include configuration files:
{
  mounts: [
    {
      filePath: "/app/config.yml",
      content: `
server:
  port: 3000
  host: 0.0.0.0
database:
  url: \${DATABASE_URL}
`
    },
    {
      filePath: "/app/nginx.conf",
      content: "... nginx configuration ..."
    }
  ]
}

Domain Configuration

Templates can pre-configure domains:
{
  domains: [
    {
      host: "${projectName}.traefik.me",
      port: 3000,
      serviceName: "web"
    },
    {
      host: "api-${projectName}.traefik.me",
      port: 8080,
      serviceName: "api"
    }
  ]
}

Template Helper Functions

Dokploy provides utility functions for dynamic template values:
Creates a unique traefik.me domain:
generateRandomDomain({
  serverIp: "192.168.1.100",
  projectName: "myapp"
})
// Returns: myapp-a3f2c1-192-168-1-100.traefik.me
The function:
  • Generates a 3-byte random hash
  • Converts IP to dash-separated format
  • Combines with project name

Creating Custom Templates

You can create custom templates for your organization’s common deployments.
1

Define template structure

Create a template configuration:
const customTemplate: Template = {
  envs: [
    "NODE_ENV=production",
    "PORT=3000",
    "DATABASE_URL=postgresql://postgres:${generatePassword()}@db:5432/app"
  ],
  mounts: [
    {
      filePath: "/app/.env.production",
      content: "API_KEY=${generateBase64(32)}\nSECRET=${generatePassword(32)}"
    }
  ],
  domains: [
    {
      host: "${projectName}.${serverIp}.traefik.me",
      port: 3000,
      serviceName: "app"
    }
  ]
};
2

Include Docker Compose

Define the service configuration:
version: "3.8"
services:
  app:
    image: node:20-alpine
    environment:
      - NODE_ENV=${NODE_ENV}
      - DATABASE_URL=${DATABASE_URL}
    ports:
      - "3000:3000"
    volumes:
      - ./app:/app
    restart: unless-stopped
  
  db:
    image: postgres:16-alpine
    environment:
      - POSTGRES_PASSWORD=${DB_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:
3

Test deployment

Deploy the template to ensure all configurations work correctly.

Template Categories

Web Applications

Ready-to-deploy web frameworks:
  • Next.js
  • React SPA
  • Vue.js
  • Svelte

Databases

Pre-configured databases:
  • PostgreSQL
  • MySQL
  • MongoDB
  • Redis

Development Tools

Developer services:
  • GitLab
  • Jenkins
  • SonarQube
  • n8n

Monitoring

Observability stack:
  • Grafana
  • Prometheus
  • Uptime Kuma
  • Plausible

Example Templates

WordPress Template

{
  envs: [
    "WORDPRESS_DB_HOST=db:3306",
    "WORDPRESS_DB_USER=wordpress",
    "WORDPRESS_DB_PASSWORD=${generatePassword(16)}",
    "WORDPRESS_DB_NAME=wordpress"
  ],
  domains: [
    {
      host: "${projectName}.${serverIp}.traefik.me",
      port: 80,
      serviceName: "wordpress"
    }
  ]
}

PostgreSQL + pgAdmin Template

{
  envs: [
    "POSTGRES_USER=admin",
    "POSTGRES_PASSWORD=${generatePassword(20)}",
    "POSTGRES_DB=mydb",
    "PGADMIN_DEFAULT_EMAIL=admin@example.com",
    "PGADMIN_DEFAULT_PASSWORD=${generatePassword(16)}"
  ],
  domains: [
    {
      host: "pgadmin-${projectName}.traefik.me",
      port: 80,
      serviceName: "pgadmin"
    }
  ]
}

Full-Stack Application Template

{
  envs: [
    "NODE_ENV=production",
    "API_URL=https://api-${projectName}.traefik.me",
    "DATABASE_URL=postgresql://app:${generatePassword()}@db:5432/appdb",
    "REDIS_URL=redis://redis:6379",
    "JWT_SECRET=${generateBase64(32)}"
  ],
  mounts: [
    {
      filePath: "/app/config/production.json",
      content: JSON.stringify({
        api: {
          port: 8080,
          cors: ["https://${projectName}.traefik.me"]
        },
        database: {
          pool: { min: 2, max: 10 }
        }
      }, null, 2)
    }
  ],
  domains: [
    {
      host: "${projectName}.traefik.me",
      port: 3000,
      serviceName: "frontend"
    },
    {
      host: "api-${projectName}.traefik.me",
      port: 8080,
      serviceName: "backend"
    }
  ]
}

Template Variables

Available variables in template strings:
VariableDescriptionExample
${projectName}User-provided project namemyapp
${serverIp}Dokploy server IP192.168.1.100
${generatePassword(n)}Random passwordk7m9p2x4q8n3
${generateHash(name, n)}Hash with prefixmyapp-a3f2c1
${generateBase64(n)}Base64 random bytesdGVzdA==
${generateRandomDomain(...)}Traefik.me domainapp-abc123-192-168-1-100.traefik.me
Template variables are evaluated once during deployment. They cannot be dynamically updated after initial creation.

Best Practices

Always generate strong passwords and secrets:
// Good
"DB_PASSWORD=${generatePassword(20)}"

// Bad
"DB_PASSWORD=password123"
Clearly indicate which environment variables users must customize:
{
  envs: [
    "# Required: Update with your SMTP credentials",
    "SMTP_HOST=smtp.gmail.com",
    "SMTP_USER=your-email@gmail.com",
    "SMTP_PASS=your-app-password"
  ]
}
Add health check configurations to ensure services start correctly:
services:
  app:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
Set production-ready defaults:
{
  envs: [
    "NODE_ENV=production",
    "LOG_LEVEL=info",
    "ENABLE_METRICS=true",
    "RATE_LIMIT_ENABLED=true"
  ]
}

Troubleshooting

Check:
  • All required environment variables are set
  • Docker images are accessible
  • Port conflicts with existing services
  • Sufficient resources (CPU, memory, disk)
Logs:
docker compose logs -f
Verify:
  • Traefik.me DNS is resolving correctly
  • Server IP is publicly accessible
  • Firewall allows ports 80 and 443
Test:
curl -I http://myapp-abc123-192-168-1-100.traefik.me
Check:
  • File path is absolute
  • Content is properly formatted
  • Container has write permissions
Verify mount:
docker exec <container> cat /app/config.yml

Sharing Templates

Share your custom templates with the community:
  1. Document Requirements: List prerequisites and dependencies
  2. Provide Examples: Include sample configurations
  3. Test Thoroughly: Verify deployment on clean Dokploy instance
  4. Submit PR: Contribute to the Dokploy templates repository
Community templates undergo review to ensure security and quality standards.