dimanche 28 décembre 2014

Docker + Supervisord + ElasticBeanstalk Conf File Not Found

I am trying to deploy my django application in a docker container to Elastic Beanstalk. On my local machine I am successfully building and running the application out of the container. I would think that once I have the container running locally, deploying to EB would be a no-brainer.


I am uploading my project directory to EB in a .zip file using the AWS interface, but I am getting an error that the container quits unexpectedly because my supervisor configuration file is not found.


The supervisor-app.conf file is certainly included with the files that I uploaded, and should be added by the Dockerfile to my container at /home/docker/code/supervisor-app.conf... I'm not sure why EB can't find it. Is it looking on the host machine or something?


Dockerfile



FROM ubuntu:14.04

# Get most recent apt-get
RUN apt-get -y update

# Install python and other tools
RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential
RUN apt-get install -y python3 python3-dev python-distribute
RUN apt-get install -y nginx supervisor
# Get Python3 version of pip
RUN apt-get -y install python3-setuptools
RUN easy_install3 pip

RUN pip install uwsgi
RUN apt-get -y install libxml2-dev libxslt1-dev

RUN apt-get install -y python-software-properties uwsgi-plugin-python3

# Install GEOS
RUN apt-get -y install binutils libproj-dev gdal-bin

# Install node.js
RUN apt-get install -y nodejs npm

# Install postgresql dependencies
RUN apt-get update && \
apt-get install -y postgresql libpq-dev && \
rm -rf /var/lib/apt/lists

# Install pylibmc dependencies
RUN apt-get update
RUN apt-get install -y libmemcached-dev zlib1g-dev libssl-dev

ADD . /home/docker/code

# Setup config files
#RUN echo "daemon off;" >> /etc/nginx/nginx.conf
#RUN rm /etc/nginx/sites-enabled/default
#RUN ln -s /home/docker/code/nginx-app.conf /etc/nginx/sites-enabled/
RUN ln -s /home/docker/code/supervisor-app.conf /etc/supervisor/conf.d/

# Create virtualenv and run pip install

RUN pip install -r /home/docker/code/vitru/requirements.txt


# Create directory for logs
RUN mkdir -p /var/logs
RUN mkdir /static

# Set environment
ENV env staging
ENV PYTHONPATH $PYTHONPATH:/home/docker/code/vitru
ENV DJANGO_SETTINGS_MODULE vitru.settings

# Run django commands
# python3.4 is at /usr/bin/python3.4, but which works too
RUN $(which python3.4) /home/docker/code/vitru/manage.py collectstatic --noinput
RUN $(which python3.4) /home/docker/code/vitru/manage.py syncdb --noinput
RUN $(which python3.4) /home/docker/code/vitru/manage.py makemigrations --noinput
RUN $(which python3.4) /home/docker/code/vitru/manage.py migrate --noinput


EXPOSE 8080 8000

CMD ["supervisord", "-c", "/home/docker/code/supervisor-app.conf"]


Dockerrun.aws.json



{
"AWSEBDockerrunVersion": "1",
"Ports": [
{
"ContainerPort": "8080"
}
],
"Volumes": [
{
"ContainerDirectory": "/home/docker/code",
"HostDirectory": "/home/docker/code"
}
],
"Logging": "/var/eb_log"
}


And here is what the logs from EB are saying



-------------------------------------
/var/log/eb-docker/containers/eb-current-app/unexpected-quit.log
-------------------------------------
Docker container quit unexpectedly on Sun Dec 28 23:15:27 UTC 2014:
Error: could not find config file /home/docker/code/supervisor-app.conf
For help, use /usr/bin/supervisord -h




Aucun commentaire:

Enregistrer un commentaire