Skip to content
Alok Singh edited this page Nov 1, 2024 · 19 revisions

How to

🛠️ Increase upload size limit

Adjusting Size Limit in global-nginx-proxy

Adjust the client_max_body_size directive value as needed.

Global Configuration

To apply the upload size limit to all sites, create a file named increase_upload_size_limit.conf (the name can be anything) in the ~/frappe/services/nginx-proxy/confd directory with the following content:

client_max_body_size 100m;

Site-Specific Configuration

For a specific site, such as example.com, create a file named example.com_location (the name can be anything) in the ~/frappe/services/nginx-proxy/vhostd directory with the following content:

client_max_body_size 100m;

After making the above changes, restart global-nginx-proxy using the following command

fm services restart global-nginx-proxy

Configuring Bench nginx

Edit the file located at ~/frappe/sites/<bench name>/configs/nginx/conf.d/default.conf and modify the client_max_body_size directive:

client_max_body_size 100m;

After making the above changes, restart global-nginx-proxy using the following command

fm start <bench name> -f

Changing the Max Upload Size in Frappe

This can be done via the dashboard or by editing site_config.json.

Using Frappe Desk

  1. Open Frappe Desk.
  2. Navigate to Search > System Settings.
  3. In the Files tab, change the Max File Size (MB) field.

Using site_config.json

  1. Open site_config.json in your preferred editor.
  2. Add the key "max_file_size": "104857600" (100 MB), with the value in bytes.

🛠️ Restart frappe dev server

  • Open frappe container shell fm shell <sitename>
  • Run bench restart.

🛠️ Logs location

Here are the location you should check for logs.

CLI log

CLI logs can be found at /home/<user>/frappe/logs/fm.log

Frappe dev server logs

Frappe dev server log can be found at:

  • /home/<user>/frappe/sites/<sitename>/workspace/frappe-bench/logs/web.dev.log
  • /home/<user>/frappe/sites/<sitename>/workspace/logs/bench-start.log (will be deprecated)

🛠️ Check frappe dev server logs

To check the logs you can tail the above files or use fm logs <sitename> --follow this will show the logs. All other Bench-related logs are in the ./logs directory relative to the Bench environment.

🛠️ Install Frappe apps

  • Run fm shell <sitename> to open the site shell.
  • Change directory to frappe-bench.
  • Install the app e.g erpnext
    bench get-app erpnext
  • Then restart frappe python env dependent services using
    fm restart <sitename>
    

🛠️ Install custom app

  • Copy your custom app to /home/<user>/frappe/sites/<site>/workspace dir.
  • Run fm shell <sitename> to open the site shell.
  • Change directory to frappe-bench.
  • Install the app
    bench get-app /workspace/custom-app
  • Then restart frappe python env dependent services using
    fm restart <sitename>
    

🛠️ Create custom app

  • To create a custom app, use the following command in the Frappe container shell within the Bench environment:
    bench new-app example_app

🛠️ Run bench commands

  • Open site shell. fm shell <sitename>
  • cd to frappe-bench. cd frappe-bench
  • You can run your bench commands here.

🛠️ Restart bench environment server

To restart the development server of Frappe which is started by using bench start, you can use the command bench restart in the frappe container.

🛠️ VSCode Integration

The fm code <sitename> command opens VSCode and attaches it to the container. This enables full-featured IDE development. Default extensions are provided, and additional extensions can be installed using the --extension/-e flag.

Run bench commands in vscode

If you have used fm code <sitename>, make sure you are in the Bench environment directory. You can run Bench commands directly in the VSCode terminal.

Restart frappe dev server in vscode

Run bench restart in vscode terminal.

🛠️ Develop apps utilizing Google API

  • Subdomains of localhost, like example.localhost, are not supported as a redirect URI in Google Cloud. To fix this issue:
    • Use localhost as the redirect URI in Google Cloud.
    • Run ln -sfn <replace-with-current-sitename.localhost> localhost in the sites directory relative to the root of the Bench environment.

🛠️ fm create <sitename> command fails

  • First delete the site or it will not run. fm delete <sitename>
  • Now follow this checklist for error and solution.

Checklist

  • Error response from daemon: Get https://ghcr.io/v2/rtcamp/frappe-manager-mailhog/manifests/v0.8.3: denied: denied
    When you're logged into the Docker ghcr.io registry and your GitHub Personal Access Token (PAT) has expired, you'll encounter this issue. There are two solutions available, so choose the one that suits you best:
    • Log out of the Docker ghcr.io registry by executing this command: docker logout ghcr.io then rerun fm command.
      OR
    • Generate a new PAT, use it for re-login into ghcr.io, and then rerun fm command.

🛠️ Does it work on WSL

  • Yes. We tested it locally on our WSL setup and it works fine.
    • After creating a site, add your site to the hosts file in your windows. Go to C:\Windows\System32\drivers\etc\hosts and add 127.0.0.1 <sitename>.localhost at the end of the file. This will allow you to access the site locally in your windows machine
    • You need to have admin access to edit this file. And also open the file editor [say notepad] in admin mode (Run as administrator).
Checklist
  • WSL version: 2.0.3.0 // This is WSL 2 preview version. Normal one should work fine as well
  • Kernel version: 5.15.123.1-1
  • WSLg version: 1.0.58
  • WinVer: Win 11 Pro 23H2 (OS Build 22631.3235)
Clone this wiki locally