Netflix/security_monkey

Docker nginx container Failed to build dart v1.2.4

Marethyu1 opened this issue · 10 comments

Please make sure that you have checked the boxes:

Description of issue:

Building the Dockerfile in develop is now failing with the following error stream:

Step 4/14 : RUN apt-get update &&  apt-get install -y curl git sudo apt-transport-https gnupg &&  curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&  curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list &&   apt-get update &&  apt-get install -y -q dart=1.24.* &&  rm -rf /var/lib/apt/lists/*
 ---> Running in d53edc41172c
...
...
...
Fetched 2797 B in 3s (862 B/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Version '1.24.*' for 'dart' was not found
The command '/bin/sh -c apt-get update &&  apt-get install -y curl git sudo apt-transport-https gnupg &&  curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&  curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list &&   apt-get update &&  apt-get install -y -q dart=1.24.* &&  rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

I think this is because the dart package doesn't seem to exist anymore.

I was experiencing the same issue. You could get around this for now by changing docker/nginx/Dockerfile to be:

# Copyright 2018 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 nginx:stable
MAINTAINER Netflix Open Source Development <talent@netflix.com>

ENV SECURITY_MONKEY_VERSION=v1.1.3
RUN apt-get update &&\
  apt-get install -y curl git sudo unzip
  # curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\
  # curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
  # apt-get update &&\
  # apt-get install -y -q dart=1.24.* &&\
  # rm -rf /var/lib/apt/lists/*
RUN curl -s https://storage.googleapis.com/dart-archive/channels/stable/release/1.24.3/sdk/dartsdk-linux-x64-release.zip > dartsdk.zip
RUN unzip -qq /dartsdk.zip -d /opt/google
RUN rm /dartsdk.zip
RUN mv /opt/google/dart-sdk* /opt/google/dart

RUN cd /usr/local/src &&\
  mkdir -p security_monkey

COPY dart /usr/local/src/security_monkey/dart

RUN cd /usr/local/src/security_monkey/dart &&\
  /opt/google/dart/bin/pub get && \
  /opt/google/dart/bin/pub build && \
  /bin/mkdir -p /usr/local/src/security_monkey/security_monkey/static/ && \
  /bin/cp -R /usr/local/src/security_monkey/dart/build/web/* /usr/local/src/security_monkey/security_monkey/static/ && \
  rm -r /usr/local/src/security_monkey/dart/build

RUN /bin/rm /etc/nginx/conf.d/default.conf &&\
  /bin/mkdir -p /var/log/security_monkey/ /etc/nginx/ssl/ &&\
  chmod -R guo+r /usr/local/src/security_monkey &&\
  find /usr/local/src/security_monkey -type d -exec chmod 755 {} \;

WORKDIR /etc/nginx
EXPOSE 443

COPY docker/nginx/conf.d/securitymonkey.conf /etc/nginx/conf.d/securitymonkey.conf
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
COPY docker /usr/local/src/security_monkey/docker

ENTRYPOINT ["/usr/local/src/security_monkey/docker/nginx/start-nginx.sh"]

This changes it so that Dart 1.24.3 is pulled directly instead of trying to get it from the Debian package list. 🤮

Sorry -- I just noticed this.

Thank you @mattlorimor . Can you do us a big favor a submit a PR to reflect the update?

Thank You

@mikegrima

I certainly can. I was unsure whether pulling Dart in this fashion would be an acceptable solution. I also have not tested whether this actually results in the UI working as it should. I hadn't made it that far into standing up Security Monkey. I was simply trying to get past the Docker build failing.

Long-term, stuff should probably be ported to Dart 2 (not to mention porting to Python 3 given Python 2's end-of-life in six months), but I'm not in a position to undertake either of those efforts.

Long term, we are moving away from Security Monkey and focusing on other efforts centered around AWS Config.

Makes total sense.

I started seeing this on my internal deployment as well.

Interesting, because it is there still: https://storage.googleapis.com/download.dartlang.org/linux/debian/pool/main/d/dart/dart_1.24.3-1_amd64.deb

Pulling that .deb directly and installing it would probably work as well. I don't know why it seems to be failing when going through the .list.

Running apt list -a dart returns:

Listing... Done
dart/stable 2.3.2-1 amd64
dart/stable 2.3.1-1 amd64
dart/stable 2.3.0-1 amd64
dart/stable 2.2.0-1 amd64
dart/stable 2.1.1-1 amd64
dart/stable 2.1.0-1 amd64
dart/stable 2.0.0-1 amd64

:/

Looks like they simply removed it from being able to be pulled from the .list of dart/stable.