DigitalState / Platform

The DigitalState Platform
MIT License
40 stars 20 forks source link

Error "ansible.errors.AnsibleFileNotFound" While trying to run ansible playbook #21

Closed kmbuco closed 6 years ago

kmbuco commented 6 years ago

I don't know if this is happening on my build alone or someone else has experienced it. I am using docker for windows on Windows 10 pro. I will try it on another OS see if it will reproduce the same.

After running "ansible-playbook deploy.yml" in my docker container

I get:

TASK [Detect git credential file] **ok: [server -> localhost] TASK [Define tasks repository variables] *fatal: [server]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <class 'ansible.errors.AnsibleFileNotFound'>, original message: Unable to retrieve file contents\nCould not find or access '/run/secrets/git/credential'"} to retry, use: --limit @/etc/ansible/env/lab/deploy.retry PLAY RECAP ***sdk : ok=59 changed=0 unreachable=0 failed=0 server : ok=56 changed=0 unreachable=0 failed=1

kmbuco commented 6 years ago

when I cd into the location '/run/secrets/git/credential' I get two files key and key.pub. I have also tried moving the contents to another location '/var/git/credential' but still am getting the same error. From this extract in the error message "Unable to retrieve file contents\nCould not find or access" I thought it was a permission issue so i tried sudo as well, though am already root... It still gave me the same error.

marioprudhomme commented 6 years ago

The Tasks microservice was mistakenly enabled by default. Tasks is an enterprise feature and requires permissions (git credential) to clone.

I have now made it disabled by default (b3018772ad231191291c99d8a90759a3b160142e) to align it with the community edition by default.

I suggest setting tasks.enabled to false and retry deployment.

kmbuco commented 6 years ago

Thank you @mario-digitalstate the fix worked I am not getting the same error. Now the build stops at this stage and gives me the below messages


TASK [app/assets/container/up : Up assets container]

changed: [server]

TASK [app/assets/container/up : Waiting for assets container to finalize installation] ***** FAILED - RETRYING: Waiting for assets container to finalize installation (60 retries left). FAILED - RETRYING: Waiting for assets container to finalize installation (59 retries left). ............ FAILED - RETRYING: Waiting for assets container to finalize installation (2 retries left). FAILED - RETRYING: Waiting for assets container to finalize installation (1 retries left). fatal: [server]: FAILED! => {"attempts": 60, "changed": true, "cmd": "docker-compose exec -T php pidof php-fpm | cat", "delta": "0:00:03.499352", "end": "2018-01-11 21:53:24.554015", "rc": 0, "start": "2018-01-11 21:53:21.054663", "stderr": "No container found for php_1", "stderr_lines": ["No container found for php_1"], "stdout": "", "stdout_lines": []}

marioprudhomme commented 6 years ago

Seems like the assets microservice container's php service didn't initialize correctly. While inside the sdk container console, can you run the following and give me the output: cd /srv/assets docker-compose logs php

Also, can you give me the content of your sdk/ansible/env/lab/inventory.yml

kmbuco commented 6 years ago

Hey @mario-digitalstate below is the output from docker-compose logs php

++++++++++++++++++++++++++++++++++++++++++++++ Attaching to dsassets_php_1 php_1 | + grep default php_1 | + ip ro php_1 | + cut -d -f 3 php_1 | + export DOCKER_BRIDGE_IP=172.19.0.1 php_1 | + [ dev = prod ] php_1 | + composer install --prefer-dist --no-progress --no-suggest php_1 | Composer could not find a composer.json file in /srv/api-platform php_1 | To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

My inventory.yml content is

all: hosts: sdk: ansible_connection: local server: ansible_connection: local vars: project: ds directory: /d/Development/workspace/digitalstate/Sdk/app env: lab timezone: UTC data: dev jwt: private_key: /root/resource/jwt/lab/key public_key: /root/resource/jwt/lab/key.pub key_pass_phase: ~ mail: transport: smtp host: 127.0.0.1 port: ~ username: admin@localhost password: ~ util: adminer: /root/resource/util/adminer.php admin: enabled: true repository: https://github.com/DigitalState/Admin.git version: develop host: admin.lab.ds assets: enabled: true repository: https://github.com/DigitalState/Assets.git version: develop host: api.assets.lab.ds authentication: enabled: true repository: https://github.com/DigitalState/Authentication.git version: develop host: api.authentication.lab.ds camunda: enabled: true repository: https://github.com/DigitalState/Camunda.git version: develop host: api.camunda.lab.ds cases: enabled: true repository: https://github.com/DigitalState/Cases.git version: develop host: api.cases.lab.ds cms: enabled: true repository: https://github.com/DigitalState/Cms.git version: develop host: api.cms.lab.ds core: enabled: true repository: https://github.com/DigitalState/Core.git version: develop discovery: enabled: true repository: https://github.com/DigitalState/Discovery.git version: develop host: api.discovery.lab.ds documentation: enabled: true repository: https://github.com/DigitalState/Documentation.git version: master formio: enabled: true repository: https://github.com/DigitalState/Formio.git version: develop host: api.formio.lab.ds guide: enabled: true repository: https://github.com/DigitalState/Guide.git version: master identities: enabled: true repository: https://github.com/DigitalState/Identities.git version: develop host: api.identities.lab.ds interactions: enabled: true repository: https://github.com/DigitalState/Interactions.git version: develop host: api.interactions.lab.ds logs: enabled: true repository: https://github.com/DigitalState/Logs.git version: develop host: api.logs.lab.ds monitor: enabled: true repository: https://github.com/DigitalState/Monitor.git version: develop host: monitor.lab.ds portal: enabled: true version: develop repository: https://github.com/DigitalState/Portal.git host: portal.lab.ds proxy: enabled: true repository: https://github.com/DigitalState/Proxy.git version: develop port: 80 records: enabled: true version: develop repository: https://github.com/DigitalState/Records.git host: api.records.lab.ds services: enabled: true repository: https://github.com/DigitalState/Services.git version: develop host: api.services.lab.ds tasks: enabled: false repository: https://github.com/DigitalState/Tasks.git version: develop host: api.tasks.lab.ds topics: enabled: true repository: https://github.com/DigitalState/Topics.git version: develop host: api.topics.lab.ds ui: enabled: true repository: https://github.com/DigitalState/Ui.git version: develop

StephenOTT commented 6 years ago

@kmbuco did you resolve the issue?

omar-k commented 6 years ago

I am facing the same issue, has anyone been able to resolve it.

marioprudhomme commented 6 years ago

The LAB environment is inherently incompatible with released tags. The LAB environment brings in the latest development efforts (develop branch) while the tagged platform code uses previous Ansible orchestration playbooks which isnt compatible with the latest code. LAB is mostly used to further advance the platform/application code.

To install a local tagged release, I suggest using the dev environment, which pulls tagged reposiroties for each microservices. Youll also need to edit the dev inventory file so that the app server points to your local machine instead of a remote server.

More info can be found here: https://github.com/DigitalState/Platform/blob/develop/platform/documentation/environments/lab/index.md

akamanocha commented 5 years ago

Hey @mario-digitalstate below is the output from docker-compose logs php

++++++++++++++++++++++++++++++++++++++++++++++

Attaching to dsassets_php_1 php_1 | + grep default php_1 | + ip ro php_1 | + cut -d -f 3 php_1 | + export DOCKER_BRIDGE_IP=172.19.0.1 php_1 | + [ dev = prod ] php_1 | + composer install --prefer-dist --no-progress --no-suggest php_1 | Composer could not find a composer.json file in /srv/api-platform php_1 | To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section My inventory.yml content is

all: hosts: sdk: ansible_connection: local server: ansible_connection: local vars: project: ds directory: /d/Development/workspace/digitalstate/Sdk/app env: lab timezone: UTC data: dev jwt: private_key: /root/resource/jwt/lab/key public_key: /root/resource/jwt/lab/key.pub key_pass_phase: ~ mail: transport: smtp host: 127.0.0.1 port: ~ username: admin@localhost password: ~ util: adminer: /root/resource/util/adminer.php admin: enabled: true repository: https://github.com/DigitalState/Admin.git version: develop host: admin.lab.ds assets: enabled: true repository: https://github.com/DigitalState/Assets.git version: develop host: api.assets.lab.ds authentication: enabled: true repository: https://github.com/DigitalState/Authentication.git version: develop host: api.authentication.lab.ds camunda: enabled: true repository: https://github.com/DigitalState/Camunda.git version: develop host: api.camunda.lab.ds cases: enabled: true repository: https://github.com/DigitalState/Cases.git version: develop host: api.cases.lab.ds cms: enabled: true repository: https://github.com/DigitalState/Cms.git version: develop host: api.cms.lab.ds core: enabled: true repository: https://github.com/DigitalState/Core.git version: develop discovery: enabled: true repository: https://github.com/DigitalState/Discovery.git version: develop host: api.discovery.lab.ds documentation: enabled: true repository: https://github.com/DigitalState/Documentation.git version: master formio: enabled: true repository: https://github.com/DigitalState/Formio.git version: develop host: api.formio.lab.ds guide: enabled: true repository: https://github.com/DigitalState/Guide.git version: master identities: enabled: true repository: https://github.com/DigitalState/Identities.git version: develop host: api.identities.lab.ds interactions: enabled: true repository: https://github.com/DigitalState/Interactions.git version: develop host: api.interactions.lab.ds logs: enabled: true repository: https://github.com/DigitalState/Logs.git version: develop host: api.logs.lab.ds monitor: enabled: true repository: https://github.com/DigitalState/Monitor.git version: develop host: monitor.lab.ds portal: enabled: true version: develop repository: https://github.com/DigitalState/Portal.git host: portal.lab.ds proxy: enabled: true repository: https://github.com/DigitalState/Proxy.git version: develop port: 80 records: enabled: true version: develop repository: https://github.com/DigitalState/Records.git host: api.records.lab.ds services: enabled: true repository: https://github.com/DigitalState/Services.git version: develop host: api.services.lab.ds tasks: enabled: false repository: https://github.com/DigitalState/Tasks.git version: develop host: api.tasks.lab.ds topics: enabled: true repository: https://github.com/DigitalState/Topics.git version: develop host: api.topics.lab.ds ui: enabled: true repository: https://github.com/DigitalState/Ui.git version: develop

I am having the same issue, did somebody find out the root issue and the resolution ?

May be docker version issue?

rogelioRuiz commented 5 years ago

I am having this same issue

Hey @mario-digitalstate below is the output from docker-compose logs php

++++++++++++++++++++++++++++++++++++++++++++++

Attaching to dsassets_php_1 php_1 | + grep default php_1 | + ip ro php_1 | + cut -d -f 3 php_1 | + export DOCKER_BRIDGE_IP=172.19.0.1 php_1 | + [ dev = prod ] php_1 | + composer install --prefer-dist --no-progress --no-suggest php_1 | Composer could not find a composer.json file in /srv/api-platform php_1 | To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section My inventory.yml content is

all: hosts: sdk: ansible_connection: local server: ansible_connection: local vars: project: ds directory: /d/Development/workspace/digitalstate/Sdk/app env: lab timezone: UTC data: dev jwt: private_key: /root/resource/jwt/lab/key public_key: /root/resource/jwt/lab/key.pub key_pass_phase: ~ mail: transport: smtp host: 127.0.0.1 port: ~ username: admin@localhost password: ~ util: adminer: /root/resource/util/adminer.php admin: enabled: true repository: https://github.com/DigitalState/Admin.git version: develop host: admin.lab.ds assets: enabled: true repository: https://github.com/DigitalState/Assets.git version: develop host: api.assets.lab.ds authentication: enabled: true repository: https://github.com/DigitalState/Authentication.git version: develop host: api.authentication.lab.ds camunda: enabled: true repository: https://github.com/DigitalState/Camunda.git version: develop host: api.camunda.lab.ds cases: enabled: true repository: https://github.com/DigitalState/Cases.git version: develop host: api.cases.lab.ds cms: enabled: true repository: https://github.com/DigitalState/Cms.git version: develop host: api.cms.lab.ds core: enabled: true repository: https://github.com/DigitalState/Core.git version: develop discovery: enabled: true repository: https://github.com/DigitalState/Discovery.git version: develop host: api.discovery.lab.ds documentation: enabled: true repository: https://github.com/DigitalState/Documentation.git version: master formio: enabled: true repository: https://github.com/DigitalState/Formio.git version: develop host: api.formio.lab.ds guide: enabled: true repository: https://github.com/DigitalState/Guide.git version: master identities: enabled: true repository: https://github.com/DigitalState/Identities.git version: develop host: api.identities.lab.ds interactions: enabled: true repository: https://github.com/DigitalState/Interactions.git version: develop host: api.interactions.lab.ds logs: enabled: true repository: https://github.com/DigitalState/Logs.git version: develop host: api.logs.lab.ds monitor: enabled: true repository: https://github.com/DigitalState/Monitor.git version: develop host: monitor.lab.ds portal: enabled: true version: develop repository: https://github.com/DigitalState/Portal.git host: portal.lab.ds proxy: enabled: true repository: https://github.com/DigitalState/Proxy.git version: develop port: 80 records: enabled: true version: develop repository: https://github.com/DigitalState/Records.git host: api.records.lab.ds services: enabled: true repository: https://github.com/DigitalState/Services.git version: develop host: api.services.lab.ds tasks: enabled: false repository: https://github.com/DigitalState/Tasks.git version: develop host: api.tasks.lab.ds topics: enabled: true repository: https://github.com/DigitalState/Topics.git version: develop host: api.topics.lab.ds ui: enabled: true repository: https://github.com/DigitalState/Ui.git version: develop

I am having the same issue, did somebody find out the root issue and the resolution ?

May be docker version issue?

akamanocha commented 5 years ago

Yes @rogelioRuiz I did find out and got that working in the end.

Admittedly it was all my fault. Ways to resolve:

  1. Run docker prune. Start with clean slate.
  2. Check the directory mapping. I was using wrong srv directory.
  3. Stick to 0.6. It doesn't work with anything above.

2 and 3 are mandatory.

Best of luck!