DEV Community

Dhruv Kumar
Dhruv Kumar

Posted on

Frappe Docker Development Setup Guide for Custom Apps

This guide outlines the steps to set up a development environment using Frappe Docker, which will enable you to develop and debug Frappe and Frappe-based applications efficiently.

Prerequisites

Ensure you have the following installed on your system:

  1. Docker: A containerization platform.
  2. Docker Compose: A tool for defining and running multi-container Docker applications.
  3. Git: A version control system.
  4. Visual Studio Code (VSCode): A source-code editor that supports the DevContainer extension.

Setup Instructions

Clone the Repository

Start by cloning the frappe_docker repository and navigate into the directory:

git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker
Enter fullscreen mode Exit fullscreen mode

Configure Development Container

Copy the example development container configuration:

cp -R devcontainer-example .devcontainer
Enter fullscreen mode Exit fullscreen mode

Copy the VSCode configuration for the development container to set up basic debugging capabilities:

cp -R development/vscode-example development/.vscode
Enter fullscreen mode Exit fullscreen mode

Open in VSCode

Open the project in VSCode. If the Remote Containers extension is installed, you should see a prompt to reopen the project in a container. If not, reload the window or press Ctrl + Shift + P, then search for and select "Rebuild and Reopen in Container".

Modify Application Configuration

Edit apps-example.json to point to the correct repository and branch for your application:

[
  {
    "url": "https://{{PAT}}@github.com/example/your_private_repo.git",
    "branch": "main"  // can change according
  }
]
Enter fullscreen mode Exit fullscreen mode

Replace {{PAT}} with your GitHub Personal Access Token (PAT).

Reference Link : https://docs.github.com/en/enterprise-server@3.9/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

Install Dependencies and Setup Application

Run the Python installer script with the appropriate repository and tag:

python installer.py -r {{your_forked_frappe_repo}} -t {{forked_repo_branch_name}} -p {{python-version}}
Enter fullscreen mode Exit fullscreen mode

Reference Link : https://github.com/frappe/frappe_docker/blob/main/docs/development.md

Activate the Python virtual environment:

source env/bin/activate
Enter fullscreen mode Exit fullscreen mode

Navigate to the application directory, and install the required Python packages:

cd apps/{{you_app_name}}/
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Set the default site in Bench:

bench use development.localhost
Enter fullscreen mode Exit fullscreen mode

Start the Development Server

Navigate back to the frappe-bench directory and start the development server using either of the following commands:

cd ../frappe-bench
bench start
Enter fullscreen mode Exit fullscreen mode

or

honcho start web socketio watch schedule worker
Enter fullscreen mode Exit fullscreen mode

Conclusion

Following these steps will set up your Frappe Docker development environment, allowing you to develop and debug applications within a containerized environment seamlessly.

Top comments (0)