Practical Guide to Deploying Empress Sites with Bench CLI

Introduction

Welcome to this comprehensive guide on deploying Empress based sites using the Bench CLI tool. Bench, as a CLI tool, is an essential part of managing Empress Framework sites. This guide will delve into the depth of deploying these sites in a production environment.

Installing Bench

First and foremost, you need to install Bench on your server. The process of deploying your Empress sites on a production server is similar to setting up on your local machine. Use the Easy Install script if your server is a supported Linux distribution like Debian, Ubuntu, or CentOS. Remember to include the --production flag in your command.

sudo python install.py --production --user [frappe-user]

Setting Up Sites and Apps

Once you’ve installed Bench, you can proceed to set up your sites and apps.

# Change directory to frappe-bench
cd frappe-bench

# Create a new site
bench new-site example.com

# Download frappe apps or your custom-apps
bench get-app erpnext
bench get-app https://github.com/yourremote/yourapp.git

# Install apps onto your site
bench --site example.com install-app erpnext yourapp

Checking Supervisor Status

With your sites and apps setup, you can now check the status of the Empress processes. The supervisor status output should give you a list of running processes.

$ sudo supervisorctl status

If your domain example.com is mapped to the IP Address of your server, your site should now be live on example.com.

Updating Your Sites

To ensure your sites and apps stay updated, you can use different Bench commands. You can update all apps (git pull), run patches on all sites, build JS and CSS assets, and restart the supervisor.

# Update everything
bench update

# Update apps only
bench update --pull

# Run patches only
bench update --patch

# Build assets only
bench update --build

# Update Bench (the CLI tool)
bench update --bench

# Update Python packages and node_modules
bench update --requirements

Using Redis Namespaces

The use of Redis namespaces helps to secure user’s data. You can have multiple benches use the same Redis instance without worrying about namespace conflicts. To enable Redis namespaces in Empress, you can use the bench create-rq-users CLI.

bench create-rq-users

# Optional flags
# --use-rq-auth Enable Redis authentication for all bench sites
# --set-admin-password sets default user admin password

This command generates an ACL file in the bench configs directory. Ensure that your redis_queue.conf file is configured to use an ACL file.

aclfile [frappe-bench-absolute-path]/config/redis_queue.acl

In conclusion, the Bench CLI tool is a powerful utility for managing and deploying Empress Framework sites. With a deep understanding of Bench, developers can effectively manage and customize their Empress-based sites, enhancing their business solutions’ quality and functionality.