diff --git a/bin/bench.sh b/bin/bench.sh new file mode 100755 index 00000000..e5420292 --- /dev/null +++ b/bin/bench.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker compose -p ranch exec backend bench ${@:1} diff --git a/bin/dev-destroy.sh b/bin/dev-destroy.sh new file mode 100755 index 00000000..80baec2d --- /dev/null +++ b/bin/dev-destroy.sh @@ -0,0 +1,9 @@ +#!/bin/bash +docker compose \ + -p ranch \ + -f compose.yaml \ + -f overrides/compose.redis.yaml \ + -f overrides/compose.postgres.yaml \ + -f overrides/compose.proxy.yaml \ + -f compose.my-local-dev.yaml \ + down --volumes --remove-orphans diff --git a/bin/dev-setup.sh b/bin/dev-setup.sh new file mode 100755 index 00000000..b731f874 --- /dev/null +++ b/bin/dev-setup.sh @@ -0,0 +1,24 @@ +#!/bin/bash +bin/bench.sh new-site ranch.localhost \ + --db-root-username=root \ + --db-host=db \ + --db-type=mariadb \ + --mariadb-user-host-login-scope=% \ + --db-root-password=123 \ + --admin-password=123 + +bin/bench.sh --site ranch.localhost set-config developer_mode true + +bin/bench.sh --site ranch.localhost install-app erpnext + +for app in $(find apps -mindepth 1 -maxdepth 1 -type d | xargs -n1 basename); do + docker compose -p ranch exec backend bash -lc "cd /home/frappe/frappe-bench && ./env/bin/pip install -e apps/${app}" + docker compose -p ranch exec backend bash -lc "cd /home/frappe/frappe-bench; grep -qxF ${app} sites/apps.txt || printf '%s\\n' '${app}' >> sites/apps.txt" + bin/bench.sh --site ranch.localhost install-app "${app}" +done + +bin/bench.sh --site ranch.localhost migrate +bin/bench.sh --site ranch.localhost clear-cache +docker compose -p ranch restart backend queue-short queue-long scheduler + +echo "Done! Access your local dev environment at http://ranch.localhost" diff --git a/bin/dev-up.sh b/bin/dev-up.sh new file mode 100755 index 00000000..2f915dc0 --- /dev/null +++ b/bin/dev-up.sh @@ -0,0 +1,10 @@ +#!/bin/bash +docker compose \ + --env-file .env \ + -f compose.yaml \ + -p ranch \ + -f overrides/compose.redis.yaml \ + -f overrides/compose.mariadb.yaml \ + -f overrides/compose.proxy.yaml \ + -f compose.my-local-dev.yaml \ + up diff --git a/compose.my-local-dev.yaml b/compose.my-local-dev.yaml new file mode 100644 index 00000000..f46daf94 --- /dev/null +++ b/compose.my-local-dev.yaml @@ -0,0 +1,20 @@ +x-local-app: &local_app + environment: + PYTHONPATH: /home/frappe/frappe-bench/apps/testing + ERPNEXT_VERSION: v16.22.0 + volumes: + - sites:/home/frappe/frappe-bench/sites + - ./apps/testing:/home/frappe/frappe-bench/apps/testing + +services: + backend: + <<: *local_app + + queue-short: + <<: *local_app + + queue-long: + <<: *local_app + + scheduler: + <<: *local_app