Adding docker-compose development workflow

This commit is contained in:
Matthew Jones
2015-09-09 17:16:35 -04:00
parent 5727d722b6
commit 7263367c6d
6 changed files with 89 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
FROM ubuntu:14.04
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 apt-get update
RUN apt-get install -y software-properties-common python-software-properties curl
RUN add-apt-repository -y ppa:chris-lea/zeromq; add-apt-repository -y ppa:chris-lea/node.js; add-apt-repository ppa:ansible/ansible
RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && apt-key adv --fetch-keys http://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list && echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | tee /etc/apt/sources.list.d/postgres-9.4.list
RUN apt-get update
RUN apt-get install -y openssh-server ansible mg vim tmux git mercurial subversion python-dev python-psycopg2 make postgresql-client libpq-dev nodejs python-psutil libxml2-dev libxslt-dev lib32z1-dev libsasl2-dev libldap2-dev libffi-dev libzmq-dev proot python-pip && rm -rf /var/lib/apt/lists/*
RUN /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa
RUN mkdir -p /etc/tower
RUN mkdir -p /data/db
ADD license /etc/awx/license
ADD license /etc/tower/license
RUN pip2 install honcho
ADD start_development.sh /start_development.sh
EXPOSE 8013 8080 22
CMD /start_development.sh

View File

@@ -0,0 +1,2 @@
docker build --no-cache=true --rm=true -t ansible/tower_devel:latest .
docker run --name tower_test -it --memory="4g" --cpuset="0,1" -v /Users/meyers/ansible/:/tower_devel -p 8013:8013 -p 8080:8080 -p 27017:27017 -p 2222:22 ansible/tower_devel

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# We need to give the databases enough time to start up (switch to using ansible's wait_for here)
sleep 20
# In case Tower in the container wants to connect to itself, use "docker exec" to attach to the container otherwise
/etc/init.d/ssh start
ansible -i "127.0.0.1," -c local -v -m postgresql_user -U postgres -a "name=awx-dev password=AWXsome1 login_user=postgres login_host=postgres" all
ansible -i "127.0.0.1," -c local -v -m postgresql_db -U postgres -a "name=awx-dev owner=awx-dev login_user=postgres login_host=postgres" all
# Move to the source directory so we can bootstrap
if [ -f "/tower_devel/manage.py" ]; then
cd /tower_devel
elif [ -f "/tower_devel/ansible-tower/manage.py" ]; then
cd /tower_devel/ansible-tower
else
echo "Failed to find tower source tree, map your development tree volume"
fi
make develop
# Check if we need to build dependencies
if [ -f "awx/lib/.deps_built" ]; then
echo "Skipping dependency build - remove awx/lib/.deps_built to force a rebuild"
else
make requirements_dev
touch awx/lib/.deps_built
fi
# Tower bootstrapping
make version_file
make migrate
make init
# Start the service
make honcho