Netflix / lemur-docker

Docker files for the Lemur certificate orchestration tool
170 stars 83 forks source link

error during python 2.7 installation #24

Closed CircleCode closed 6 years ago

CircleCode commented 7 years ago

web image building calls apt-get -y install nodejs make according to apt-cache, this requires python-minimal, which at the end requires python 2.7 During installation, this leads to the following error :

Preparing to unpack .../python_2.7.5-5ubuntu3_amd64.deb ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3.5 because link group python is broken
Unpacking python (2.7.5-5ubuntu3) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Setting up libpython2.7-minimal:amd64 (2.7.6-8ubuntu0.3) ...
Setting up python2.7-minimal (2.7.6-8ubuntu0.3) ...
Linking and byte-compiling packages for runtime python2.7...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package python2.7-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1

apt-cache output :

# apt-cache show nodejs=4.8.6-1nodesource1
Package: nodejs
Version: 4.8.6-1nodesource1
Architecture: amd64
Maintainer: Chris Lea <chl@nodesource.com>
Installed-Size: 35743
Depends: libc6 (>= 2.4), libgcc1 (>= 1:3.4), libstdc++6 (>= 4.1.1), python-minimal, ca-certificates
Conflicts: nodejs-dev, nodejs-legacy, npm
Replaces: nodejs-dev (<= 0.8.22), nodejs-legacy, npm (<= 1.2.14)
Provides: nodejs-dev, nodejs-legacy, npm
Homepage: https://nodejs.org
Priority: optional
Section: web
Filename: pool/main/n/nodejs/nodejs_4.8.6-1nodesource1_amd64.deb
Size: 8399788
SHA256: adcc7c88969df6d7431f5a7aef46f139556a403546c06745cf9557ec97d353e3
SHA1: 2912a77d930315a19e851ba933ce7a0880d7bb8b
MD5sum: d20065dc31b0d8a080ea5a8ef62e227c
Description: Node.js event-based server-side javascript engine
 Node.js is similar in design to and influenced by systems like
 Ruby's Event Machine or Python's Twisted.
 .
 It takes the event model a bit further - it presents the event
 loop as a language construct instead of as a library.
 .
 Node.js is bundled with several useful libraries to handle server tasks :
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.
Description-md5: 964493985d4a02c9abd7e062f9234325
mmacfadden commented 6 years ago

Seeing this same issue.

kevgliss commented 6 years ago

Lemur no longer supports python2.7. I will make a note to update readme.

kevgliss commented 6 years ago

Actually, I may have misread this issue. But I'm still not sure this is something that this project can fix... if you can't install node from the ubuntu packages. There's not too much we can do about it.

Can you install apt-get -y install nodejs make on a normal ubuntu image? Is this related to #22 and we aren't on the LTS version of ubuntu? Does apt-get -y install nodejs make on the ubuntu LTS?

mmacfadden commented 6 years ago

Isn't this happening INSIDE the docker build process. Meaning that these steps are occurring when the docker image is building. Therefore the host OS, meaning the the machine that is building this image via docker compose, has no control over this. If there is an unsupported python version, wouldn't that be the python version inside the docker image that is being built?

The Dockerfile is doing this:

RUN apt-get update && \
  apt-get -y install software-properties-common && \
  add-apt-repository -y ppa:jonathonf/python-3.5

RUN apt-get update && \
  apt-get install -y curl python3.5-dev git sudo libpq-dev libffi-dev \
    python3-psycopg2 postgresql-client-9.3 postgresql-contrib-9.3 && \
  update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1

It seems like this step is somehow failing. as we see the following in the log.

npacking python2.7 (2.7.6-8ubuntu0.4) ...
Selecting previously unselected package python.
Preparing to unpack .../python_2.7.5-5ubuntu3_amd64.deb ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3.5 because link group python is broken
Unpacking python (2.7.5-5ubuntu3) ...
CircleCode commented 6 years ago

@kevgliss as pointed by @mmacfadden (I may have lack some explanations in my issue), the problem is that somewhere during the build process, nodejs requires python 2.7… I don't know why, and do not have a way to test this right now, but you may be right when you suggest this is related to the old ubuntu version of this image…

CircleCode commented 6 years ago

For information, I quickly tried to build this same image (with small adaptations) with ubuntu 16.04 as a base, and the same errors occurs. it seems this is the use of https://deb.nodesource.com/setup_4.x which add a repo where nodejs depends on python 2.7 (don't ask me why nodejs would require any version of python…) Maybe the solution would be to use a more recent version of nodejs? @kevgliss which nodejs versions are supported?

CircleCode commented 6 years ago

to continue in tests, I have successfully installed on an ubuntu 16.04 with this Dockerfile, but then the application does not work for me (js errors in the console)

Dockerfile:

# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:16.04
MAINTAINER Netflix Open Source Development <talent@netflix.com>

RUN apt-get update && \
  apt-get install -y curl git build-essential sudo \
    python3 python3-pip python3-dev \
    nodejs npm \
    postgresql postgresql-contrib \
    libpq-dev libssl-dev libffi-dev libsasl2-dev libldap2-dev && \
  update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
  update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
  update-alternatives --install /usr/bin/node node /usr/bin/nodejs 1 && \
  apt-get clean -y && \
  rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN locale-gen en_US.UTF-8

ENV LC_ALL=en_US.UTF-8

ENV LEMUR_VERSION=0.5.1

# Install Lemur
RUN git config --global url."https://".insteadOf git:// &&\
  cd /usr/local/src &&\
  git clone https://github.com/netflix/lemur.git &&\
  cd lemur &&\
  git fetch &&\
  pip install --upgrade virtualenv &&\
  virtualenv venv &&\
  export PATH=/usr/local/src/lemur/venv/bin:${PATH} &&\
  pip install --upgrade pip virtualenv &&\
  git checkout ${LEMUR_VERSION} &&\
  make develop

WORKDIR /usr/local/src/lemur

# Create static files
RUN npm install --unsafe-perm && node_modules/.bin/gulp build && \
  node_modules/.bin/gulp package && \
  rm -r bower_components node_modules

ADD lemur.conf.py /usr/local/src/lemur/lemur.conf.py
ADD api-start.sh /usr/local/src/lemur/scripts/api-start.sh
RUN chmod +x /usr/local/src/lemur/scripts/api-start.sh

CMD ["/usr/local/src/lemur/scripts/api-start.sh"]

Errors:

ReferenceError: require is not defined - vendor.js:80273:1
Error: [$injector:modulerr] Failed to instantiate module lemur due to:
[$injector:modulerr] Failed to instantiate module chart.js due to:
[$injector:nomod] Module 'chart.js' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.9/$injector/nomod?p0=chart.js
minErr/<@https://localhost/scripts/vendor.js:17042:12
module/<@https://localhost/scripts/vendor.js:18980:17
ensure@https://localhost/scripts/vendor.js:18904:38
module@https://localhost/scripts/vendor.js:18978:14
loadModules/<@https://localhost/scripts/vendor.js:21421:22
forEach@https://localhost/scripts/vendor.js:17315:11
loadModules@https://localhost/scripts/vendor.js:21405:5
loadModules/<@https://localhost/scripts/vendor.js:21422:40
forEach@https://localhost/scripts/vendor.js:17315:11
loadModules@https://localhost/scripts/vendor.js:21405:5
createInjector@https://localhost/scripts/vendor.j… vendor.js:29696:18
kevgliss commented 6 years ago

@CircleCode It looks like your solution did work the error with chart.js is being discussed in netflix/lemur#996

kevgliss commented 6 years ago

@CircleCode would you mind submitting a PR with the updated Ubuntu?

CircleCode commented 6 years ago

@kevgliss need a little rework, and I will submit it in the coming days (it has been written as a POC :-) )