Erreur site inaccessible après installation

Bonjour,

J’ai installé dokos en mode standard sur mon serveur dédié.
J’ai reçu une erreur quand j’ai lancer la commande: sudo -H bench setup production $USER.

ubuntu@ns394536:~/dokos-bench$ sudo -H bench setup production $USER
Setting Up prerequisites...
$ sudo /usr/bin/python3 -m pip install ansible
Collecting ansible
  Downloading ansible-10.1.0-py3-none-any.whl.metadata (8.2 kB)
Collecting ansible-core~=2.17.1 (from ansible)
  Downloading ansible_core-2.17.1-py3-none-any.whl.metadata (6.9 kB)
Requirement already satisfied: jinja2>=3.0.0 in /usr/local/lib/python3.12/dist-packages (from ansible-core~=2.17.1->ansible) (3.1.4)
Requirement already satisfied: PyYAML>=5.1 in /usr/lib/python3/dist-packages (from ansible-core~=2.17.1->ansible) (6.0.1)
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-core~=2.17.1->ansible) (41.0.7)
Collecting packaging (from ansible-core~=2.17.1->ansible)
  Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting resolvelib<1.1.0,>=0.5.3 (from ansible-core~=2.17.1->ansible)
  Downloading resolvelib-1.0.1-py2.py3-none-any.whl.metadata (4.0 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2>=3.0.0->ansible-core~=2.17.1->ansible) (2.1.5)
Downloading ansible-10.1.0-py3-none-any.whl (47.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.9/47.9 MB 45.2 MB/s eta 0:00:00
Downloading ansible_core-2.17.1-py3-none-any.whl (2.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 56.5 MB/s eta 0:00:00
Downloading resolvelib-1.0.1-py2.py3-none-any.whl (17 kB)
Downloading packaging-24.1-py3-none-any.whl (53 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.0/54.0 kB 13.1 MB/s eta 0:00:00
Installing collected packages: resolvelib, packaging, ansible-core, ansible
Successfully installed ansible-10.1.0 ansible-core-2.17.1 packaging-24.1 resolvelib-1.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
$ bench setup role nginx
ansible-playbook [core 2.17.1]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
No config file found; using defaults
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.

The error appears to be in '/usr/local/lib/python3.12/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- include: centos.yml
  ^ here
ERROR: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '{"production": true, "admin_emails": "", "mysql_root_password": null, "container": false}', '-t', 'nginx']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.12/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/bench/commands/setup.py", line 369, in setup_roles
    run_playbook("site.yml", extra_vars=extra_vars, tag=role)
  File "/usr/local/lib/python3.12/dist-packages/bench/utils/__init__.py", line 339, in run_playbook
    subprocess.check_call(args, cwd=os.path.join(bench.__path__[0], "playbooks"))
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '{"production": true, "admin_emails": "", "mysql_root_password": null, "container": false}', '-t', 'nginx']' returned non-zero exit status 1.
ERROR:
subprocess.CalledProcessError: Command 'bench setup role nginx' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.12/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.12/dist-packages/bench/commands/setup.py", line 110, in setup_production
    setup_production(user=user, yes=yes)
  File "/usr/local/lib/python3.12/dist-packages/bench/config/production_setup.py", line 38, in setup_production
    setup_production_prerequisites()
  File "/usr/local/lib/python3.12/dist-packages/bench/config/production_setup.py", line 31, in setup_production_prerequisites
    exec_cmd("bench setup role nginx")
  File "/usr/local/lib/python3.12/dist-packages/bench/utils/__init__.py", line 171, in exec_cmd
    raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError

J’ai continué les autre commandes sans avoir d’autre erreur. J’ai crée le site web en lui donnant le nom de mon domaine etc…
Cependant, quand je vais sur mon serveur que ce soit avec le nom de domaine ou l’adresse IP du serveur, j’ai juste le message ce site est inaccessible. :confounded:
Je n’arrive pas à accéder à dokos.

Bonjour Jonathan, effectivement c’est un problème qu’on a identifié mais qui n’a pas encore été déployé.

Si jamais tu peux modifier le fichier /usr/local/lib/python3.12/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml pour remplacer les trois instances du mot include par import_tasks. Et ensuite ressayer le setup production.

cf. mon ticket ici :

1 Like

Bonjour Corentin,
C’est bon.
Maintenant quand je vais sur la page web, j’ai Not Found … does not exist.

Super, est-ce que tu pourrais me montrer une capture d’écran de ce que tu vois sur le site ?

Sur mon pc ça affiche ce message Not Found mais quand j’y vais avec mon smartphone, j’ai bien accès à dokos. En utilisant la même adresse web.

J’ai trouvé la solution.
Il fallait mettre les www. dans le nom du site. :man_facepalming:t6:

Hmm, est-ce que l’adresse complète du site est la même ? J’ai l’impression que sur mobile tu accèdes à l’adresse sans www., et sur ordinateur avec. Si ton site Dokos s’appelle abcdef.com, tu ne pourras pas y accéder depuis www.abcdef.com (par défaut, ça peut se faire je pense), ou inversement.

C’est bien ce qui c’est passé. Le smartphone y accédait sans www. alors que sur pc le navigateur mettait automatiquement le www. . Je les mis par défaut mais ça n’a rien changé. Mais bon j’ai renommé et c’est bon.