FreeTAKTeam / FreeTAKHub-Installation

FreeTAKHub-Installation
Eclipse Public License 2.0
33 stars 29 forks source link

Zero Touch Deployment error #18

Closed WaaromZoMoeilijk closed 2 years ago

WaaromZoMoeilijk commented 2 years ago

Hello, thanks for this great project and easy installation process.

When running the Zero Touch command: wget -qO - https://raw.githubusercontent.com/FreeTAKTeam/FreeTAKHub-Installation/main/scripts/easy_install.sh | bash

On an Ubuntu 20.04 VM amd64

It fails trying to install FreeTAKServer: (tried with root and regular sudo user)

TASK [freetakserver : Install FreeTAKServer] ***********************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/pip3.8", "install", "FreeTAKServer"], "msg": "stdout: Collecting FreeTAKServer\n  Downloading FreeTAKServer-1.9.8-py3-none-any.whl (337 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 337.3/337.3 KB 9.5 MB/s eta 0:00:00\nCollecting ruamel.yaml\n  Downloading ruamel.yaml-0.17.21-py3-none-any.whl (109 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 KB 23.3 MB/s eta 0:00:00\nRequirement already satisfied: setuptools in /usr/local/lib/python3.8/dist-packages (from FreeTAKServer) (60.9.3)\nCollecting Jinja2==2.11.2\n  Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.8/125.8 KB 29.2 MB/s eta 0:00:00\nCollecting flask-socketio==4.3.1\n  Downloading Flask_SocketIO-4.3.1-py2.py3-none-any.whl (15 kB)\nCollecting defusedxml\n  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)\nCollecting tabulate==0.8.7\n  Downloading tabulate-0.8.7-py3-none-any.whl (24 kB)\nCollecting python-engineio==3.13.2\n  Downloading python_engineio-3.13.2-py2.py3-none-any.whl (50 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.2/50.2 KB 12.8 MB/s eta 0:00:00\nCollecting Flask-Login\n  Downloading Flask_Login-0.5.0-py2.py3-none-any.whl (16 kB)\nCollecting Flask-SQLAlchemy==2.4.4\n  Downloading Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB)\nCollecting eventlet==0.29.0\n  Downloading eventlet-0.29.0-py2.py3-none-any.whl (223 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 223.4/223.4 KB 19.6 MB/s eta 0:00:00\nCollecting python-socketio==4.6.0\n  Downloading python_socketio-4.6.0-py2.py3-none-any.whl (51 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.8/51.8 KB 10.8 MB/s eta 0:00:00\nCollecting flask==1.1.2\n  Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.6/94.6 KB 20.9 MB/s eta 0:00:00\nCollecting geopy\n  Downloading geopy-2.2.0-py3-none-any.whl (118 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.9/118.9 KB 29.1 MB/s eta 0:00:00\nCollecting lxml==4.6.1\n  Downloading lxml-4.6.1-cp38-cp38-manylinux1_x86_64.whl (5.4 MB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 49.5 MB/s eta 0:00:00\nCollecting flask-cors==3.0.9\n  Downloading Flask_Cors-3.0.9-py2.py3-none-any.whl (14 kB)\nCollecting pykml\n  Downloading pykml-0.2.0-py3-none-any.whl (41 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.1/41.1 KB 11.0 MB/s eta 0:00:00\nRequirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from FreeTAKServer) (5.3.1)\nCollecting wtforms==2.3.3\n  Downloading WTForms-2.3.3-py2.py3-none-any.whl (169 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 169.1/169.1 KB 25.1 MB/s eta 0:00:00\nCollecting pathlib==1.0.1\n  Downloading pathlib-1.0.1.tar.gz (49 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.3/49.3 KB 11.9 MB/s eta 0:00:00\n  Preparing metadata (setup.py): started\n  Preparing metadata (setup.py): finished with status 'error'\n\n:stderr:   error: subprocess-exited-with-error\n  \n  × python setup.py egg_info did not run successfully.\n  │ exit code: 1\n  ╰─> [20 lines of output]\n      Traceback (most recent call last):\n        File \"<string>\", line 2, in <module>\n        File \"<pip-setuptools-caller>\", line 34, in <module>\n        File \"/tmp/pip-install-8cpzz1zo/pathlib_44bda7fdede04dc58c4e23717e34891e/setup.py\", line 6, in <module>\n          setup(\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/core.py\", line 109, in setup\n          _setup_distribution = dist = klass(attrs)\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/dist.py\", line 456, in __init__\n          for ep in metadata.entry_points(group='distutils.setup_keywords'):\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py\", line 999, in entry_points\n          return SelectableGroups.load(eps).select(**params)\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py\", line 449, in load\n          ordered = sorted(eps, key=by_group)\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py\", line 997, in <genexpr>\n          dist.entry_points for dist in unique(distributions())\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py\", line 609, in entry_points\n          return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)\n        File \"/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py\", line 917, in read_text\n          return self._path.joinpath(filename).read_text(encoding='utf-8')\n      AttributeError: 'PosixPath' object has no attribute 'read_text'\n      [end of output]\n  \n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n× Encountered error while generating package metadata.\n╰─> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\n"}

PLAY RECAP *********************************************************************
localhost                  : ok=19   changed=5    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0   

Please advise.

Thanks again!

WaaromZoMoeilijk commented 2 years ago

sudo apt-get install software-properties-common is a dependency for apt-add-repository, which is not installed by default on my Ubuntu 20.04.

Right at the start of the auto installer I got the errror: apt-add-repostitory: command not found

Not sure where to implement this dep with a pull req. Please advise. https://github.com/FreeTAKTeam/FreeTAKHub-Installation/pull/21

WaaromZoMoeilijk commented 2 years ago

The adding of software-properties-common fixes the original issue. (EDIT bummer, on a second clean run the issue is back) The error with add-apt-repo is still solved though, was unable to install ansible because of it.

Right now I'm stuck at:

TASK [python3 : Install pip3.8] *******************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/usr/bin/python3.8", "/tmp/get-pip.py"], "delta": "0:00:01.860096", "end": "2022-03-09 09:49:20.090695", "msg": "non-zero return code", "rc": 1, "start": "2022-03-09 09:49:18.230599", "stderr": "Traceback (most recent call last):\n  File \"/tmp/get-pip.py\", line 33324, in <module>\n    main()\n  File \"/tmp/get-pip.py\", line 135, in main\n    bootstrap(tmpdir=tmpdir)\n  File \"/tmp/get-pip.py\", line 111, in bootstrap\n    monkeypatch_for_cert(tmpdir)\n  File \"/tmp/get-pip.py\", line 92, in monkeypatch_for_cert\n    from pip._internal.commands.install import InstallCommand\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/commands/__init__.py\", line 9, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/base_command.py\", line 15, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/cmdoptions.py\", line 23, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/parser.py\", line 12, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/configuration.py\", line 26, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/utils/logging.py\", line 27, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/utils/misc.py\", line 39, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/locations/__init__.py\", line 14, in <module>\n  File \"<frozen zipimport>\", line 259, in load_module\n  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/locations/_distutils.py\", line 9, in <module>\nModuleNotFoundError: No module named 'distutils.cmd'", "stderr_lines": ["Traceback (most recent call last):", "  File \"/tmp/get-pip.py\", line 33324, in <module>", "    main()", "  File \"/tmp/get-pip.py\", line 135, in main", "    bootstrap(tmpdir=tmpdir)", "  File \"/tmp/get-pip.py\", line 111, in bootstrap", "    monkeypatch_for_cert(tmpdir)", "  File \"/tmp/get-pip.py\", line 92, in monkeypatch_for_cert", "    from pip._internal.commands.install import InstallCommand", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/commands/__init__.py\", line 9, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/base_command.py\", line 15, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/cmdoptions.py\", line 23, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/cli/parser.py\", line 12, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/configuration.py\", line 26, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/utils/logging.py\", line 27, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/utils/misc.py\", line 39, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/locations/__init__.py\", line 14, in <module>", "  File \"<frozen zipimport>\", line 259, in load_module", "  File \"/tmp/tmp93a6rgmb/pip.zip/pip/_internal/locations/_distutils.py\", line 9, in <module>", "ModuleNotFoundError: No module named 'distutils.cmd'"], "stdout": "", "stdout_lines": []}

PLAY RECAP ****************************************************************************************************************************************************************************
localhost                  : ok=12   changed=3    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0   

It seems that there is another dependency: sudo apt install python3-distutils https://github.com/FreeTAKTeam/FreeTAKHub-Installation/pull/21

Also, I think we need to use sudo in the one liner instead of just bash? It seems it doesn't really like running as root (LXC unpriv conainter on my end so i can use root) but rather as a user with sudo permissions. The one liner does not reflect that or explains it. https://github.com/FreeTAKTeam/FreeTAKHub-Installation/pull/22

Here is another line, I'd like to verify if that is intended or not:

Adding passwordless Ansible execution for the current user...
grep: /etc/sudoers.d/dont-prompt-root-for-sudo-password: No such file or directory
WaaromZoMoeilijk commented 2 years ago

Here is a better readable output of the error: Seems to fail on pathlib=1.0.1

Defaulting to user installation because normal site-packages is not writeable
Collecting FreeTAKServer
  Downloading FreeTAKServer-1.9.8-py3-none-any.whl (337 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 337.3/337.3 KB 9.9 MB/s eta 0:00:00
Collecting geopy
  Downloading geopy-2.2.0-py3-none-any.whl (118 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.9/118.9 KB 27.2 MB/s eta 0:00:00
Collecting protobuf==3.14.0
  Downloading protobuf-3.14.0-cp38-cp38-manylinux1_x86_64.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 28.0 MB/s eta 0:00:00
Collecting ruamel.yaml
  Downloading ruamel.yaml-0.17.21-py3-none-any.whl (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 KB 22.2 MB/s eta 0:00:00
Collecting Flask-SQLAlchemy==2.4.4
  Downloading Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB)
Collecting sqlalchemy==1.3.20
  Downloading SQLAlchemy-1.3.20-cp38-cp38-manylinux2010_x86_64.whl (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 58.3 MB/s eta 0:00:00
Collecting lxml==4.6.1
  Downloading lxml-4.6.1-cp38-cp38-manylinux1_x86_64.whl (5.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 45.0 MB/s eta 0:00:00
Collecting flask-socketio==4.3.1
  Downloading Flask_SocketIO-4.3.1-py2.py3-none-any.whl (15 kB)
Collecting python-socketio==4.6.0
  Downloading python_socketio-4.6.0-py2.py3-none-any.whl (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.8/51.8 KB 11.3 MB/s eta 0:00:00
Collecting flask==1.1.2
  Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.6/94.6 KB 14.2 MB/s eta 0:00:00
Collecting eventlet==0.29.0
  Downloading eventlet-0.29.0-py2.py3-none-any.whl (223 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 223.4/223.4 KB 31.4 MB/s eta 0:00:00
Collecting Jinja2==2.11.2
  Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.8/125.8 KB 30.2 MB/s eta 0:00:00
Collecting psutil
  Downloading psutil-5.9.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (283 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 283.8/283.8 KB 33.7 MB/s eta 0:00:00
Collecting flask-cors==3.0.9
  Downloading Flask_Cors-3.0.9-py2.py3-none-any.whl (14 kB)
Collecting defusedxml
  Downloading defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting flask-httpauth==4.2.0
  Downloading Flask_HTTPAuth-4.2.0-py2.py3-none-any.whl (5.9 kB)
Collecting Flask-Login
  Downloading Flask_Login-0.5.0-py2.py3-none-any.whl (16 kB)
Collecting pathlib==1.0.1
  Downloading pathlib-1.0.1.tar.gz (49 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.3/49.3 KB 12.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-5wqd5lbz/pathlib_9c10eccdfd1e4bf1ab3dcc332e2b927f/setup.py", line 6, in <module>
          setup(
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_distutils/core.py", line 109, in setup
          _setup_distribution = dist = klass(attrs)
        File "/usr/local/lib/python3.8/dist-packages/setuptools/dist.py", line 456, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
          dist.entry_points for dist in unique(distributions())
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 609, in entry_points
          return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
        File "/usr/local/lib/python3.8/dist-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 917, in read_text
          return self._path.joinpath(filename).read_text(encoding='utf-8')
      AttributeError: 'PosixPath' object has no attribute 'read_text'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WaaromZoMoeilijk commented 2 years ago

Thanks, I'm going for another test run. I will report back. Hmm seems a VM instead of an LXC container works, I'll see if I can get the LXC side working.

jonaugustine commented 2 years ago

fixed with #23

WaaromZoMoeilijk commented 2 years ago

On a clean Ubuntu 20.04 VM amd 64 I got up until here:

TASK [nodered : Template backup Node-RED flows] *********************************************************************************************************************************************************************
changed: [localhost] => (item=salute.json)
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleUndefinedVariable: 'videoserver_ipv4' is undefined
failed: [localhost] (item=videochecker.json) => {"ansible_loop_var": "item", "changed": false, "item": "videochecker.json", "msg": "AnsibleUndefinedVariable: 'videoserver_ipv4' is undefined"}

PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost                  : ok=15   changed=5    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

EDIT

Had to change 127.0.0.1 localhost to LAN IP 192.168.x.x localhost in order for it to finish.