The current init.sh script has two problems that prevent a smooth setup:
-
Yarn is not installed
- The script doesn’t install Yarn, which is required for Frappe/ERPNext builds.
- Running
bench build fails unless Yarn is installed manually.
-
Redis URLs are incorrect
- The script sets Redis hosts using
bench set-redis-* but appends the port directly in the URL (e.g., redis-cache:6379).
- This results in connection issues, since
bench set-redis-cache-host expects just the hostname (e.g., redis-cache), not host:port.
Current init.sh (for reference):
#!bin/bash
set -e
if [[ -f "/workspaces/frappe_codespace/frappe-bench/apps/frappe" ]]
then
echo "Bench already exists, skipping init"
exit 0
fi
rm -rf /workspaces/frappe_codespace/.git
source /home/frappe/.nvm/nvm.sh
nvm alias default 18
nvm use 18
echo "nvm use 18" >> ~/.bashrc
cd /workspace
bench init \
--ignore-exist \
--skip-redis-config-generation \
frappe-bench
cd frappe-bench
# Use containers instead of localhost
bench set-mariadb-host mariadb
bench set-redis-cache-host redis-cache:6379
bench set-redis-queue-host redis-queue:6379
bench set-redis-socketio-host redis-socketio:6379
# Remove redis from Procfile
sed -i '/redis/d' ./Procfile
bench new-site dev.localhost \
--mariadb-root-password 123 \
--admin-password admin \
--no-mariadb-socket
bench --site dev.localhost set-config developer_mode 1
bench --site dev.localhost clear-cache
bench use dev.localhost
Suggested Fix:
- Install Yarn in the script (e.g.,
npm install -g yarn).
- Update Redis host commands to remove
:6379 and only set hostnames.
Example:
npm install -g yarn
bench set-redis-cache-host redis-cache
bench set-redis-queue-host redis-queue
bench set-redis-socketio-host redis-socketio
The current
init.shscript has two problems that prevent a smooth setup:Yarn is not installed
bench buildfails unless Yarn is installed manually.Redis URLs are incorrect
bench set-redis-*but appends the port directly in the URL (e.g.,redis-cache:6379).bench set-redis-cache-hostexpects just the hostname (e.g.,redis-cache), nothost:port.Current
init.sh(for reference):Suggested Fix:
npm install -g yarn).:6379and only set hostnames.Example: