Config
Bench configuration commands allow you to customize the behavior of your
Bench environment without manually editing configuration files. You can
enable or disable features, configure networking, manage production
services, and update Bench dependencies from the command line.
of editing configuration files manually. This helps maintain consistency
across your Bench environment.
bench config
The bench config command is used to modify Bench-level
configuration settings. These settings control how Bench behaves during
updates, deployments, and production management.
bench config [setting] [value]
Available Configuration Options
| Configuration | Description |
|---|---|
auto_update |
Enable or disable automatic Bench updates. |
dns_multitenant |
Enable or disable DNS-based multitenancy. |
http_timeout |
Configure the HTTP request timeout value. |
restart_supervisor_on_update |
Automatically restart Supervisor services after updates. |
serve_default_site |
Configure Nginx to serve the default site automatically. |
update_bench_on_update |
Automatically update the Bench CLI whenever Bench is updated. |
bench setup
The bench setup command prepares different components required
for a Frappe or ERPNext environment. Depending on your deployment, you can
configure services such as Nginx, Redis, Supervisor, cron jobs, virtual
environments, and more.
bench setup [component]
Available Setup Components
| Component | Purpose |
|---|---|
auto-update |
Create a cron job for automatic Bench updates. |
backups |
Configure scheduled Bench backups. |
config |
Create or overwrite the Bench configuration file. |
env |
Create or rebuild the Python virtual environment. |
nginx |
Generate the Nginx configuration files. |
procfile |
Create the Procfile used by bench start. |
production |
Configure Bench for production deployment. |
redis |
Generate Redis configuration files. |
socketio |
Install Node.js dependencies required for Socket.IO. |
sudoers |
Add required Bench commands to the sudoers configuration. |
supervisor |
Generate Supervisor configuration files. |
add-domain |
Add a custom domain to a site. |
firewall |
Configure the server firewall and allow only required ports. |
ssh-port |
Change the default SSH port. |
requirements |
Install or update Python and Node.js dependencies. |
Updating Requirements
When using the requirements component, you can update only
specific dependency groups instead of reinstalling everything.
bench setup requirements
| Option | Description |
|---|---|
--node |
Update only Node.js packages. |
--python |
Update only Python packages. |
--dev |
Install or update development dependencies only. |
Set Nginx Port
If your production environment requires a custom Nginx port, use the
following command to update the site’s port configuration.
bench set-nginx-port [sitename] [port]
After changing the port, regenerate the Nginx configuration and reload
the Nginx service to apply the changes.
Important:
Any changes to production networking or Nginx configuration should be
followed by a configuration reload to ensure the new settings take effect.
Best Practices
- Use
bench configinstead of manually editing Bench configuration files whenever possible. - After modifying Nginx or Supervisor settings, regenerate the configuration before restarting services.
- Keep Python and Node.js dependencies up to date using
bench setup requirements. - Schedule automatic backups and updates for production environments.
- Configure a firewall to expose only the required ports for better security.