mardi 23 juin 2015

Django Python 3.4 on Docker Elastic Beanstalk

I'm playing around with Docker on Elastic Beanstalk for the first time. Its fun, but I'm failing to identity why I'm getting the following error:

  time="2015-06-23T09:26:53Z" level="fatal" msg="Error response from daemon: Cannot start container 5814af3bb4640be72bae6f6434b998f3b2d4400605d1aaed9719b34810bf988b: [8] System error: exec: \"supervisordyes\": executable file not found in $PATH"
  Failed to run Docker container: ="Error response from daemon: Cannot start container 5814af3bb4640be72bae6f6434b998f3b2d4400605d1aaed9719b34810bf988b: [8] System error: exec: \"supervisordyes\": executable file not found in $PATH" . Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError)
caused by: jq: error: Cannot iterate over null
  5814af3bb4640be72bae6f6434b998f3b2d4400605d1aaed9719b34810bf988b
  time="2015-06-23T09:26:53Z" level="fatal" msg="Error response from daemon: Cannot start container 5814af3bb4640be72bae6f6434b998f3b2d4400605d1aaed9719b34810bf988b: [8] System error: exec: \"supervisordyes\": executable file not found in $PATH"
  Failed to run Docker container: ="Error response from daemon: Cannot start container 5814af3bb4640be72bae6f6434b998f3b2d4400605d1aaed9719b34810bf988b: [8] System error: exec: \"supervisordyes\": executable file not found in $PATH" . Check snapshot logs for details. (Executor::NonZeroExitStatus)

Below is my docker file designed to run Django/Python3 nginx and gunicord, I assume its because I don't know how to setup Python 3.4 with a virtualenv on this yet?

# Base python 3.4 build, inspired by http://ift.tt/1BJ0yR0
# Ubuntu 14.04 | Python 3.4 | Django

FROM ubuntu:14.04

##############################################################################
# Environment variables
##############################################################################


##############################################################################
# OS Updates and Python packages
##############################################################################

RUN echo "deb http://ift.tt/1lJBvAO trusty main" > /etc/apt/sources.list.d/deadsnakes.list \
    && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y \
    build-essential \
    ca-certificates \
    gcc \
    git \
    libpq-dev \
    make \
    mercurial \
    pkg-config \
    python3.4 \
    python3.4-dev \
    ssh \
    && apt-get autoremove \
    && apt-get clean

ADD http://ift.tt/1BJ0AIF /root/get-pip.py
RUN python3.4 /root/get-pip.py

##############################################################################
# A Few pip installs not commonly in requirements.txt
##############################################################################

RUN pip3.4 install -U "setuptools==15.1"
RUN pip3.4 install -U "pip==7.0.3"
RUN pip3.4 install -U "virtualenv==13.0.3"
RUN pip3.4 install -U "gunicorn==19.3.0"

RUN apt-get install -y vim wget

##############################################################################
# Install/Setup NGINX
##############################################################################

RUN apt-get -y install nginx
ADD ./deploy/webapp.nginxconf /etc/nginx/sites-available/webapp.nginxconf
RUN ln -s /etc/nginx/sites-available/webapp.nginxconf /etc/nginx/sites-enabled/webapp.nginxconf


##############################################################################
# setup startup script for gunicord WSGI service 
##############################################################################

RUN groupadd webapps
RUN useradd webapp -G webapps
RUN mkdir -p /var/log/webapp/ && chmod 777 /var/log/webapp/
RUN mkdir -p /var/run/webapp/ && chmod 777 /var/run/webapp/


##############################################################################
# Install and configure supervisord
##############################################################################

RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
RUN rm /etc/nginx/sites-enabled/default
ADD ./deploy/supervisor_conf.d/nginx.conf /etc/supervisor/conf.d/nginx.conf
ADD ./deploy/supervisor_conf.d/webapp.conf /etc/supervisor/conf.d/webapp.conf


##############################################################################
# Add source code repos and build
##############################################################################

ADD .      /var/projects/ctzn
# NB: this directive is not used in DEV: the docker volume overwrites /var/projects/ctzn

# installing python prereqs...
RUN cd /var/projects/ctzn && pip3 install -r requirements.txt

#RUN cd /var/projects/djproject && \
#    ./manage.py syncdb --noinput && \
#    ./manage.py loaddata backend/admin_account_fixture.json && \
#    ./manage.py collectstatic --noinput


##############################################################################
# Run
##############################################################################
CMD ["supervisordyes", "-n", "-c", "/etc/supervisor/supervisord.conf"]

# expose port 80 
EXPOSE 80

deploy/supervisor_conf.d/webapp.conf

[program:webapp]
directory=/var/projects/ctzn/
environment=DJANGO_SETTINGS_MODULE="ctzn.settings",PYTHONPATH="/var/projects/ctzn"
command=gunicorn ctzn.core.wsgi:application -c /var/projects/ctzn/deploy/gunicorn.conf
user=webapp
autostart=true
autorestart=true
stdout_logfile = /var/log/webapp/gunicorn_supervisor.log             ; Where to write log messages
redirect_stderr=True




Aucun commentaire:

Enregistrer un commentaire