App deployment fails as my ansible template copy is not performed


I am running through a weird behaviour when deploying my Dockerfile on App platform.

I use ansible to deploy my App, I have 2 roles that perform template copy. One is for gunicorn the other is for a settings file. The gunicorn file is well copied, while the settings is simply not copied.

Here are some logs with some debugging session I’ve performed:

  • Ansible display of settings file:
[2022-07-26 12:45:56]     "cmd": [
[2022-07-26 12:45:56]         "cat",
[2022-07-26 12:45:56]         "/crm-pilates/settings.ini"
[2022-07-26 12:45:56]     ],
[2022-07-26 12:45:56]     "stdout_lines": [
[2022-07-26 12:45:56]         "[DEFAULT]",
[2022-07-26 12:45:56]         "EVENT_STORE_PATH= PATH",
[2022-07-26 12:45:56]         "",
[2022-07-26 12:45:56]         "[CORS]",
[2022-07-26 12:45:56]         "CORS_ALLOW_ORIGINS= CORS",
[2022-07-26 12:45:56]         "",
[2022-07-26 12:45:56]         "[DATABASE]",
[2022-07-26 12:45:56]         "DATABASE_URL= "
[2022-07-26 12:45:56]     ]

There are no ansible errors at the end of the playbook run.

  • Python logs displaying directory files:
[2022-07-26 12:48:38] WARNING:root:Current main path /crm-pilates/crm_pilates/
[2022-07-26 12:48:38] WARNING:root:Current working dir /crm-pilates
[2022-07-26 12:48:38] WARNING:root:Root dir: .dockerignore, .venv, Dockerfile, LICENSE, Makefile,, crm_pilates, docker-compose.yml, local.persistent, log-config.json, poetry.lock, pyproject.toml,, scripts
[2022-07-26 12:48:38] WARNING:root:Module dir:, __pycache__,, command, domain, event,, infrastructure,,, web

you can see the in the module dir but there are no settings.ini in the root dir where it should be.

Below are some logs from a local docker container (using the same deployment method):

WARNING:root:Current main path /crm-pilates/crm_pilates/
WARNING:root:Current working dir /crm-pilates
WARNING:root:Root dir: crm_pilates, local.persistent, settings.ini, .venv, log-config.json,, Makefile, pyproject.toml, scripts, docker-compose.yml, LICENSE,, poetry.lock, __pycache__, .dockerignore, Dockerfile
WARNING:root:Module dir:,,,, command, event, infrastructure, domain, __pycache__, web,

As you may see the settings.ini is present and the app is running fine on local docker.

Here is the ansible playbook command: $(virtualenv_path)/bin/ansible-playbook scripts/ansible/playbook.yml --inventory scripts/ansible/deploy.yml --diff -vvvv

the settings role:

- name: copy settings
    src: settings.ini
    dest: "{{ root_dir }}/settings.ini"

the server role (that copy gunicorn file):

- name: copy gunicorn configuration
    dest: "{{ root_dir }}/crm_pilates/"

and the playbook:

- name: Configure settings
  hosts: all
    - role: settings
    - role: display_settings
    - role: print_settings

- name: Deploy
    - role: server

I really don’t get why it is working on a local container and not on digital ocean App container.

If anyone has an idea and see what I don’t see.

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer