diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0be8f9c..281e245 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -89,39 +89,10 @@ PROCFILE fi # Create site if not exists -SITE_DIR_EXISTS=false -DB_EXISTS=false - -if [ -d "${BENCH_DIR}/sites/${SITE_NAME}" ]; then - SITE_DIR_EXISTS=true -fi - -# Check if database is accessible by trying to connect -if bench --site "${SITE_NAME}" execute frappe.ping 2>/dev/null || \ - (cd "${BENCH_DIR}" && python3 -c " -import sys -try: - import frappe - frappe.init('${SITE_NAME}') - frappe.connect() - frappe.db.sql('SELECT 1') - print('DB_OK') - sys.exit(0) -except: - sys.exit(1) -" 2>/dev/null); then - DB_EXISTS=true -fi - -if [ "${SITE_DIR_EXISTS}" = "false" ] || [ "${DB_EXISTS}" = "false" ]; then +if [ ! -d "${BENCH_DIR}/sites/${SITE_NAME}" ]; then echo "Creating site: ${SITE_NAME}..." cd "${BENCH_DIR}" - # Remove incomplete site directory if exists - if [ -d "${BENCH_DIR}/sites/${SITE_NAME}" ]; then - rm -rf "${BENCH_DIR}/sites/${SITE_NAME}" - fi - # Set common config for Redis services bench set-config -g redis_cache "redis://redis-cache:6379" bench set-config -g redis_queue "redis://redis-queue:6379"