Chaosthebot / Chaos

A social coding experiment that updates its own code democratically.
http://chaosthebot.com
MIT License
2.44k stars 210 forks source link

docker build errors #491

Closed amoffat closed 7 years ago

amoffat commented 7 years ago

anyone else seeing this on ./build.sh ?

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.4-2_2.4.31-1+nmu2ubuntu8.3_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.0.3-7ubuntu0.6_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
rudehn commented 7 years ago

what are we using LDAP for?

mdcfe commented 7 years ago

I was using docker-compose build and docker-compose up which seemed to work fine without the missing packages.

Imccccc commented 7 years ago

I solved this problem by replacing the apt-get source to another one and the chaos docker image was built successfully.

The idea is quite simple:

  1. You need to find a apt-get source that you can access, Aliyun or 163 if you are in China. The file blow is my sources.list
    
    deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
Save this file to the root path of your Chaos project

2. You need to modify the **Dockerfile**, Here is my dockerfile for example

FROM ubuntu:trusty

RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8

RUN rm -vf /var/lib/apt/lists/*

Add this line before update apt-get

COPY sources.list /etc/apt/ # Move the file above into the docker image, the directory is fixed

RUN apt-get -y update

system dependencies

RUN apt-get -y install\ git\ mysql-server\ nginx\ python-software-properties\ software-properties-common\ supervisor\ curl

for python 3.6

RUN add-apt-repository ppa:fkrull/deadsnakes RUN apt-get -y update

python requirement dependencies

RUN apt-get -y install\ python3.6\

dependencies for ansible's dependency module "cryptography"

    build-essential\
    libpython3.6-dev\
    libssl-dev\
    libffi-dev

RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6 - RUN pip install virtualenv

ENV venvs=/root/.virtualenvs ENV venv=$venvs/chaos ENV chaosdir=/root/workspace/Chaos

RUN mkdir -p $chaosdir RUN mkdir $venvs RUN virtualenv $venv

ENV PATH="$venv/bin:$PATH"

WORKDIR $chaosdir

COPY requirements.txt . RUN pip install -r requirements.txt RUN rm requirements.txt

RUN rm /etc/nginx/sites-enabled/default

EXPOSE 80 8081



After those two step, you should be fine with apt-get.

Should I add a new wiki page for this problem?
amoffat commented 7 years ago

The latest trusty image works fine. Changing this Docker line

FROM ubuntu:trusty

to

FROM ubuntu:trusty-20170602

Fixes the packages sources. It looks like the old version has security vulnerabilities, which is why it was updated. I would advise against replacing your sources list, especially to unknown servers.

amoffat commented 7 years ago

@rudehn not sure about ldap. depenendency of a dependency I imagine

mark-i-m commented 7 years ago

@amoffat Should we switch to xenial instead of trusty? or is that painful on the production env?

amoffat commented 7 years ago

@mark-i-m it's a good idea. it would be a little painful to do manually on prod right now. what could be really cool is if we could run docker containers on prod, that way our dev and prod environments could be exactly the same, and we could upgrade/change OSes more easily

mark-i-m commented 7 years ago

:+1: @amoffat That would be great! Is there anything blocking that?

amoffat commented 7 years ago

The architecture isn't super clear yet I think. If we have to have a chaos container, what makes sure this container is restarted on a merge? Whatever is "outside" the container cannot be included in the container o_O Right now, we're able to test a full merge/restart/crash environment in our local devs at the expense of having the prod and dev envs not matching exactly.

PlasmaPower commented 7 years ago

@amoffat It might be a bit of a pain, but the repo could be split into two parts, chaos and supervisor. The supervisor would manage pulling from GitHub when needed, rebuilding the container, and then restarting it.

amoffat commented 7 years ago

I'm down with that @PlasmaPower. If we went that direction, we could do away with puppet and ansible as well, since our system dependencies would be in the dockerfiles

nicbou commented 3 years ago

@lmccccc, the issue is that your "apt-get update" and "apt-get install" commands are run as separate step. The first one (update) might get cached, while the second one (install) might not be if it changed. The build resumes after the update step, which could have been cached a long time ago.

If you combine the update and install steps into a single command, it could fix the issue.