---
title: Example: Drupal
slug: hosty/example-drupal
icon: {"faIcon":"fa-brands fa-drupal"}
createdAt: 2026-11-08T11:27:49.007Z
---

A Drupal site in the `drupal` folder of the project, with the web root in `web`, served by nginx, with Redis for the cache. See [Project configuration](https://wiki.systemseed.com/hosty/project-configuration) for all settings.

```yaml
clusterName: <cluster>
clusterRegion: eu-west-2
projectName: example

services:
  redis:
    size: 256
    persistence: false

applications:
  backend:
    type: php:nginx
    appRoot: ./drupal
    extraBuildDependencies:
      - ./patches

    nginx:
      version: "1.30"
      environmentVariables:
        # The code is in /var/www/html.
        NGINX_SERVER_ROOT: /var/www/html/web
        NGINX_VHOST_PRESET: drupal10
        NGINX_ERROR_404_URI: /sites/default/misc/404.html

    php:
      version: "8.4"
      environmentVariables:
        DRUSH_OPTIONS_URI: "https://{{ backend.host.0 }}"
        APP_MODE: development
      environmentFiles:
        - ./.env.secrets
      hooks:
        build: |
          composer install --no-interaction --no-dev

    database:
      excludeTablesFromImportOnDevEnvs:
        - cache%
        - cachetags
        - sessions
        - watchdog

    crontab:
      jobs:
        - name: drupal-cron
          schedule: "*/15 * * * *"
          command: drush cron

    persistentStorages:
      public:
        path: web/sites/default/files
        syncArgsForDevEnvs: --exclude=styles/* --exclude=css/* --exclude=js/*
      private:
        path: private
        syncArgsForDevEnvs: --exclude=twig/*
      tmp: tmp

    overrides:
      - condition:
          environments: [stage]
        php:
          environmentVariables:
            APP_MODE: stage
        crontab:
          enabled: true

      - condition:
          environments: [production]
        hosts:
          - example.com
          - www.example.com
        php:
          environmentVariables:
            APP_MODE: production
```

Things to know:

- In `settings.php`, read the database from `DB_HOST`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_PORT` and `DB_DRIVER`, and Redis from `REDIS_HOST`, `REDIS_PORT` and `REDIS_PASSWORD`. See [Environment variables](https://wiki.systemseed.com/hosty/environment-variables).
- Point the private and temporary files to their storages: `$settings['file_private_path'] = getenv('FILES_PRIVATE_PATH');` and `$settings['file_temp_path'] = getenv('FILES_TMP_PATH');`. The code is read-only, so Drupal can write only into the storages.
- Cron runs on production and on `stage`. Other development environments don't run it.
- Run `drush deploy` after each deployment, i.e. in CI with `hosty exec <environment> --no-tty --command "drush deploy"`.
- Add the tables with personal data of your site to `excludeTablesFromImportOnDevEnvs`, i.e. of webform submissions or orders, so that development environments don't get it.
