From 02b3cfcf0969a271c61b8c28d7eae6cf0212a3a2 Mon Sep 17 00:00:00 2001 From: sin-ev Date: Wed, 21 May 2025 23:09:19 +0200 Subject: [PATCH] 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. --- compose.yaml | 14 ++--- devcontainer-example/devcontainer.json | 13 +++-- devcontainer-example/docker-compose.yml | 70 ++++++++++++------------- development/Readme.md | 9 ++++ development/installer.py | 2 +- pwd.yml | 28 +++++----- 6 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 development/Readme.md diff --git a/compose.yaml b/compose.yaml index 7c8e64f2..42a4ae9a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -19,7 +19,7 @@ x-backend-defaults: &backend_defaults services: configurator: <<: *backend_defaults - platform: linux/amd64 + platform: linux/arm64 entrypoint: - bash - -c @@ -44,11 +44,11 @@ services: backend: <<: *backend_defaults - platform: linux/amd64 + platform: linux/arm64 frontend: <<: *customizable_image - platform: linux/amd64 + platform: linux/arm64 command: - nginx-entrypoint.sh environment: @@ -68,7 +68,7 @@ services: websocket: <<: [*depends_on_configurator, *customizable_image] - platform: linux/amd64 + platform: linux/arm64 command: - node - /home/frappe/frappe-bench/apps/frappe/socketio.js @@ -77,17 +77,17 @@ services: queue-short: <<: *backend_defaults - platform: linux/amd64 + platform: linux/arm64 command: bench worker --queue short,default queue-long: <<: *backend_defaults - platform: linux/amd64 + platform: linux/arm64 command: bench worker --queue long,default,short scheduler: <<: *backend_defaults - platform: linux/amd64 + platform: linux/arm64 command: bench schedule # ERPNext requires local assets access (Frappe does not) diff --git a/devcontainer-example/devcontainer.json b/devcontainer-example/devcontainer.json index 2e60f65d..239783fd 100644 --- a/devcontainer-example/devcontainer.json +++ b/devcontainer-example/devcontainer.json @@ -1,6 +1,10 @@ { "name": "Frappe Bench", - "forwardPorts": [8000, 9000, 6787], + "forwardPorts": [ + 8000, + 9000, + 6787 + ], "remoteUser": "frappe", "customizations": { "vscode": { @@ -9,7 +13,10 @@ "ms-vscode.live-server", "grapecity.gc-excelviewer", "mtxr.sqltools", - "visualstudioexptteam.vscodeintellicode" + "mtxr.sqltools-driver-pg", + "visualstudioexptteam.vscodeintellicode", + "ms-vscode-remote.remote-containers", + "vue.volar" ], "settings": { "terminal.integrated.profiles.linux": { @@ -29,4 +36,4 @@ "mounts": [ "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/frappe/.ssh,type=bind,consistency=cached" ] -} +} \ No newline at end of file diff --git a/devcontainer-example/docker-compose.yml b/devcontainer-example/docker-compose.yml index 3df5c417..d239b6ed 100644 --- a/devcontainer-example/docker-compose.yml +++ b/devcontainer-example/docker-compose.yml @@ -1,40 +1,40 @@ -version: "3.7" +version: '3.7' services: - mariadb: - image: docker.io/mariadb:10.6 - platform: linux/amd64 - 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: 123 - volumes: - - mariadb-data:/var/lib/mysql + # mariadb: + # image: docker.io/mariadb:10.6 + # platform: linux/amd64 + # 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: 123 + # volumes: + # - mariadb-data:/var/lib/mysql # Enable PostgreSQL only if you use it, see development/README.md for more information. - # postgresql: - # image: postgres:11.8 - # environment: - # POSTGRES_PASSWORD: 123 - # volumes: - # - postgresql-data:/var/lib/postgresql/data - + postgresql: + image: postgres:11.8 + environment: + POSTGRES_PASSWORD: 123 + volumes: + - postgresql-data:/var/lib/postgresql/data + # Uncomment the below lines to enable PostgreSQL # Enable Mailpit if you need to test outgoing mail services # See https://mailpit.axllent.org/ - # mailpit: - # image: axllent/mailpit - # volumes: - # - mailpit-data:/data - # ports: - # - 8025:8025 - # - 1025:1025 - # environment: - # MP_MAX_MESSAGES: 5000 - # MP_DATA_FILE: /data/mailpit.db - # MP_SMTP_AUTH_ACCEPT_ANY: 1 - # MP_SMTP_AUTH_ALLOW_INSECURE: 1 + mailpit: + image: axllent/mailpit + volumes: + - mailpit-data:/data + ports: + - 8025:8025 + - 1025:1025 + environment: + MP_MAX_MESSAGES: 5000 + MP_DATA_FILE: /data/mailpit.db + MP_SMTP_AUTH_ACCEPT_ANY: 1 + MP_SMTP_AUTH_ALLOW_INSECURE: 1 redis-cache: image: docker.io/redis:alpine @@ -86,6 +86,6 @@ services: # - ..:/workspace:z,cached # network_mode: "host" volumes: - mariadb-data: - #postgresql-data: - #mailpit-data: + # mariadb-data: + postgresql-data: + mailpit-data: diff --git a/development/Readme.md b/development/Readme.md new file mode 100644 index 00000000..e1f3b92e --- /dev/null +++ b/development/Readme.md @@ -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 +``` diff --git a/development/installer.py b/development/installer.py index edd62147..f20cca4a 100755 --- a/development/installer.py +++ b/development/installer.py @@ -223,7 +223,7 @@ def create_site_in_bench(args): new_site_cmd = [ "bench", "new-site", - f"--db-root-username=root", + f"--db-root-username=postgres", f"--db-host=postgresql", # Should match the compose service name f"--db-type={args.db_type}", # Add the selected database type f"--db-root-password=123", # Replace with your PostgreSQL password diff --git a/pwd.yml b/pwd.yml index a0fa6191..8ee18713 100644 --- a/pwd.yml +++ b/pwd.yml @@ -1,8 +1,8 @@ -version: "3" +version: '3' services: backend: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -13,12 +13,12 @@ services: - logs:/home/frappe/frappe-bench/logs environment: DB_HOST: db - DB_PORT: "3306" + DB_PORT: '3306' MYSQL_ROOT_PASSWORD: admin MARIADB_ROOT_PASSWORD: admin configurator: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -38,16 +38,16 @@ services: bench set-config -gp socketio_port $$SOCKETIO_PORT; environment: DB_HOST: db - DB_PORT: "3306" + DB_PORT: '3306' REDIS_CACHE: redis-cache:6379 REDIS_QUEUE: redis-queue:6379 - SOCKETIO_PORT: "9000" + SOCKETIO_PORT: '9000' volumes: - sites:/home/frappe/frappe-bench/sites - logs:/home/frappe/frappe-bench/logs create-site: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -102,7 +102,7 @@ services: - db-data:/var/lib/mysql frontend: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network depends_on: @@ -118,17 +118,17 @@ services: SOCKETIO: websocket:9000 UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1 UPSTREAM_REAL_IP_HEADER: X-Forwarded-For - UPSTREAM_REAL_IP_RECURSIVE: "off" + 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" + - '8080:8080' queue-long: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -144,7 +144,7 @@ services: - logs:/home/frappe/frappe-bench/logs queue-short: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -178,7 +178,7 @@ services: condition: on-failure scheduler: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: @@ -192,7 +192,7 @@ services: - logs:/home/frappe/frappe-bench/logs websocket: - image: frappe/erpnext:v15.61.1 + image: frappe/erpnext:latest networks: - frappe_network deploy: