mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-25 16:55:08 +00:00
inital commit
This commit is contained in:
parent
a495cc8c0a
commit
f747020103
5 changed files with 318 additions and 16 deletions
32
.devcontainer/devcontainer.json
Normal file
32
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"name": "Frappe Bench",
|
||||||
|
"forwardPorts": [8000, 9000, 6787],
|
||||||
|
"remoteUser": "frappe",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-vscode.live-server",
|
||||||
|
"grapecity.gc-excelviewer",
|
||||||
|
"mtxr.sqltools",
|
||||||
|
"visualstudioexptteam.vscodeintellicode"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.profiles.linux": {
|
||||||
|
"frappe bash": {
|
||||||
|
"path": "/bin/bash"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"terminal.integrated.defaultProfile.linux": "frappe bash",
|
||||||
|
"debug.node.autoAttach": "disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dockerComposeFile": "./docker-compose.yml",
|
||||||
|
"service": "frappe",
|
||||||
|
"workspaceFolder": "/workspace/development",
|
||||||
|
"shutdownAction": "stopCompose",
|
||||||
|
"mounts": [
|
||||||
|
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/frappe/.ssh,type=bind,consistency=cached"
|
||||||
|
]
|
||||||
|
}
|
||||||
186
.devcontainer/docker-compose.yml
Normal file
186
.devcontainer/docker-compose.yml
Normal file
|
|
@ -0,0 +1,186 @@
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
configurator:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: none
|
||||||
|
entrypoint:
|
||||||
|
- bash
|
||||||
|
- -c
|
||||||
|
# add redis_socketio for backward compatibility
|
||||||
|
command:
|
||||||
|
- >
|
||||||
|
ls -1 apps > sites/apps.txt;
|
||||||
|
bench set-config -g db_host $$DB_HOST;
|
||||||
|
bench set-config -gp db_port $$DB_PORT;
|
||||||
|
bench set-config -g redis_cache "redis://$$REDIS_CACHE";
|
||||||
|
bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
|
||||||
|
bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
|
||||||
|
bench set-config -gp socketio_port $$SOCKETIO_PORT;
|
||||||
|
environment:
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: "3306"
|
||||||
|
REDIS_CACHE: redis-cache:6379
|
||||||
|
REDIS_QUEUE: redis-queue:6379
|
||||||
|
SOCKETIO_PORT: "9000"
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
create-site:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: none
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
entrypoint:
|
||||||
|
- bash
|
||||||
|
- -c
|
||||||
|
command:
|
||||||
|
- >
|
||||||
|
wait-for-it -t 120 db:3306;
|
||||||
|
wait-for-it -t 120 redis-cache:6379;
|
||||||
|
wait-for-it -t 120 redis-queue:6379;
|
||||||
|
export start=`date +%s`;
|
||||||
|
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
|
||||||
|
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
|
||||||
|
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
|
||||||
|
do
|
||||||
|
echo "Waiting for sites/common_site_config.json to be created";
|
||||||
|
sleep 5;
|
||||||
|
if (( `date +%s`-start > 120 )); then
|
||||||
|
echo "could not find sites/common_site_config.json with required keys";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done;
|
||||||
|
echo "sites/common_site_config.json found";
|
||||||
|
bench new-site --no-mariadb-socket --admin-password=admin --db-root-password=admin --install-app erpnext --set-default frontend;
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:10.6
|
||||||
|
healthcheck:
|
||||||
|
test: mysqladmin ping -h localhost --password=admin
|
||||||
|
interval: 1s
|
||||||
|
retries: 15
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- --character-set-server=utf8mb4
|
||||||
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
- --skip-character-set-client-handshake
|
||||||
|
- --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: admin
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
depends_on:
|
||||||
|
- websocket
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- nginx-entrypoint.sh
|
||||||
|
environment:
|
||||||
|
BACKEND: backend:8000
|
||||||
|
FRAPPE_SITE_NAME_HEADER: frontend
|
||||||
|
SOCKETIO: websocket:9000
|
||||||
|
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
|
||||||
|
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
|
||||||
|
UPSTREAM_REAL_IP_RECURSIVE: "off"
|
||||||
|
PROXY_READ_TIMEOUT: 120
|
||||||
|
CLIENT_MAX_BODY_SIZE: 50m
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
|
||||||
|
queue-long:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- bench
|
||||||
|
- worker
|
||||||
|
- --queue
|
||||||
|
- long,default,short
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
queue-short:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- bench
|
||||||
|
- worker
|
||||||
|
- --queue
|
||||||
|
- short,default
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
redis-queue:
|
||||||
|
image: redis:6.2-alpine
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
volumes:
|
||||||
|
- redis-queue-data:/data
|
||||||
|
|
||||||
|
redis-cache:
|
||||||
|
image: redis:6.2-alpine
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
volumes:
|
||||||
|
- redis-cache-data:/data
|
||||||
|
|
||||||
|
scheduler:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- bench
|
||||||
|
- schedule
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
websocket:
|
||||||
|
image: frappe/erpnext:v15.27.6
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
command:
|
||||||
|
- node
|
||||||
|
- /home/frappe/frappe-bench/apps/frappe/socketio.js
|
||||||
|
volumes:
|
||||||
|
- sites:/home/frappe/frappe-bench/sites
|
||||||
|
- logs:/home/frappe/frappe-bench/logs
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
|
redis-queue-data:
|
||||||
|
redis-cache-data:
|
||||||
|
sites:
|
||||||
|
logs:
|
||||||
32
.gitignore
vendored
32
.gitignore
vendored
|
|
@ -1,30 +1,30 @@
|
||||||
# Environment Variables
|
# Environment Variables
|
||||||
.env
|
# .env
|
||||||
|
|
||||||
# mounted volume
|
# mounted volume
|
||||||
sites
|
# sites
|
||||||
|
|
||||||
development/*
|
# development/*
|
||||||
!development/README.md
|
# !development/README.md
|
||||||
!development/installer.py
|
# !development/installer.py
|
||||||
!development/apps-example.json
|
# !development/apps-example.json
|
||||||
!development/vscode-example/
|
# !development/vscode-example/
|
||||||
|
|
||||||
# Pycharm
|
# Pycharm
|
||||||
.idea
|
# .idea
|
||||||
|
|
||||||
# VS Code
|
# VS Code
|
||||||
.vscode/**
|
# .vscode/**
|
||||||
!.vscode/extensions.json
|
# !.vscode/extensions.json
|
||||||
|
|
||||||
# VS Code devcontainer
|
# VS Code devcontainer
|
||||||
.devcontainer
|
# .devcontainer
|
||||||
*.code-workspace
|
# *.code-workspace
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
*.pyc
|
# *.pyc
|
||||||
__pycache__
|
# __pycache__
|
||||||
venv
|
# venv
|
||||||
|
|
||||||
# NodeJS
|
# NodeJS
|
||||||
node_modules
|
# node_modules
|
||||||
|
|
|
||||||
81
development/.vscode/launch.json
vendored
Normal file
81
development/.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Bench Web",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": [
|
||||||
|
"frappe",
|
||||||
|
"serve",
|
||||||
|
"--port",
|
||||||
|
"8000",
|
||||||
|
"--noreload",
|
||||||
|
"--nothreading"
|
||||||
|
],
|
||||||
|
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Short Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": ["frappe", "worker", "--queue", "short"],
|
||||||
|
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Long Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": ["frappe", "worker", "--queue", "long"],
|
||||||
|
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Bench Console",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
|
||||||
|
"args": ["frappe", "--site", "development.localhost", "console"],
|
||||||
|
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench/sites",
|
||||||
|
"env": {
|
||||||
|
"DEV_SERVER": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Honcho SocketIO Watch Schedule Worker",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "/home/frappe/.local/bin/honcho",
|
||||||
|
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
|
||||||
|
"cwd": "${workspaceFolder}/frappe-bench",
|
||||||
|
"console": "internalConsole",
|
||||||
|
"args": [
|
||||||
|
"start",
|
||||||
|
"socketio",
|
||||||
|
"watch",
|
||||||
|
"schedule",
|
||||||
|
"worker_short",
|
||||||
|
"worker_long",
|
||||||
|
"worker_default"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
development/.vscode/settings.json
vendored
Normal file
3
development/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"python.defaultInterpreterPath": "${workspaceFolder}/frappe-bench/env/bin/python"
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue