Skip to content

Templates

Deploy pre-configured apps with one click.

Available Templates

Databases

TemplateDescriptionDefault Port
PostgreSQLRelational database5432
MySQLPopular SQL database3306
MariaDBMySQL-compatible3306
MongoDBDocument database27017
RedisIn-memory cache6379

Database Admin

TemplateDescriptionDefault Port
pgAdminPostgreSQL admin UI80
phpMyAdminMySQL/MariaDB admin80
AdminerUniversal DB admin8080
RedisInsightRedis GUI8001

Web Servers

TemplateDescriptionDefault Port
NginxStatic file server80
ApacheHTTP server80
CaddyModern web server80

CMS

TemplateDescriptionDefault Port
WordPressBlog/CMS platform80
GhostModern publishing2368
StrapiHeadless CMS1337

Development Tools

TemplateDescriptionDefault Port
GiteaGit server3000
Code ServerVS Code in browser8080
PortainerContainer management9000
n8nWorkflow automation5678

Monitoring

TemplateDescriptionDefault Port
Uptime KumaStatus monitoring3001
GrafanaMetrics dashboard3000
PrometheusMetrics collection9090

Storage

TemplateDescriptionDefault Port
MinIOS3-compatible storage9000
File BrowserWeb file manager80

Using Templates

Via Dashboard

  1. Open Basepod dashboard
  2. Go to Templates
  3. Click on a template
  4. Enter app name
  5. Click Deploy

Via CLI

bash
# List templates
bp templates

# Deploy from template
bp deploy mydb --template postgres

Template Configuration

Each template includes sensible defaults. You can customize:

  • Name: Your app name (becomes subdomain)
  • Environment Variables: Pre-filled with defaults
  • Volumes: Persistent storage paths

Example: PostgreSQL

Default environment:

POSTGRES_USER: postgres
POSTGRES_PASSWORD: (generated)
POSTGRES_DB: postgres

Default volume:

/var/lib/postgresql/data

Example: WordPress

Default environment:

WORDPRESS_DB_HOST: (your-db-container)
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: (generated)
WORDPRESS_DB_NAME: wordpress

Connecting Apps

Templates that need databases can connect via internal networking.

  1. Deploy a database (e.g., PostgreSQL)
  2. Deploy your app
  3. Use the internal hostname: basepod-postgres:5432

Example WordPress + MySQL:

bash
# Deploy MySQL
bp deploy mydb --template mysql

# Deploy WordPress
bp deploy myblog --template wordpress

# In WordPress config, use:
# DB_HOST=basepod-mydb:3306

Creating Custom Templates

Create your own templates for single apps or multi-service stacks.

Template File Structure

Create a .yaml file with your template definition:

yaml
# mytemplate.yaml
name: myapp
version: "1.0"

services:
  - name: web
    image: nginx:alpine
    port: 80
    env:
      NGINX_HOST: example.com
    volumes:
      - html:/usr/share/nginx/html

Deploy Custom Template

bash
# Deploy local template file
bp template deploy ./mytemplate.yaml

# Deploy with custom name
bp template deploy ./mytemplate.yaml --name mysite

Multi-Service Stacks

Define multiple services in one template, similar to docker-compose.

Example: Node.js + PostgreSQL

yaml
# nodeapp.yaml
name: nodeapp
version: "1.0"

services:
  - name: api
    build: .
    port: 3000
    env:
      DATABASE_URL: postgres://postgres:secret@db:5432/app
      NODE_ENV: production
    depends_on:
      - db

  - name: db
    template: postgres
    env:
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: app
    volumes:
      - pgdata:/var/lib/postgresql/data

Example: WordPress Stack

yaml
# wordpress-stack.yaml
name: myblog
version: "1.0"

services:
  - name: wordpress
    template: wordpress
    port: 80
    env:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: secret
      WORDPRESS_DB_NAME: wordpress
    volumes:
      - wp-content:/var/www/html/wp-content
    depends_on:
      - db

  - name: db
    template: mysql
    env:
      MYSQL_ROOT_PASSWORD: rootsecret
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: secret
    volumes:
      - mysql-data:/var/lib/mysql

Example: LAMP Stack

yaml
# lamp.yaml
name: lamp
version: "1.0"

services:
  - name: web
    image: php:8.2-apache
    port: 80
    env:
      DB_HOST: db
      DB_NAME: app
    volumes:
      - ./src:/var/www/html
    depends_on:
      - db

  - name: db
    template: mysql
    env:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: app
    volumes:
      - mysql-data:/var/lib/mysql

  - name: phpmyadmin
    template: phpmyadmin
    port: 8080
    env:
      PMA_HOST: db

Template Schema Reference

Root Fields

FieldTypeRequiredDescription
namestringYesStack name (used as prefix)
versionstringNoTemplate version
servicesarrayYesList of services

Service Fields

FieldTypeRequiredDescription
namestringYesService name
imagestringNo*Docker image
templatestringNo*Use predefined template
buildstringNo*Build from path
portintegerNoExposed port
envobjectNoEnvironment variables
volumesarrayNoVolume mounts
depends_onarrayNoService dependencies

*One of image, template, or build is required.

Service Types

1. From Docker Image

yaml
- name: web
  image: nginx:alpine
  port: 80

2. From Predefined Template

yaml
- name: db
  template: postgres
  env:
    POSTGRES_PASSWORD: secret

3. From Local Source

yaml
- name: api
  build: ./api
  port: 3000

Volumes

Named volumes for persistence:

yaml
volumes:
  - data:/app/data           # named volume
  - ./local:/container/path  # bind mount (dev only)

Dependencies

Control startup order:

yaml
services:
  - name: api
    depends_on:
      - db
      - cache

  - name: db
    template: postgres

  - name: cache
    template: redis

Sharing Templates

Export Running Stack

bash
# Export current app configuration as template
bp template export myapp > myapp-template.yaml

Template Library

Store templates in a git repository:

my-templates/
├── stacks/
│   ├── lamp.yaml
│   ├── mean.yaml
│   └── wordpress.yaml
└── apps/
    ├── api-server.yaml
    └── static-site.yaml

Deploy from URL:

bash
bp template deploy https://github.com/user/templates/raw/main/stacks/lamp.yaml

Environment Variables

Inline Values

yaml
env:
  NODE_ENV: production
  API_KEY: mysecret

Reference Other Services

Use service names as hostnames:

yaml
services:
  - name: api
    env:
      DATABASE_URL: postgres://user:pass@db:5432/mydb
      REDIS_URL: redis://cache:6379

  - name: db
    template: postgres

  - name: cache
    template: redis

Generated Values

Use placeholders for auto-generated values:

yaml
env:
  SECRET_KEY: ${RANDOM_32}      # 32-char random string
  API_TOKEN: ${RANDOM_64}       # 64-char random string
  DB_PASSWORD: ${RANDOM_16}     # 16-char random string

Best Practices

  1. Use named volumes for data persistence
  2. Set depends_on for proper startup order
  3. Use templates for standard services (postgres, redis, etc.)
  4. Keep secrets in environment variables, not in the template file
  5. Version your templates in git for reproducibility

Released under the MIT License.