Efficient Site Configuration with Empress

Introduction

Welcome to this comprehensive guide on Site Config in Empress. This feature enables the seamless configuration of Empress sites, each having their unique database solutions, configurations and locations, with different granularities. Site Config is a crucial aspect of efficient software customization and development.

This guide will guide you through the technical aspects of the Site Config feature and its advantages, demonstrating how you can effectively integrate and utilize this feature in your development process.

Understanding Site Config

Site Config is a feature in Empress that stores all site-related information, from the site’s Database details to the custom domains that point to it. It is primarily stored in site_config.json, which is located in the site directory.

{
  "db_name": "frappe_database_name",
  "db_password": "frappe_database_password",
  "admin_password": "admin_password",
}

The site_config.json file stores the global configuration for a particular site and is automatically created and populated by Empress.

Common Site Config

common_site_config.json is where configuration shared by your bench is stored. This file is automatically generated and managed by the Bench CLI.

{
  "background_workers": 1,
  "developer_mode": true,
  "dns_multitenant": true,
  "file_watcher_port": 6789,
  "frappe_user": "frappe",
  "gunicorn_workers": 2,
  "maintenance_mode": 0,
  "pause_scheduler": 0,
  "redis_cache": "redis://localhost:13000",
  "redis_queue": "redis://localhost:11000",
  "redis_socketio": "redis://localhost:12000",
  "scheduler_tick_interval": 120,
  "serve_default_site": true,
  "socketio_port": 9000,
  "webserver_port": 8000,
  "root_password": "MARIADB_PASSWORD",
  "live_reload": true
}

Config Value Precedence

It’s important to understand that the value for a particular key in the site_config.json will have precedence over the value defined in the common_site_config.json. This means the key-values defined in the common config may be used as a fallback in some cases.

Standard Config Keys

Empress Framework and Bench utilize several standard keys. These keys include db_type, db_name, db_password, admin_password, allow_tests, allow_cors, data_import_batch_size, deny_multiple_logins, deny_multiple_sessions, developer_mode, disable_async, disable_error_snapshot, disable_global_search, disable_scheduler, disable_session_cache, disable_website_cache, encryption_key, enable_frappe_logger, error_report_email, ignore_csrf, install_apps, host_name, http_port, keep_backups_for_hours, local_infile, logging, maintenance_mode, max_file_size, max_reports_per_user, monitor, mute_emails, pause_scheduler, rate_limit, robots_txt, root_login, root_password, server_script_enabled, skip_setup_wizard, socketio_port, webserver_port, app_include_js, app_include_css.

Remote Database Host Settings

Empress also provides settings to connect to a remote database server using SSL. These include db_host, db_port, db_ssl_ca, db_ssl_cert, db_ssl_key, rds_db.

Default Outgoing Email Settings

Empress provides lower level configurations for its Email module. These include auto_email_id, mail_login, always_use_account_email_id_as_sender, always_use_account_name_as_sender_name, email_sender_name, mail_server, mail_port, mail_login, mail_password, pop_timeout, use_ssl, use_tls.

Bench Configuration

These configurations are utilised by the Bench CLI and may be set differently for each bench on your system through the common site configuration.

Integrations

Empress allows you to define config settings for your integrations via the site config. These include Sandbox settings, Dropbox settings, PayPal settings, and others.

In conclusion, the Site Config feature in Empress provides developers with a flexible and powerful way to manage various aspects of a site’s configuration. This feature is integral to the development and customization of business solutions in Empress, providing developers with the tools they need to create efficient, secure, and robust software.