Hi Everyone,
I am trying to install django-otp in dockerized Zato. Please see my docker file
FROM ghcr.io/zatosource/zato-3.2-quickstart:latest as builder
WORKDIR /opt/libs
COPY libs .
RUN /opt/zato/current/bin/pip install --no-cache-dir -r requirements.txt
FROM ghcr.io/zatosource/zato-3.2-quickstart:latest as runner
COPY --from=builder /opt /opt
RUN /opt/zato/current/bin/pip install --no-cache-dir /opt/libs/wzlib-0.0.106.tar.gz
RUN /opt/zato/current/bin/pip install --no-cache-dir /opt/libs/wzErrorHandler-0.0.1.tar.gz
WORKDIR /opt
The following is my requirements.txt file
phonenumbers==8.12.19
rstr==2.2.6
pycryptodome
unicodedata2
bpython
django-otp # Package that creates the trouble
I build my image with the following docker-compose file
version: "3"
services:
zato:
build:
context: .
container_name: zato
ports:
- "7183:8183"
- "7083:11223"
environment:
Zato_Dashboard_Password: "my_password"
volumes:
- ./libs/requirements.txt:/opt/hot-deploy/python-reqs/requirements.txt
- ./zato/:/opt/hot-deploy/services
- ./libs:/opt/libs
- ./enmasse.yml:/opt/hot-deploy/enmasse/enmasse.yml
Everything works really fine without Django-otp in requirements file. But as soon as I add it, I got the following:
docker-compose up --build
Building zato
[+] Building 68.1s (13/13) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for ghcr.io/zatosource/zato-3.2-quickstart:latest 1.7s
=> [internal] load build context 0.0s
=> => transferring context: 411B 0.0s
=> CACHED [builder 1/4] FROM ghcr.io/zatosource/zato-3.2-quickstart:latest@sha256:53bb1211cb38f1356e4440affe066e903da0f99aa20ac7e0 0.0s
=> CACHED [builder 2/4] WORKDIR /opt/libs 0.0s
=> [builder 3/4] COPY libs . 0.0s
=> [builder 4/4] RUN /opt/zato/current/bin/pip install --no-cache-dir -r requirements.txt 25.2s
=> [runner 2/5] COPY --from=builder /opt /opt 7.0s
=> [runner 3/5] RUN /opt/zato/current/bin/pip install --no-cache-dir /opt/libs/wzlib-0.0.106.tar.gz 6.2s
=> [runner 4/5] RUN /opt/zato/current/bin/pip install --no-cache-dir /opt/libs/wzErrorHandler-0.0.1.tar.gz 12.3s
=> [runner 5/5] WORKDIR /opt 0.0s
=> exporting to image 7.6s
=> => exporting layers 7.6s
=> => writing image sha256:01708507687c09b9ce25999f77a1b1dbad5b2e854a2d336ab3392b2bab6763e0 0.0s
=> => naming to docker.io/library/zatopartners_zato 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Creating zato ... done
Attaching to zato
zato |
zato | PLAY [all] *********************************************************************
zato |
zato | TASK [Gathering Facts] *********************************************************
zato | ok: [localhost]
zato |
zato | TASK [Set facts (init)] ********************************************************
zato | ok: [localhost]
zato |
zato | TASK [Update and upgrade apt packages (01)] ************************************
zato | skipping: [localhost]
zato |
zato | TASK [Install preliminary packages (01)] ***************************************
zato | skipping: [localhost]
zato |
zato | TASK [Install MySQL (01)] ******************************************************
zato | skipping: [localhost]
zato |
zato | TASK [Ensure the expected locales are generated (01)] **************************
zato | skipping: [localhost]
zato |
zato | TASK [Configure the firewall (ufw -> basic) (01)] ******************************
zato | skipping: [localhost]
zato |
zato | TASK [Configure the firewall (ufw -> local connections) (01)] ******************
zato | skipping: [localhost] => (item=10.0.0.0/8)
zato | skipping: [localhost] => (item=172.16.0.0/12)
zato | skipping: [localhost] => (item=192.168.0.0/16)
zato |
zato | TASK [Import the GPG signing key for PostgreSQL 14 (01)] ***********************
zato | skipping: [localhost]
zato |
zato | TASK [Import the GPG signing key for Zato 3.2 (01)] ****************************
zato | skipping: [localhost]
zato |
zato | TASK [Get the system's codename (01)] ******************************************
zato | skipping: [localhost]
zato |
zato | TASK [Add the apt repository for PostgreSQL 14 (01)] ***************************
zato | skipping: [localhost]
zato |
zato | TASK [Add the apt repository for Zato 3.2 (01)] ********************************
zato | skipping: [localhost]
zato |
zato | TASK [Update apt cache before the installation of packages (01)] ***************
zato | skipping: [localhost]
zato |
zato | TASK [Install PostgreSQL 14 (01)] **********************************************
zato | skipping: [localhost]
zato |
zato | TASK [Install Zato 3.2 (01)] ***************************************************
zato | skipping: [localhost]
zato |
zato | TASK [Prepare work directories for Ansible (01)] *******************************
zato | skipping: [localhost]
zato |
zato | TASK [Install Zato 3.2 updates (01)] *******************************************
zato | skipping: [localhost]
zato |
zato | TASK [Update and upgrade apt packages (02)] ************************************
zato | changed: [localhost]
zato |
zato | TASK [Install NodeJS (for testing) (02)] ***************************************
zato | skipping: [localhost]
zato |
zato | TASK [Make sure that PostgreSQL is started (02)] *******************************
zato | changed: [localhost]
zato |
zato | TASK [Make sure that MySQL is started (02)] ************************************
zato | changed: [localhost]
zato |
zato | TASK [Regenerate host SSH keys (02)] *******************************************
zato | changed: [localhost]
zato |
zato | TASK [Restart the SSH server after regenerating its keys (02)] *****************
zato | changed: [localhost]
zato |
zato | TASK [Drop the SQL database if it exists (PG -> main) (02)] ********************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL database if it exists (MySQL -> main) (02)] *****************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL database if it exists (PG -> pub/sub) (02)] *****************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL database if it exists (MySQL -> pub/sub) (02)] **************
zato | ok: [localhost]
zato |
zato | TASK [Create the SQL database (PG -> main) (02)] *******************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL database (MySQL -> main) (02)] ****************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL database (PG -> pub/sub) (02)] ****************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL database (MySQL -> pub/sub) (02)] *************************
zato | changed: [localhost]
zato |
zato | TASK [Drop the SQL user if it exists (PG -> main) (02)] ************************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL user if it exists (MySQL -> main) (02)] *********************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL user if it exists (PG -> pub/sub) (02)] *********************
zato | ok: [localhost]
zato |
zato | TASK [Drop the SQL user if it exists (MySQL -> pub/sub) (02)] ******************
zato | ok: [localhost]
zato |
zato | TASK [Create the SQL user (PG -> main) (02)] ***********************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL user (MySQL -> main) (02)] ********************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL user (PG -> pub/sub) (02)] ********************************
zato | changed: [localhost]
zato |
zato | TASK [Create the SQL user (MySQL -> pub/sub) (02)] *****************************
zato | changed: [localhost]
zato |
zato | TASK [Grant access to the SQL user (PG -> main) (02)] **************************
zato | changed: [localhost]
zato |
zato | TASK [Grant access to the SQL user (PG -> pub/sub) (02)] ***********************
zato | changed: [localhost]
zato |
zato | TASK [Configure PostgreSQL to listen on all interfaces (02)] *******************
zato | changed: [localhost]
zato |
zato | TASK [Enable password-based SSH connections (02)] ******************************
zato | ok: [localhost]
zato |
zato | TASK [Allow for SSH connections to be established from anywhere (02)] **********
zato | changed: [localhost]
zato |
zato | TASK [Restart PostgreSQL after its configuration was changed (02)] *************
zato | changed: [localhost]
zato |
zato | TASK [Restart MySQL after its configuration was changed (02)] ******************
zato | changed: [localhost]
zato |
zato | TASK [Restart the SSH server after its configuration was changed (02)] *********
zato | changed: [localhost]
zato |
zato | TASK [Set the SSH password for user 'zato' (02)] *******************************
zato | changed: [localhost]
zato |
zato | TASK [Install HashiCorp Vault (02)] ********************************************
zato | skipping: [localhost]
zato |
zato | TASK [Make sure all the previous processes started by user zato are stopped (02)] ***
zato | changed: [localhost]
zato |
zato | TASK [Start HashiCorp Vault (dev) (02)] ****************************************
zato | skipping: [localhost]
zato |
zato | TASK [Make sure any previous environment is deleted (02)] **********************
zato | changed: [localhost]
zato |
zato | TASK [Create a quickstart environment (02)] ************************************
zato | fatal: [localhost]: FAILED! => {"changed": true, "cmd": "PATH=$PATH:~/current/bin &&\n/opt/zato/env/qs-1/zato-qs-stop.sh || true &&\nrm -rf /opt/zato/env/qs-1 &&\nzato quickstart /opt/zato/env/qs-1 --odb_type postgresql --odb_host localhost --odb_port 5432 --odb_db_name zato_db_main1 --odb_user zato_user_main1 --odb_password 'zato.db.main.4s8nw46rkwmhjh9z068n' --cluster_name '' --verbose\n", "delta": "0:00:03.800947", "end": "2022-04-11 17:54:38.754137", "msg": "non-zero return code", "rc": 16, "start": "2022-04-11 17:54:34.953190", "stderr": "/bin/sh: 2: /opt/zato/env/qs-1/zato-qs-stop.sh: not found\nGenerating a RSA private key\n................+++++\n........................................+++++\nwriting new private key to '/opt/zato/env/qs-1/ca/ca-material/ca-key.pem'\n-----\nGenerating a RSA private key\n..+++++\n..................+++++\nwriting new private key to '/opt/zato/env/qs-1/ca/out-priv/lb-agent-priv-2022-04-11_17-54-36.pem'\n-----\nUsing configuration from /tmp/tmp8o0dxwwk\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\norganizationName :PRINTABLE:'My Company'\norganizationalUnitName:PRINTABLE:'zato-lb-agent'\nlocalityName :PRINTABLE:'My Town'\nstateOrProvinceName :PRINTABLE:'My State'\ncountryName :PRINTABLE:'US'\ncommonName :PRINTABLE:'localhost'\nCertificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)\n\nWrite out database with 1 new entries\nData Base Updated\nGenerating a RSA private key\n......................................................................................................+++++\n.....................................................................................................+++++\nwriting new private key to '/opt/zato/env/qs-1/ca/out-priv/web-admin-priv-2022-04-11_17-54-36.pem'\n-----\nUsing configuration from /tmp/tmpjc4a_ixj\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\norganizationName :PRINTABLE:'My Company'\norganizationalUnitName:PRINTABLE:'web-admin'\nlocalityName :PRINTABLE:'My Town'\nstateOrProvinceName :PRINTABLE:'My State'\ncountryName :PRINTABLE:'US'\ncommonName :PRINTABLE:'localhost'\nCertificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)\n\nWrite out database with 1 new entries\nData Base Updated\nGenerating a RSA private key\n..........................+++++\n....+++++\nwriting new private key to '/opt/zato/env/qs-1/ca/out-priv/quickstart-264728-scheduler1-priv-2022-04-11_17-54-36.pem'\n-----\nUsing configuration from /tmp/tmpf92_e9tb\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\norganizationName :PRINTABLE:'My Company'\norganizationalUnitName:PRINTABLE:'quickstart-264728:scheduler1'\nlocalityName :PRINTABLE:'My Town'\nstateOrProvinceName :PRINTABLE:'My State'\ncountryName :PRINTABLE:'US'\ncommonName :PRINTABLE:'localhost'\nCertificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)\n\nWrite out database with 1 new entries\nData Base Updated\nGenerating a RSA private key\n......+++++\n.....................................................................................................................................................................+++++\nwriting new private key to '/opt/zato/env/qs-1/ca/out-priv/quickstart-264728-server1-priv-2022-04-11_17-54-36.pem'\n-----\nUsing configuration from /tmp/tmpthx6a5ey\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\norganizationName :PRINTABLE:'My Company'\norganizationalUnitName:PRINTABLE:'quickstart-264728:server1'\nlocalityName :PRINTABLE:'My Town'\nstateOrProvinceName :PRINTABLE:'My State'\ncountryName :PRINTABLE:'US'\ncommonName :PRINTABLE:'localhost'\nCertificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)\n\nWrite out database with 1 new entries\nData Base Updated", "stderr_lines": ["/bin/sh: 2: /opt/zato/env/qs-1/zato-qs-stop.sh: not found", "Generating a RSA private key", "................+++++", "........................................+++++", "writing new private key to '/opt/zato/env/qs-1/ca/ca-material/ca-key.pem'", "-----", "Generating a RSA private key", "..+++++", "..................+++++", "writing new private key to '/opt/zato/env/qs-1/ca/out-priv/lb-agent-priv-2022-04-11_17-54-36.pem'", "-----", "Using configuration from /tmp/tmp8o0dxwwk", "Check that the request matches the signature", "Signature ok", "The Subject's Distinguished Name is as follows", "organizationName :PRINTABLE:'My Company'", "organizationalUnitName:PRINTABLE:'zato-lb-agent'", "localityName :PRINTABLE:'My Town'", "stateOrProvinceName :PRINTABLE:'My State'", "countryName :PRINTABLE:'US'", "commonName :PRINTABLE:'localhost'", "Certificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)", "", "Write out database with 1 new entries", "Data Base Updated", "Generating a RSA private key", "......................................................................................................+++++", ".....................................................................................................+++++", "writing new private key to '/opt/zato/env/qs-1/ca/out-priv/web-admin-priv-2022-04-11_17-54-36.pem'", "-----", "Using configuration from /tmp/tmpjc4a_ixj", "Check that the request matches the signature", "Signature ok", "The Subject's Distinguished Name is as follows", "organizationName :PRINTABLE:'My Company'", "organizationalUnitName:PRINTABLE:'web-admin'", "localityName :PRINTABLE:'My Town'", "stateOrProvinceName :PRINTABLE:'My State'", "countryName :PRINTABLE:'US'", "commonName :PRINTABLE:'localhost'", "Certificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)", "", "Write out database with 1 new entries", "Data Base Updated", "Generating a RSA private key", "..........................+++++", "....+++++", "writing new private key to '/opt/zato/env/qs-1/ca/out-priv/quickstart-264728-scheduler1-priv-2022-04-11_17-54-36.pem'", "-----", "Using configuration from /tmp/tmpf92_e9tb", "Check that the request matches the signature", "Signature ok", "The Subject's Distinguished Name is as follows", "organizationName :PRINTABLE:'My Company'", "organizationalUnitName:PRINTABLE:'quickstart-264728:scheduler1'", "localityName :PRINTABLE:'My Town'", "stateOrProvinceName :PRINTABLE:'My State'", "countryName :PRINTABLE:'US'", "commonName :PRINTABLE:'localhost'", "Certificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)", "", "Write out database with 1 new entries", "Data Base Updated", "Generating a RSA private key", "......+++++", ".....................................................................................................................................................................+++++", "writing new private key to '/opt/zato/env/qs-1/ca/out-priv/quickstart-264728-server1-priv-2022-04-11_17-54-36.pem'", "-----", "Using configuration from /tmp/tmpthx6a5ey", "Check that the request matches the signature", "Signature ok", "The Subject's Distinguished Name is as follows", "organizationName :PRINTABLE:'My Company'", "organizationalUnitName:PRINTABLE:'quickstart-264728:server1'", "localityName :PRINTABLE:'My Town'", "stateOrProvinceName :PRINTABLE:'My State'", "countryName :PRINTABLE:'US'", "commonName :PRINTABLE:'localhost'", "Certificate is to be certified until Apr 8 17:54:36 2032 GMT (3650 days)", "", "Write out database with 1 new entries", "Data Base Updated"], "stdout": "Creating directory `/opt/zato/env/qs-1`\nCreate CA execute\n[1/8] Certificate authority created\n[2/8] ODB schema created\n[3/8] ODB initial data created\n[4/8] server1 created\n[5/8] Load-balancer created\nFile \"/opt/zato/current/bin/zato\", line 16, in <module>\n sys.exit(main())\n File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/zato_command.py\", line 1017, in main\n return run_command(args)\n File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/__init__.py\", line 216, in run_command\n return instance.run(args)\n Traceback (most recent call last):\n File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/__init__.py\", line 610, in run\n return_code = self.execute(args)\n File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/quickstart.py\", line 532, in execute\n admin_created = create_web_admin.Create(create_web_admin_args).execute(\n File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/create_web_admin.py\", line 198, in execute\n django.setup()\n File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/__init__.py\", line 24, in setup\n apps.populate(settings.INSTALLED_APPS)\n File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/apps/registry.py\", line 116, in populate\n app_config.import_models()\n File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/apps/config.py\", line 304, in import_models\n self.models_module = import_module(models_module_name)\n File \"/usr/lib/python3.8/importlib/__init__.py\", line 127, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import\n File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load\n File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked\n File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked\n File \"<frozen importlib._bootstrap_external>\", line 848, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/opt/zato/3.2.0/code/zato-web-admin/src/zato/admin/web/models.py\", line 24, in <module>\n class UserProfile(models.Model):\n File \"/opt/zato/3.2.0/code/zato-web-admin/src/zato/admin/web/models.py\", line 28, in UserProfile\n user = models.OneToOneField(User)\nTypeError: __init__() missing 1 required positional argument: 'on_delete'", "stdout_lines": ["Creating directory `/opt/zato/env/qs-1`", "Create CA execute", "[1/8] Certificate authority created", "[2/8] ODB schema created", "[3/8] ODB initial data created", "[4/8] server1 created", "[5/8] Load-balancer created", "File \"/opt/zato/current/bin/zato\", line 16, in <module>", " sys.exit(main())", " File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/zato_command.py\", line 1017, in main", " return run_command(args)", " File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/__init__.py\", line 216, in run_command", " return instance.run(args)", " Traceback (most recent call last):", " File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/__init__.py\", line 610, in run", " return_code = self.execute(args)", " File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/quickstart.py\", line 532, in execute", " admin_created = create_web_admin.Create(create_web_admin_args).execute(", " File \"/opt/zato/3.2.0/code/zato-cli/src/zato/cli/create_web_admin.py\", line 198, in execute", " django.setup()", " File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/__init__.py\", line 24, in setup", " apps.populate(settings.INSTALLED_APPS)", " File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/apps/registry.py\", line 116, in populate", " app_config.import_models()", " File \"/opt/zato/3.2.0/code/lib/python3.8/site-packages/django/apps/config.py\", line 304, in import_models", " self.models_module = import_module(models_module_name)", " File \"/usr/lib/python3.8/importlib/__init__.py\", line 127, in import_module", " return _bootstrap._gcd_import(name[level:], package, level)", " File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import", " File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load", " File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked", " File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked", " File \"<frozen importlib._bootstrap_external>\", line 848, in exec_module", " File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed", " File \"/opt/zato/3.2.0/code/zato-web-admin/src/zato/admin/web/models.py\", line 24, in <module>", " class UserProfile(models.Model):", " File \"/opt/zato/3.2.0/code/zato-web-admin/src/zato/admin/web/models.py\", line 28, in UserProfile", " user = models.OneToOneField(User)", "TypeError: __init__() missing 1 required positional argument: 'on_delete'"]}
I think django-otp edits my database, so it creates trouble. If someone could help me about this mes, it would be grateful.
Thank you very much !!!