Runtime configuration

The runtime configuration is only relevant for projects using PHP as other runtimes are not supported at the moment.

PHP projects are equipped with a PHP runtime, cron jobs, a MariaDB and a send mail account. Deploy Now offers a convenient solution to generate application configuration files such as .env, allowing you to reference to sensitive data such as database credentials without storing them in plain text.

Templates for .env and .htaccess can be stored under .deploy-now for workflow v1 and .deploy-now/[project-name] for workflow v2. More information about the Deploy Now workflows can be found under GitHub integration.

Configurations

PHP version

Description

Deploy Now offers a wide choice of PHP versions. Note that PHP versions for the runtime can be different from those for the build.

How to edit

PHP versions of production and staging deployments can be adapted in the project dashboard. You can also define a default PHP version for new branches.

Database

Description

Each PHP project is equipped with one 2GB MariaDB.

How to edit

Databases can be managed via phpMyAdmin in the project dashboard. How to reference database credentials in .env is described under application configuration.

Cron jobs

Description

Cron jobs execute recurring tasks, like executing scripts, on your runtime at fixed points in time.

How to edit

Cron jobs can be defined in the config.yaml under .deploy-now for workflow v1 and .deploy-now/[project-name] for workflow v2 in your repository. More information about cron job syntax can be found here.

Example

runtime:
  cron-jobs:
    - command: my-cron-job-command # the deployment is located at $HOME/htdocs/ to execute a deployed script just prefix it accordingly
      schedule: 0 5 * * * # run every day at 5:00

Send mail account

Description

Deploy Now provided a mail account you can use to send emails from scripts. The mail address is generated by Deploy Now and the mail account cannot receive replies.

How to edit

Mail credentials are stored in the GitHub secrets of your repository. How to reference mail credentials in .env is described under application configuration.

Application configuration

Description

Most dynamic projects require an application configuration file such as .env. Such files are simple text files for controlling application environment constants. As these constants might not be stored as plain text in your repository, you can add placeholders in configuration files that get replaced by their actual values during deployment. Actual values are stored in GitHub secrets.

How to edit

Configuration file templates are stored in .deploy-now for workflow v1 and .deploy-now/[project-name] for workflow v2. The relative path of this file within this folder (you may add additional sub-folders) will be used as the target path for the deployed config file. They are suffixed with .template. The reference syntax can be found in the examples below. Database credentials are stored in GitHub secrets as well since workflow v2.

Example

Under workflow v1:

Database credential reference

     DB_CONNECTION=mysql
     DB_HOST={{ .runtime.db.host }}
     DB_PORT=3306
     DB_DATABASE={{ .runtime.db.name }}
     DB_USERNAME={{ .runtime.db.user }}
     DB_PASSWORD={{ .runtime.db.password }}

Send mail credential reference

     MAIL_MAILER=smtp
     MAIL_HOST={{ .secrets.mail.host }}
     MAIL_PORT={{ .secrets.mail.port }}
     MAIL_USERNAME={{ .secrets.mail.user }}
     MAIL_PASSWORD={{ .secrets.mail.password }}
     MAIL_ENCRYPTION={{ .secrets.mail.encryption }}
     MAIL_FROM_ADDRESS={{ .secrets.mail.fromAddress }}
     MAIL_FROM_NAME="${APP_NAME}"

Reference App URL

     APP_URL={{ .runtime.app_url }}

Custom secret and non-secret credential reference

     # non-secret
     key: value
     # secret
     key: ${{ secrets.key }}
     

Please note that when adding new secret custom variables, they need to be referenced under .github/workflows/deploy-now.yaml as shown below.

 - name: Render templates
        if: ${{ steps.project.outputs.deployment-enabled == 'true' }}
        uses: ionos-deploy-now/template-renderer-action@v1
        with:
          secrets: |
               # this is a secret custom variable
               key: ${{ secrets.key }}
           

Under workflow v2:

Database credential reference

     DB_CONNECTION=mysql
     DB_HOST=$IONOS_DB_HOST
     DB_PORT=3306
     DB_DATABASE=$IONOS_DB_NAME
     DB_USERNAME="$IONOS_DB_USERNAME"
     DB_PASSWORD="$IONOS_DB_PASSWORD"

Send mail credential reference

     MAIL_MAILER=smtp
     MAIL_HOST=$IONOS_MAIL_HOST
     MAIL_PORT=$IONOS_MAIL_PORT
     MAIL_USERNAME=$IONOS_MAIL_USERNAME
     MAIL_PASSWORD=IONOS_MAIL_PASSWORD
     MAIL_ENCRYPTION=IONOS_MAIL_ENCRYPTION
     MAIL_FROM_ADDRESS=IONOS_MAIL_FROM_ADDRESS
     MAIL_FROM_NAME="${APP_NAME}"

Reference App URL

     APP_URL=$IONOS_APP_URL

Inserted values could also be url-encoded if this is required by you framework. Simply use the following syntax:

     URL_ENCODED_PASSWORD=${ IONOS_DB_PASSWORD.urlEncoded() }
     

All secrets and deployment specific variables are automatically passed to the template action, therefore you do not have to edit this section on you own.

    with:
      data: '[${{ toJson(secrets) }}, ${{ steps.deployment.outputs.template-variables }}]'

.HTACCESS

Description

HTACCESS is a configuration file used by apache-based web servers. It can be used to define redirects and rewrites and includes security and performance relevant configurations. See Apache configuration for an extensive overview of functionalities that are available in Deploy Now.

How to edit

HTACCESS files are stored in .deploy-now for workflow v1 and .deploy-now/[project-name] for workflow v2. The relative path of this file within this folder (you may add additional sub-folders) will be used as the target path for the deployed HTACCESS file. Files need to be named .htaccess.template.

Example

Examples can be found under Apache configuration.

Need help?

Feel free to reach out to us via deploynow-support@ionos.com.

Tip

Missing a feature? Feel free to drop your request via GitHub Issues