Skip to content

Environments

Alok Singh edited this page Jun 1, 2024 · 1 revision

fm provides two distinct environments for managing benches: production (prod) and development (dev). This flexibility allows users to create and update benches with specific configurations suitable for either environment.

Environment Details

Production Environment

  • Dev Packages: Development packages defined in Frappe's [tool.bench.dev-dependencies] section of the pyroject.toml are removed from bench's python env.
  • Supervisor Config: The Frappe production supervisor configuration is used, which runs the Frappe web application using Gunicorn server.

Development Environment

  • Dev Packages: Development packages defined in Frappe's [tool.bench.dev-dependencies] section of the pyroject.toml are installed into bench's python env.

  • Supervisor ConfigThe development supervisor configuration is used, which includes running the Frappe development server and watch service.

By managing these environments effectively, you can ensure that your benches are configured appropriately for their intended use, whether it be for production deployment or ongoing development. Below are the environment related operations which can be performed.

Creating a New Bench

To create a new bench, use the create command with the --env flag to specify the desired environment. If the --env flag is not provided, the create command defaults to the development environment.

fm create example.com --env <prod/dev>

Example: To create a bench in the production environment

fm create example.com --env prod

Updating an Existing Bench env

Using update command

You can update the environment of an existing bench using the update command along with the --env flag. This allows for changing the environment at any time.

fm update example.com --env <prod/dev>

Example: To change a bench's environment to development

fm update example.com --env dev

Using bench_config.toml file

Alternatively, you can update the bench's environment by modifying the bench_config.toml file. Change the environment_type key to either "prod" or "dev", and then run the startcommand to apply the changes.

Example: To change a bench's environment to Production

  • Update the config's key value pair with the specified below.

    # bench_config.toml
    environment_type = "prod"
  • Start the site again to reflect chagnes

    fm start <bench>