Instance Manager

Frappe control app for managing ESS core configurations, server scripts, client scripts, database limits, and instance expiry handling.

Install Instance Manager

bench get-app https://github.com/Zaryab03/instance_manager

Add the Frappe Gems badge to your README

Maintain Instance Manager? Paste this into your README:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=Zaryab03%2Finstance_manager)](https://frappegems.com/gems/apps/Zaryab03/instance_manager)

About Instance Manager

Instance Manager

Instance Manager is a Frappe control app designed to manage and restrict system-level configurations such as ESS core behavior, server scripts, client scripts, and database usage. It also provides instance-level expiry control with automated user notifications.

Features

  • User Limits: Enforce separate limits for ESS (Website Users) and Core (System Users)
  • Database Limits: Set database size limits for your instance
  • License Expiry Tracking: Track when your instance license expires
  • Homepage Bar: Displays remaining days until expiry directly on the Frappe homepage
  • Automatic Checks: Validates user creation against limits and expiry status

Installation

  1. Add this app to your bench at apps/instance_manager.

  2. Install the Python package into the bench virtualenv:

./env/bin/python -m pip install --force-reinstall --no-build-isolation ./apps/instance_manager
  1. Install the app on your site:
bench --site your-site install-app instance_manager
  1. Migrate the database:
bench --site your-site migrate
  1. Build assets and clear cache:
bench build
bench --site your-site clear-cache

For this bench, you can also use the bundled installer:

./apps/instance_manager/install.sh your-site

Why the extra pip install step?

Some older or offline bench environments do not automatically install custom app packages into the bench virtualenv before loading hooks. In that case, Frappe can see instance_manager in sites/apps.txt but Python still raises:

ModuleNotFoundError: No module named 'instance_manager'

Installing the app package into ./env first avoids that issue.

Configuration

After installation, create an "Instance Settings" document:

  1. Go to Awesome Bar and search for "Instance Settings"
  2. Create a new Instance Settings document
  3. Configure:
    • Instance Name: Name of your instance
    • ESS User Limit: Maximum Website Users allowed
    • Core User Limit: Maximum System Users allowed
    • Database Limit (GB): Maximum database size
    • Expiry Date: When the license expires

Features

1. User Limits (ESS and Core)

  • Automatically checks limits before creating new users
  • Prevents exceeding configured limits
  • Shows current usage vs. limits in settings

2. License Expiry

  • Set an expiry date for your instance
  • System shows warning bar when approaching expiry
  • Critical warning when less than 7 days remaining
  • Expired instances cannot create new users

3. Homepage Bar

  • Automatically displays on every Frappe page
  • Shows remaining days until expiry
  • Color-coded alerts:
    • Red: License expired
    • Orange: Less than 7 days remaining
    • Blue: Less than 30 days remaining
  • Updates every 5 minutes

API Endpoints

Get Instance Status

GET /api/method/instance_manager.doctype.instance_settings.instance_settings.get_instance_status

Returns:

{
  "expired": false,
  "days_remaining": 180,
  "ess_users": 45,
  "core_users": 12,
  "ess_limit": 100,
  "core_limit": 50,
  "database_limit_gb": 10.0,
  "expiry_date": "2026-12-31"
}

Check User Limit

GET /api/method/instance_manager.doctype.instance_settings.instance_settings.check_user_limit
Parameters: user_type=System User|Website User

Check Expiry

GET /api/method/instance_manager.doctype.instance_settings.instance_settings.check_expiry

Usage Examples

Check limits before creating a user

from instance_manager.doctype.instance_settings.instance_settings import check_user_limit

result = check_user_limit("System User")
if result["allowed"]:
    # Create user
    pass
else:
    print(f"Cannot create user: {result['reason']}")

Get current status

from instance_manager.utils.instance_utils import get_instance_summary

summary = get_instance_summary()
print(f"Days remaining: {summary['days_remaining']}")

Permissions

By default, only System Managers can view and edit Instance Settings.

Support

For issues, feature requests, or contributions, please contact your administrator.

License

MIT License - See LICENSE file for details

Related Developer Tools apps for Frappe & ERPNext

  • Frappe — Low code web framework for real world applications, in Python and Javascript
  • Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
  • Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
  • Bench — CLI to manage Multi-tenant deployments for Frappe apps
  • Frappe Ui — A set of components and utilities for rapid UI development
  • Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
  • Gameplan — Open Source Discussions Platform for Remote Teams
  • Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.