ReinerNippes / nextcloud_on_docker

Run Nextcloud in Docker Container on various Linux Hosts
MIT License
203 stars 48 forks source link

install on fresh droplet ubuntu 16.04 - report #25

Closed james-cook closed 4 years ago

james-cook commented 4 years ago

When I run the playbook as shown in the README I get a network.yml error:

included: /root/nextcloud_on_docker/roles/docker_container/tasks/network.yml for localhost

TASK [docker_container : Create frontend network] **** Thursday 09 January 2020 13:30:54 +0000 (0:00:00.063) 0:01:05.746 ** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'SSL_ST_INIT' fatal: [localhost]: FAILED! => changed=false module_stderr: |- Traceback (most recent call last): File "/root/.ansible/tmp/ansible-tmp-1578576654.19-46880396426708/AnsiballZ_docker_network.py", line 102, in _ansiballz_main() File "/root/.ansible/tmp/ansible-tmp-1578576654.19-46880396426708/AnsiballZ_docker_network.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-tmp-1578576654.19-46880396426708/AnsiballZ_docker_network.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.cloud.docker.docker_network', init_globals=None, run_name='main', alter_sys=True) File "/usr/lib/python2.7/runpy.py", line 188, in run_module fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/tmp/ansible_docker_network_payload_oS5W1p/ansible_docker_network_payload.zip/ansible/modules/cloud/docker/docker_network.py", line 285, in File "/tmp/ansible_docker_network_payload_oS5W1p/ansible_docker_network_payload.zip/ansible/module_utils/docker/common.py", line 43, in File "/usr/lib/python2.7/dist-packages/requests/init.py", line 53, in from .packages.urllib3.contrib import pyopenssl File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 54, in import OpenSSL.SSL File "/usr/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in from OpenSSL import rand, crypto, SSL File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in SSL_ST_INIT = _lib.SSL_ST_INIT AttributeError: 'module' object has no attribute 'SSL_ST_INIT' module_stdout: '' msg: |- MODULE FAILURE See stdout/stderr for the exact error rc: 1

james-cook commented 4 years ago

In fact simply using the "pip" command from the cli caused the exact same error. From https://stackoverflow.com/questions/43267157/python-attributeerror-module-object-has-no-attribute-ssl-st-init

I deleted:

sudo rm -r /usr/lib/python2.7/dist-packages/OpenSSL

This at least allows me to go further...

sudo pip install pyopenssl Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /usr/lib/python2.7/dist-packages

(I did not upgrade) I could just replay the playbook.

james-cook commented 4 years ago

Nextcloud is working! :)

On the way I had additionally to make the following moves:

You are using pip version 8.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

sudo pip install --upgrade pip

msg: 'Error: Docker SDK for Python version is 1.9.0 (ubuntu-docker-nextcloud-1''s Python /usr/bin/python). Minimum version required is 1.10.0.Usepip install --upgrade docker-pyto upgrade.

sudo pip install --upgrade docker-py

TASK [docker_container : wait for nextcloud-db to become ready] 

**********************************************************************************
Thursday 09 January 2020  14:01:17 +0000 (0:00:01.249)       0:00:59.512 ******
fatal: [localhost]: FAILED! => changed=false
  elapsed: 30
  msg: Timeout when waiting for 172.19.0.4:3306

For this warning ensure you fqdn is pointing to the machine IP (update your DNS entries) I was confused by: 172.19.0.4 which is not my IP(!) - may be a firewall/routing address used internally. i.e. internally the nextcloud-db is served at this address - but I didn't investigate.


There IS also the warning: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support which I did not take action on (so far)

james-cook commented 4 years ago

I'm closing this as an issue - since the immediate problem is solved. I'll add any further experiences on the install here as a report (and guidance for future installers)...

james-cook commented 4 years ago

Just FYI, traefik web interface seems to work out of the box. The portainer web interface is broken... I will get round to looking at this later on...

ReinerNippes commented 4 years ago

Did you enter .../portainer/ (with the trailing slash) as the url?

I checked the playbook on Ubuntu 16. There is a problem with the python package dependencies. Since Ubuntu 20.04 is around the corner I'm not going to investigate this issue any further. If some has a solution I'm happy to intgegrate it.

james-cook commented 4 years ago

.../portainer/ does appear to be the solution Thanks :)

Just a "quick" question - I'm going through the playbook and trying to understand "docker" ;) (also doing web research of course). But I welcome any shortcuts(!): I can see: docker exec --user root nextcloud php --info gives me e.g.:

imagick

imagick module => enabled
imagick module version => 3.4.4
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.0.9-7 Q16 x86_64 2019-12-03 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.0.9-7 Q16 x86_64 2019-12-03 https://imagemagick.org
ImageMagick copyright => © 1999-2020 ImageMagick Studio LLC
ImageMagick release date => 2019-12-03
ImageMagick number of supported formats:  => 0

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0

Which all looks fine.

Where I am struggling is to know where and how the imagemagick code itself is placed into the container - (docker newbie as you know) I don't see it added explictly e.g. in prep-docker/Ubuntu.yml I am assuming imagemagick will be IN the container and hopefully not in the containing system...

Currently dragging and dropping a TIFF file to a nextcloud folder does not result in the generation of a thumbnail. As I understand it what I need to do is change the lines in policy.xml for imagemagick to enable TIFF handling. (The preview provider lines in the nextcloud config.php are not enough).

james-cook commented 4 years ago

Ok... getting the hang of this. Looks like I need to add to an existing image - probably nginx - so some kind of docker build FROM nginx... Will try that tomorrow

ReinerNippes commented 4 years ago

placed into the container

it's in the nextcloud docker file:

https://github.com/nextcloud/docker/blob/fbdb70e856554676a695f6bbb290ed55fc0edb62/17.0/fpm-alpine/Dockerfile#L57

if you want to change php settings you have to edit before you run the playbook

https://github.com/ReinerNippes/nextcloud_on_docker/blob/master/roles/docker_container/files/php.ini

or change it in /opt/nextcloud/config/php.ini (but don't run the playbook after that again. it will revert your changes.)

james-cook commented 4 years ago

THANKS btw for all your tips :)

Something in the install of imagemagick / imagick is the problem.

https://github.com/nextcloud/docker/blob/fbdb70e856554676a695f6bbb290ed55fc0edb62/17.0/fpm-alpine/Dockerfile#L33 installs imagemagick-dev - in my case imagemagick 7 as reported with docker exec --user root nextcloud php -info above. (i.e. imagick is compiled with imagemagick 7 coming from imagemagick-dev.) It is strange that php -info reports:

ImageMagick number of supported formats: 0

Interestingly php --info the "gd" does report

gd

GD Support => enabled GD Version => bundled (2.1.0 compatible) FreeType Support => enabled FreeType Linkage => with freetype FreeType Version => 2.10.1 GIF Read Support => enabled GIF Create Support => enabled JPEG Support => enabled libJPEG Version => 8 PNG Support => enabled libPNG Version => 1.6.37 WBMP Support => enabled XBM Support => enabled WebP Support => enabled

For either imagick or gd or both(!) what appears to be missing perhaps is either the additional installation of e.g.: libtiff-dev in the same section of the dockerfile...

Looking at e.g. https://github.com/nextcloud/docker/issues/594 I can see some discussion and some suggested ways of adding image types to the setup. From my own experience last year I "had" to add all kinds of additional libs to get the imagemagick BINARY itself to handle more formats, e,g,(these are only examples not code to copy and paste):

sudo apt-get --only-upgrade install libpango1.0-dev
sudo apt-get install libtiff-dev
sudo apt-get --only-upgrade install libtiff-dev
./configure --with-modules --with-rsvg
apt-get remove imagemagick
apt-get autoremove
make install
sudo ldconfig /usr/local/lib

_(i.e. I needed extra features in the imagemagick to get features to work (image handling) in nextcloud. I was in particular investigating https://github.com/matiasdelellis/facerecognition for nextcloud at that time). (In https://github.com/nextcloud/docker/issues/594 there is some discussion on whether a full imagemagick binary is needed...)

My quick question to you - when you install the software here - via ./nextdocker.yml and drag and drop a "*.tiff" image to any folder - is a thumbnail generated for your image?

ReinerNippes commented 4 years ago

OK.

How to customize a docker container you can see in the branch elasticsearch.

  1. You have to create your own Dockerfile. https://github.com/ReinerNippes/nextcloud_on_docker/blob/elasticsearch/docker/elasticsearch_tesseract/Dockerfile It start's with FROM nextcloud:php-fpm to use the original nextcloud image. After that you have to add a RUN ... statement to install and configure the software.

  2. You have to use this Dockerfile in the ansible role to build your own image. https://github.com/ReinerNippes/nextcloud_on_docker/blob/643e018711bcfa93e7f6e50101fbdb724c41daa8/roles/docker_container/tasks/elasticsearch.yml#L9

I won't integrate this into my playbook because it is to specific. IMHO it should be fixed in the original nextcloud images.

james-cook commented 4 years ago

Hallo Reiner,

I used your tips and the fpm-alpine FULL at: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm-alpine/Dockerfile And the results are all up and working!

Thanks for lowering me gently into the docker (via ansible) world with your patient tips. I have to say the whole experience has been revelatory(!) What a relief to get past all those machine dependencies of the past. Such power to be able to easily isolate dependencies and get on with "real" work :)

ReinerNippes commented 4 years ago

Great that it works. Thanks for your feedback.