Architecture - rtCamp/Frappe-Manager GitHub Wiki
The frappe-manager Python package introduces the fm command, serving as the entry point for the Frappe-Manager project. It offers a range of key functionalities:
-
Metadata Generation: Automatically generates vital metadata essential for setting up a Bench environment. This includes the bench name, admin password, and a list of Frappeverse apps to be installed.
-
Docker Compose Configuration: Customizes and generates a Docker Compose project using the generated metadata. This project encompasses various services necessary to support Frappe development effectively.
-
Docker Compose Management: Simplifies Docker Compose project management by wrapping the Docker Compose CLI. This facilitates easy control and orchestration of containers within the development environment.
-
Environment Management Commands: Equips developers with commands to efficiently manage the FrappeManager environment, streamlining common development tasks and enhancing productivity.
-
CLI Directory Creation: Automatically creates a directory at
~/frappeto store Frappe-Manager managed benches. This directory includes several subdirectories tailored for different purposes:Directory Purpose logsStores CLI logs sitesHouses Docker Compose projects for benches migrationContains migration backups archivedStores failed migrated benches servicesManages Docker Compose projects for services
- Located at
~/frappe/services. - Manages these two services:
- On MacOS, The
userdirective in Docker Compose is not utilized in OSX because the osxfs file system driver automatically handles UID/GID remapping. This ensures that files created within the container maintain the correct permissions when accessed from the host, and vice versa. - On Linux, the
userdirective is used to specify the user (and group) under which the container runs. This is often necessary to prevent permission issues on Linux.
-
global-db:
-
This service serves as the central database for all benches. All bench databases are stored here.
-
Uses
mariadb:10.6image. -
The database credentials and configuration are stored in Docker secrets.
-
The following directories are mounted for this service:
Source Destination Purpose fm-global-db-data/var/lib/mysqlDatabase data (OSX) ./mariadb/data/var/lib/mysqlDatabase data (Linux) ./mariadb/conf/etc/mysqlConfiguration files ./mariadb/logs/var/log/mysqlLog files
-
-
global-nginx-proxy:
-
This service functions as a reverse proxy for all benches and exposes ports
80and443to host. -
Uses
jwilder/nginx-proxyimage. -
The following directories are mounted for this service:
Source Destination Purpose ./nginx-proxy/certs/etc/nginx/certsSSL certificates ./nginx-proxy/dhparam/etc/nginx/dhparamDiffie-Hellman parameters ./nginx-proxy/confd/etc/nginx/conf.dConfig files generated by docker gen ./nginx-proxy/htpasswd/etc/nginx/htpasswdHTTP Basic Authentication ./nginx-proxy/vhostd/etc/nginx/vhost.dvhost configuration ./nginx-proxy/html/usr/share/nginx/htmlStatic HTML files ./nginx-proxy/logs/var/log/nginxLog files ./nginx-proxy/run/var/runPID files ./nginx-proxy/ssl/usr/share/nginx/sslSSL service related files ./nginx-proxy/cache/var/cache/nginxcaching /var/run/docker.sock/tmp/docker.sock:roDocker socket
-
- Bench compose compose project compose off bench services, worker services and Admin Tools services.
- Bench configuration can be changed using
bench_config.tomlconfiguration file. Which is created after a bench is created. - Workers services are set to active by default and remain operational as long as the bench is running.
- Admin tools services are enabled and disabled based on
bench_config.toml.
-
Frappe (custom build):
- Configures the server environment, including setting up pyenv and server-specific configurations.
- Creates a Bench environment for Frappe app development.
- Installs required Frappeverse apps.
- Creates and manages Frappe sites with associated databases.
- Initiates Supervisor as the init process, containing a service for starting the Frappe development server.
-
Nginx (custom build):
- Extends the features of the official Nginx Docker image.
- Incorporates input from the
frappe-managerPython package to create bench-specific Nginx configurations from templates.
-
redis-cache, redis-queue, redis-socketio: They set up Redis servers for caching, queuing, and real-time communication.
-
socketio: It sets up a Socket.IO server for real-time communication.
-
schedule: It sets up a scheduler for running background tasks.
- long worker: Worker for frappe long queue.
- short worker: Worker for frappe short queue.
- Adminer: A fully-featured database management tool, serving as an alternative to phpMyAdmin for database management.
-
Mailhog (custom build):
- Custom build provided arm64 supported image.
- An email testing tool with a fake SMTP server underneath, enabling email testing during development.
- Stored in
/home/<user>/frappe/logs/fm.log - Logs contains:
- every fm command invoked by user.
- executed docker commands, command output and return code.
- exception happend during runtime.
- Logs are rotated when the log size hits
10MB, the previous file is compressed asfm.log.1when rotate limit is reached and only 3 such files are kept.