Skip to main content

Local Environment Configuration

Learn how to configure your Seravo project's local development environment using config.yml. Guide for managing Docker containers, setting up local domains, and syncing your environment with production and staging instances.

Updated this week

The config.yml file in the project directory is used to set up your local development environment. Seravo sites typically come with this file pre-configured. When you run the site for the first time with an empty project template, the default config.yml file is generated from the config-sample.yml template.

Default config.yml

name: wordpress 
development:
domains:
- wordpress.local

Customized config.yml example

name: wordpress 

production:
domain: example.seravo.com
ssh_port: 12345

development:
domains:
- mywpsite.local
- another.local
- third.mywpsite.local

pull_production_db: never
pull_production_plugins: never
pull_production_themes: never

Customizing config.yml

Changes take effect after restarting the container. Most changes are applied by running docker-compose up -d. Some fundamental changes to the environment structure may require rebuilding or removing the containers before restarting.

Properties

name

  • Default: wordpress

  • Description: Change the name in config.yml to update your site's internal identifier. This is used as a prefix for Docker containers and networks. Commands like wp-pull-staging-db use this value as the username for SSH connections.

  • Example:

    name: mywpsite

production

  • Default: -

  • Description: Add the domain and ssh_port to sync your local Docker environment with your live production instance.

  • Example:

    production: 
    domain: example.seravo.com
    ssh_port: 12345

staging

  • Default: -

  • Description: Add the domain and ssh_port to sync with your staging (Shadow) instance.

  • Example:

    staging: 
    domain: example.seravo.com
    ssh_port: 23456

development.domains

  • Default: wordpress.local

  • Description: A list of local domains to be created for the container. Multisite installations should include all required domains here. Ensure these do not conflict with any other containers running on your system.

  • Example:

    development: 
    domains:
    - mywpsite.local
    - another.local
    - third.mywpsite.local

development.pull_production

  • Default: -

  • Description: Determines whether to automatically pull data from production when the environment is started. Options are always or never.

  • Example:

    development: 
    pull_production_db: always
    pull_production_plugins: always
    pull_production_themes: always

WordPress Network (Multisite) in Local Development

Multisite installations require a few additional configurations to function correctly within the local Docker environment.

Setting the DOMAIN_CURRENT_SITE Constant

On the production site, the wp-config.php file often contains the network address hard-coded in the DOMAIN_CURRENT_SITE constant. For local development, this needs to point to your local domain. The best way to handle this dynamically is by using the WP_ENV environment variable:

if ( 'development' === getenv('WP_ENV') ) { 
define('DOMAIN_CURRENT_SITE', 'example.local');
} else {
define( 'DOMAIN_CURRENT_SITE', 'example.com' );
}

Subdomain Network Installations

If you wish to run a WordPress network subdomain installation locally, ensure all subdomains you intend to use are included in the config.yml file under the development section before starting the container:

... 
development:
domains:
- wordpress.local
- site1.wordpress.local
- site2.wordpress.local

When running the wp-pull-production-db command, subdomains are automatically mapped to the local development URL if a subdomain network installation is detected (e.g., site1.example.com would be search-replaced to site1.wordpress.local).

Note: Custom mappings to domains other than subdomains (for instance site1.com instead of site1.example.com) are not handled automatically. These must be managed by the developer using custom scripts or wp search-replace commands.

Did this answer your question?