Implementing Site Limits and Restrictions in Empress Development

Introduction

Welcome to the Empress development guide focusing on Site Limits and Restrictions. This powerful feature, available in Empress v7, allows you to set and manage various usage limits for your site. From setting user counts to managing space usage, these constraints offer a robust method for resource allocation and control.

Understanding Site Limits and Restrictions

In Empress v7, you can find these restrictions defined within the site_config.json file located in your site’s folder. The following JSON structure gives a glimpse into what these configurations look like:

{
 "db_name": "xxxxxxxxxx",
 "db_password": "xxxxxxxxxxxx",
 "limits": {
  "emails": 1500,
  "space": 0.157,
  "expiry": "2016-07-25",
  "users": 1
    }
}

Here, the limits object contains various properties that correspond to different resource limits.

Setting and Modifying Limits

You can set a limit by using the bench command-line tool with the set-limit option. The syntax is as follows:

bench --site [sitename] set-limit [limit] [value]

You can also set multiple limits simultaneously:

bench --site [sitename] set-limits --limit [limit] [value] --limit [limit-2] [value-2]

The available limits you can set include:

  • users: The maximum number of users for a site
  • emails: The limit on the number of emails sent per month from the site
  • space: The maximum space the site can use in GB
  • email_group: The maximum number of members allowed in an Email Group
  • expiry: The expiry date for the site (Formatted as ‘YYYY-MM-DD’ within quotes)

For example, to set a user limit of 5, you can use the following command:

bench --site site1.local set-limit users 5

Monitoring Usage

The “Usage Info” page, accessible from the toolbar or AwesomeBar, allows you to monitor your usage. A limit will only appear on this page if it has been set.

Conclusion

The Site Limits and Restrictions feature provides a robust and flexible way to manage resource allocation on your site. By leveraging these settings, developers can ensure optimal utilization of resources and maintain control over site usage. This feature is an integral part of Empress’s commitment to providing comprehensive and customizable business solutions.