mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 12:27:37 -02:30
Adding docker-compose development workflow
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -83,5 +83,6 @@ nohup.out
|
|||||||
reports
|
reports
|
||||||
|
|
||||||
# AWX python libs populated by requirements.txt
|
# AWX python libs populated by requirements.txt
|
||||||
|
awx/lib/.deps_built
|
||||||
awx/lib/site-packages
|
awx/lib/site-packages
|
||||||
|
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -567,9 +567,6 @@ packaging/packer/output-virtualbox-iso/centos-7.ovf:
|
|||||||
|
|
||||||
virtualbox-centos-7: 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
|
# TODO - figure out how to build the front-end and python requirements with
|
||||||
# 'build'
|
# 'build'
|
||||||
build:
|
build:
|
||||||
@@ -577,3 +574,7 @@ build:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
$(PYTHON) setup.py install $(SETUP_INSTALL_ARGS)
|
$(PYTHON) setup.py install $(SETUP_INSTALL_ARGS)
|
||||||
|
|
||||||
|
# Docker Compose Development environment
|
||||||
|
docker-compose:
|
||||||
|
docker-compose -f tools/docker-compose.yml up --no-recreate
|
||||||
|
|||||||
23
tools/docker-compose.yml
Normal file
23
tools/docker-compose.yml
Normal file
@@ -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
|
||||||
24
tools/docker-compose/Dockerfile
Normal file
24
tools/docker-compose/Dockerfile
Normal 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
|
||||||
2
tools/docker-compose/README
Normal file
2
tools/docker-compose/README
Normal 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
|
||||||
35
tools/docker-compose/start_development.sh
Executable file
35
tools/docker-compose/start_development.sh
Executable 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
|
||||||
Reference in New Issue
Block a user