# This file describes an application. You can have multiple applications
# in the same project.

# The name of this app. Must be unique within a project.
name: myddleware

# The type of the application to build.
type: php:7.0
build:
    flavor: composer

# The extensions you want to enable.
runtime:
    extensions:
        - ssh2
        - pdo_dblib

# The relationships of the application with services or other applications.
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
relationships:
    database: "mysqldb:mysql"

# The configuration of app when it is exposed to the web.
web:
    locations:
        "/":
            # The public directory of the app, relative to its root.
            root: "web"
            # The front-controller script to send non-static requests to.
            passthru: "/app.php"

# The size of the persistent disk of the application (in MB).
disk: 2048

# The mounts that will be performed when the package is deployed.
mounts:
    "/app/cache": "shared:files/cache"
    "/app/logs": "shared:files/logs"
    "/app/sessions": "shared:files/sessions"
    "/src/Myddleware/RegleBundle/Custom": "shared:files/custom"

# The hooks that will be performed when the package is deployed.
hooks:
    build: |
        php app/console --env=prod assets:install --no-debug
    deploy: |
        php app/console --env=prod cache:clear
        php app/console --env=prod assetic:dump
        php app/console --env=prod assets:install web
        php app/console d:s:u --force
        php app/console d:f:l --append
        php app/console fos:user:create admin admin@example.com admin
        php app/console fos:user:promote admin ROLE_ADMIN

crons:
    jobScheduler:
        spec: '*/5 * * * *'
        cmd: 'php app/console myddleware:jobScheduler --env=background'
