local enviroment

Switches default local setup to PostgreSQL and ARM64

Updates local development environment to use PostgreSQL instead of MariaDB by default, aligns configuration and documentation, and switches Docker service platforms to ARM64 for broader compatibility.

Improves developer experience and readiness for ARM-based systems.
This commit is contained in:
sin-ev 2025-05-21 23:09:19 +02:00
parent 6f90142716
commit 02b3cfcf09
No known key found for this signature in database
6 changed files with 76 additions and 60 deletions

View file

@ -19,7 +19,7 @@ x-backend-defaults: &backend_defaults
services: services:
configurator: configurator:
<<: *backend_defaults <<: *backend_defaults
platform: linux/amd64 platform: linux/arm64
entrypoint: entrypoint:
- bash - bash
- -c - -c
@ -44,11 +44,11 @@ services:
backend: backend:
<<: *backend_defaults <<: *backend_defaults
platform: linux/amd64 platform: linux/arm64
frontend: frontend:
<<: *customizable_image <<: *customizable_image
platform: linux/amd64 platform: linux/arm64
command: command:
- nginx-entrypoint.sh - nginx-entrypoint.sh
environment: environment:
@ -68,7 +68,7 @@ services:
websocket: websocket:
<<: [*depends_on_configurator, *customizable_image] <<: [*depends_on_configurator, *customizable_image]
platform: linux/amd64 platform: linux/arm64
command: command:
- node - node
- /home/frappe/frappe-bench/apps/frappe/socketio.js - /home/frappe/frappe-bench/apps/frappe/socketio.js
@ -77,17 +77,17 @@ services:
queue-short: queue-short:
<<: *backend_defaults <<: *backend_defaults
platform: linux/amd64 platform: linux/arm64
command: bench worker --queue short,default command: bench worker --queue short,default
queue-long: queue-long:
<<: *backend_defaults <<: *backend_defaults
platform: linux/amd64 platform: linux/arm64
command: bench worker --queue long,default,short command: bench worker --queue long,default,short
scheduler: scheduler:
<<: *backend_defaults <<: *backend_defaults
platform: linux/amd64 platform: linux/arm64
command: bench schedule command: bench schedule
# ERPNext requires local assets access (Frappe does not) # ERPNext requires local assets access (Frappe does not)

View file

@ -1,6 +1,10 @@
{ {
"name": "Frappe Bench", "name": "Frappe Bench",
"forwardPorts": [8000, 9000, 6787], "forwardPorts": [
8000,
9000,
6787
],
"remoteUser": "frappe", "remoteUser": "frappe",
"customizations": { "customizations": {
"vscode": { "vscode": {
@ -9,7 +13,10 @@
"ms-vscode.live-server", "ms-vscode.live-server",
"grapecity.gc-excelviewer", "grapecity.gc-excelviewer",
"mtxr.sqltools", "mtxr.sqltools",
"visualstudioexptteam.vscodeintellicode" "mtxr.sqltools-driver-pg",
"visualstudioexptteam.vscodeintellicode",
"ms-vscode-remote.remote-containers",
"vue.volar"
], ],
"settings": { "settings": {
"terminal.integrated.profiles.linux": { "terminal.integrated.profiles.linux": {
@ -29,4 +36,4 @@
"mounts": [ "mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/frappe/.ssh,type=bind,consistency=cached" "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/frappe/.ssh,type=bind,consistency=cached"
] ]
} }

View file

@ -1,40 +1,40 @@
version: "3.7" version: '3.7'
services: services:
mariadb: # mariadb:
image: docker.io/mariadb:10.6 # image: docker.io/mariadb:10.6
platform: linux/amd64 # platform: linux/amd64
command: # command:
- --character-set-server=utf8mb4 # - --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci # - --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake # - --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6 # - --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
environment: # environment:
MYSQL_ROOT_PASSWORD: 123 # MYSQL_ROOT_PASSWORD: 123
volumes: # volumes:
- mariadb-data:/var/lib/mysql # - mariadb-data:/var/lib/mysql
# Enable PostgreSQL only if you use it, see development/README.md for more information. # Enable PostgreSQL only if you use it, see development/README.md for more information.
# postgresql: postgresql:
# image: postgres:11.8 image: postgres:11.8
# environment: environment:
# POSTGRES_PASSWORD: 123 POSTGRES_PASSWORD: 123
# volumes: volumes:
# - postgresql-data:/var/lib/postgresql/data - postgresql-data:/var/lib/postgresql/data
# Uncomment the below lines to enable PostgreSQL
# Enable Mailpit if you need to test outgoing mail services # Enable Mailpit if you need to test outgoing mail services
# See https://mailpit.axllent.org/ # See https://mailpit.axllent.org/
# mailpit: mailpit:
# image: axllent/mailpit image: axllent/mailpit
# volumes: volumes:
# - mailpit-data:/data - mailpit-data:/data
# ports: ports:
# - 8025:8025 - 8025:8025
# - 1025:1025 - 1025:1025
# environment: environment:
# MP_MAX_MESSAGES: 5000 MP_MAX_MESSAGES: 5000
# MP_DATA_FILE: /data/mailpit.db MP_DATA_FILE: /data/mailpit.db
# MP_SMTP_AUTH_ACCEPT_ANY: 1 MP_SMTP_AUTH_ACCEPT_ANY: 1
# MP_SMTP_AUTH_ALLOW_INSECURE: 1 MP_SMTP_AUTH_ALLOW_INSECURE: 1
redis-cache: redis-cache:
image: docker.io/redis:alpine image: docker.io/redis:alpine
@ -86,6 +86,6 @@ services:
# - ..:/workspace:z,cached # - ..:/workspace:z,cached
# network_mode: "host" # network_mode: "host"
volumes: volumes:
mariadb-data: # mariadb-data:
#postgresql-data: postgresql-data:
#mailpit-data: mailpit-data:

9
development/Readme.md Normal file
View file

@ -0,0 +1,9 @@
# Readme
## Installation
With installer.py, you must change the root-username to postgres and setup the password in the postgres image to the same as the one you set in the installer.py.
```shell
python installer.py --db-type postgres
```

View file

@ -223,7 +223,7 @@ def create_site_in_bench(args):
new_site_cmd = [ new_site_cmd = [
"bench", "bench",
"new-site", "new-site",
f"--db-root-username=root", f"--db-root-username=postgres",
f"--db-host=postgresql", # Should match the compose service name f"--db-host=postgresql", # Should match the compose service name
f"--db-type={args.db_type}", # Add the selected database type f"--db-type={args.db_type}", # Add the selected database type
f"--db-root-password=123", # Replace with your PostgreSQL password f"--db-root-password=123", # Replace with your PostgreSQL password

28
pwd.yml
View file

@ -1,8 +1,8 @@
version: "3" version: '3'
services: services:
backend: backend:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -13,12 +13,12 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
environment: environment:
DB_HOST: db DB_HOST: db
DB_PORT: "3306" DB_PORT: '3306'
MYSQL_ROOT_PASSWORD: admin MYSQL_ROOT_PASSWORD: admin
MARIADB_ROOT_PASSWORD: admin MARIADB_ROOT_PASSWORD: admin
configurator: configurator:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -38,16 +38,16 @@ services:
bench set-config -gp socketio_port $$SOCKETIO_PORT; bench set-config -gp socketio_port $$SOCKETIO_PORT;
environment: environment:
DB_HOST: db DB_HOST: db
DB_PORT: "3306" DB_PORT: '3306'
REDIS_CACHE: redis-cache:6379 REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379 REDIS_QUEUE: redis-queue:6379
SOCKETIO_PORT: "9000" SOCKETIO_PORT: '9000'
volumes: volumes:
- sites:/home/frappe/frappe-bench/sites - sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
create-site: create-site:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -102,7 +102,7 @@ services:
- db-data:/var/lib/mysql - db-data:/var/lib/mysql
frontend: frontend:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
depends_on: depends_on:
@ -118,17 +118,17 @@ services:
SOCKETIO: websocket:9000 SOCKETIO: websocket:9000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1 UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off" UPSTREAM_REAL_IP_RECURSIVE: 'off'
PROXY_READ_TIMEOUT: 120 PROXY_READ_TIMEOUT: 120
CLIENT_MAX_BODY_SIZE: 50m CLIENT_MAX_BODY_SIZE: 50m
volumes: volumes:
- sites:/home/frappe/frappe-bench/sites - sites:/home/frappe/frappe-bench/sites
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
ports: ports:
- "8080:8080" - '8080:8080'
queue-long: queue-long:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -144,7 +144,7 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
queue-short: queue-short:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -178,7 +178,7 @@ services:
condition: on-failure condition: on-failure
scheduler: scheduler:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy:
@ -192,7 +192,7 @@ services:
- logs:/home/frappe/frappe-bench/logs - logs:/home/frappe/frappe-bench/logs
websocket: websocket:
image: frappe/erpnext:v15.61.1 image: frappe/erpnext:latest
networks: networks:
- frappe_network - frappe_network
deploy: deploy: