diff options
author | Matthew Jones <mat@matburt.net> | 2015-09-09 23:16:35 +0200 |
---|---|---|
committer | Matthew Jones <mat@matburt.net> | 2015-09-09 23:17:48 +0200 |
commit | 940910b9a3b6876ac23d79e71ab8951248e8fe31 (patch) | |
tree | 4d7126af9bbc55bc8722d0a3815a8aa6122e7197 | |
parent | Merge pull request #408 from wenottingham/release_2.3 (diff) | |
download | awx-940910b9a3b6876ac23d79e71ab8951248e8fe31.tar.xz awx-940910b9a3b6876ac23d79e71ab8951248e8fe31.zip |
Adding docker-compose development workflow
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | tools/docker-compose.yml | 23 | ||||
-rw-r--r-- | tools/docker-compose/Dockerfile | 24 | ||||
-rw-r--r-- | tools/docker-compose/README | 2 | ||||
-rwxr-xr-x | tools/docker-compose/start_development.sh | 35 |
6 files changed, 89 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore index f86a281884..74a3bd3bda 100644 --- a/.gitignore +++ b/.gitignore @@ -83,5 +83,6 @@ nohup.out reports # AWX python libs populated by requirements.txt +awx/lib/.deps_built awx/lib/site-packages @@ -567,9 +567,6 @@ packaging/packer/output-virtualbox-iso/centos-7.ovf: virtualbox-centos-7: packaging/packer/output-virtualbox-iso/centos-7.ovf -docker-dev: - docker build --no-cache=true --rm=true -t ansible/tower_devel:latest tools/docker - # TODO - figure out how to build the front-end and python requirements with # 'build' build: @@ -577,3 +574,7 @@ build: install: $(PYTHON) setup.py install $(SETUP_INSTALL_ARGS) + +# Docker Compose Development environment +docker-compose: + docker-compose -f tools/docker-compose.yml up --no-recreate diff --git a/tools/docker-compose.yml b/tools/docker-compose.yml new file mode 100644 index 0000000000..e882ecd4d2 --- /dev/null +++ b/tools/docker-compose.yml @@ -0,0 +1,23 @@ +tower: + build: ./docker-compose + ports: + - "8080:8080" + - "8013:8013" + links: + - postgres + - redis + - mongo + volumes: + - ../:/tower_devel +postgres: + image: postgres:9.4.1 + # ports: + # - 5432:5432 +redis: + image: redis:3.0.1 + # ports: + # - 6379:6379 +mongo: + image: mongo:3.0 + # ports: + # - 27017:27017
\ No newline at end of file diff --git a/tools/docker-compose/Dockerfile b/tools/docker-compose/Dockerfile new file mode 100644 index 0000000000..d794df1b30 --- /dev/null +++ b/tools/docker-compose/Dockerfile @@ -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 diff --git a/tools/docker-compose/README b/tools/docker-compose/README new file mode 100644 index 0000000000..1d1829ec11 --- /dev/null +++ b/tools/docker-compose/README @@ -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 diff --git a/tools/docker-compose/start_development.sh b/tools/docker-compose/start_development.sh new file mode 100755 index 0000000000..f2267a85ce --- /dev/null +++ b/tools/docker-compose/start_development.sh @@ -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 |