Ralph Asset Management System - User Group

Which docker-entrypoint.sh is being used?

If we l examine https://github.com/allegro/ralph/tree/ng/docker, there is a docker-entrypoint.sh file which then calls init-ralph.sh, whose last few lines look like this:

"${RALPH_LOCAL_DIR}/wait-for-it.sh" "${DATABASE_HOST}:${DATABASE_PORT}" --timeout=30 --strict -- echo "Database is up"

ralph migrate --noinput
ralph sitetree_resync_apps

if [[ "$COMMAND" == "init" ]]; then
    python3 "${RALPH_LOCAL_DIR}/createsuperuser.py"

When I start running it, I see

[raub@vmhost2 ralph-ng]$ docker-compose run --rm web init
Creating network "ralph-ng_default" with the default driver
Creating ralph-ng_nginx_1 ... done
Creating ralph-ng_db_1 ... done
Creating ralph-ng_redis_1 ... done
wait-for-it.sh: waiting 30 seconds for db:3306
wait-for-it.sh: db:3306 is available after 0 seconds
Database is up
Operations to perform:
  Synchronize unmigrated apps: staticfiles, dc_view, table, permissions, rest_framework, humanize, notifications, taggit_serializer, foundation, import_export, django_rq, djmoney, ralph_admin, mptt, hooks, messages
  Apply all migrations: deployment, accounts, contenttypes, external_services, access_cards, trade_marks, admin, auth, taggit, virtual, attachments, operations,data_importer, sessions, domains, reversion, supports, sitetree, custom_fields,sim_cards, dhcp, configuration_management, networks, security, dashboards, transitions, ssl_certificates, data_center, reports, assets, authtoken, licences, back_office
Synchronizing apps without migrations:
    Adding `Add warehouse` tree item ...
    Adding `{{ original }}` tree item ...
    Adding `Office Infrastructures` tree item ...
    Adding `Add office infrastructure` tree item ...
    Adding `{{ original }}` tree item ...
[raub@vmhost2 ralph-ng]$

But I am not seeing the if[] command on the very end being called. Am I missing something? Is there a different docker-entrypoint.sh in the image being called?

Could you please show the exact command you are running?

The command I used was

docker-compose run --rm web init

I would expect that to trigger line 49 on https://github.com/allegro/ralph/blob/ng/docker/provision/docker-entrypoint.sh, which in turn would call https://github.com/allegro/ralph/blob/ng/docker/provision/init-ralph.sh, but I am not seeing line 30 in the last script being called.

Update: I passed the variables as environmental ones and was able to create user. One issue down.