Directory structure
When you initialize a new **frappe-bench** directory, you will have a directory structure similar to:
.
├── apps
├── frappe
├── config
├── redis\_cache.conf
├── redis\_queue.conf
└── redis\_socketio.conf
├── env
├── logs
├── Procfile
└── sites
├── apps.txt
├── assets
├── common\_site\_config.json
└── site1.local
├── private
├── public
└── site\_config.json
apps
The frappe
app and other frappe based apps live in this directory. When you
run the command bench new-app app\_name
, the app will be bootstrapped in this
directory. Your custom apps live here and you are supposed to edit/work with
them here.
Learn more about apps.
sites
Sites are served from this directory. When you run the command bench new-site
site\_name
, the site will be created in this directory. Sites are distinguished
based on their directory name.
Learn more about sites.
logs
This directory is used to dump log files from various processes. Each log file is named based on the process it is logged from.
config
Frappe uses 3 Redis instances to manage caching, job queueing and socketio communication. All of those configurations live here.
env
The Python virtual environment live in this directory. Frappe based apps and Python package dependencies are installed here.
Procfile
Frappe uses Procfile based process management. The default Procfile looks something like this:
redis\_cache: redis-server config/redis\_cache.conf
redis\_socketio: redis-server config/redis\_socketio.conf
redis\_queue: redis-server config/redis\_queue.conf
web: bench serve --port 8000
socketio: /usr/bin/node apps/frappe/socketio.js
watch: bench watch
schedule: bench schedule
worker\_short: bench worker --queue short --quiet
worker\_long: bench worker --queue long --quiet
worker\_default: bench worker --queue default --quiet
Let's see what each process is used for.
redis\_cache:
Redis used for in-memory caching.
redis\_socketio:
Redis used as a pub/sub between web
and socketio
processes for realtime communication.
redis\_queue:
Redis used for managing background jobs queuing.
web:
Python web server based on Werkzeug.
socketio:
Node server for a socketio connection with the browser for realtime communication.
watch:
Node server for bundling JS/CSS assets using Rollup. It will also rebuild files as they change.
schedule:
Job Scheduler using Python RQ.
worker\_short:
Python worker with a (short) timeout of 300s.
worker\_long:
Python worker with a (long) timeout of 1500s.
worker\_default:
Python worker with a timeout of 300s.