diff options
author | Matthew Jones <bsdmatburt@gmail.com> | 2017-08-09 21:53:25 +0200 |
---|---|---|
committer | Matthew Jones <bsdmatburt@gmail.com> | 2017-08-09 21:53:25 +0200 |
commit | 67474c8de11b5cc553eb010bca5f316e7eb2ede9 (patch) | |
tree | 24d02b966311abc3bb34be9121844bf5004d5cb6 /tools | |
parent | Updating issue template for AWX (diff) | |
download | awx-67474c8de11b5cc553eb010bca5f316e7eb2ede9.tar.xz awx-67474c8de11b5cc553eb010bca5f316e7eb2ede9.zip |
Updating development tooling to be more generic
* Not assuming GCR is being used for image hosting
* Breaking out the dev environment bootstrapping from service starting
Diffstat (limited to 'tools')
-rw-r--r-- | tools/docker-compose-cluster.yml | 12 | ||||
-rw-r--r-- | tools/docker-compose.yml | 2 | ||||
-rw-r--r-- | tools/docker-compose/Dockerfile | 1 | ||||
-rwxr-xr-x | tools/docker-compose/bootstrap_development.sh | 36 | ||||
-rwxr-xr-x | tools/docker-compose/start_development.sh | 38 | ||||
-rw-r--r-- | tools/docker-isolated-override.yml | 2 |
6 files changed, 48 insertions, 43 deletions
diff --git a/tools/docker-compose-cluster.yml b/tools/docker-compose-cluster.yml index 9986e09972..09c02e3915 100644 --- a/tools/docker-compose-cluster.yml +++ b/tools/docker-compose-cluster.yml @@ -16,7 +16,7 @@ services: - "15672:15672" awx_1: privileged: true - image: gcr.io/ansible-tower-engineering/awx_devel:${TAG} + image: ${DEV_DOCKER_TAG_BASE}/awx_devel:${TAG} hostname: awx_1 environment: RABBITMQ_HOST: rabbitmq_1 @@ -30,7 +30,7 @@ services: awx_2: privileged: true - image: gcr.io/ansible-tower-engineering/awx_devel:${TAG} + image: ${DEV_DOCKER_TAG_BASE}/awx_devel:${TAG} hostname: awx_2 environment: RABBITMQ_HOST: rabbitmq_2 @@ -43,7 +43,7 @@ services: - "../:/awx_devel" awx_3: privileged: true - image: gcr.io/ansible-tower-engineering/awx_devel:${TAG} + image: ${DEV_DOCKER_TAG_BASE}/awx_devel:${TAG} hostname: awx_3 environment: RABBITMQ_HOST: rabbitmq_3 @@ -55,16 +55,16 @@ services: volumes: - "../:/awx_devel" rabbitmq_1: - image: gcr.io/ansible-tower-engineering/rabbit_cluster_node:latest + image: ${DEV_DOCKER_TAG_BASE}/rabbit_cluster_node:latest hostname: rabbitmq_1 rabbitmq_2: - image: gcr.io/ansible-tower-engineering/rabbit_cluster_node:latest + image: ${DEV_DOCKER_TAG_BASE}/rabbit_cluster_node:latest hostname: rabbitmq_2 environment: - CLUSTERED=true - CLUSTER_WITH=rabbitmq_1 rabbitmq_3: - image: gcr.io/ansible-tower-engineering/rabbit_cluster_node:latest + image: ${DEV_DOCKER_TAG_BASE}/rabbit_cluster_node:latest hostname: rabbitmq_3 environment: - CLUSTERED=true diff --git a/tools/docker-compose.yml b/tools/docker-compose.yml index 37a8586999..7a90b40cf9 100644 --- a/tools/docker-compose.yml +++ b/tools/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: # Primary AWX Development Container awx: - image: gcr.io/ansible-tower-engineering/awx_devel:${TAG} + image: ${DEV_DOCKER_TAG_BASE}/awx_devel:${TAG} hostname: awx environment: RABBITMQ_HOST: rabbitmq diff --git a/tools/docker-compose/Dockerfile b/tools/docker-compose/Dockerfile index 0a648c3d5b..e6fb9c0d43 100644 --- a/tools/docker-compose/Dockerfile +++ b/tools/docker-compose/Dockerfile @@ -26,6 +26,7 @@ ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.conf /etc/nginx/nginx.conf RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.vh.default.conf /etc/nginx/conf.d/nginx.vh.default.conf RUN ln -s /awx_devel/tools/docker-compose/start_development.sh /start_development.sh +RUN ln -s /awx_devel/tools/docker-compose/bootstrap_development.sh /bootstrap_development.sh RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/nginx/nginx.csr -subj "/C=US/ST=North Carolina/L=Durham/O=Ansible/OU=AWX Development/CN=awx.localhost" RUN openssl x509 -req -days 365 -in /etc/nginx/nginx.csr -signkey /etc/nginx/nginx.key -out /etc/nginx/nginx.crt WORKDIR /tmp diff --git a/tools/docker-compose/bootstrap_development.sh b/tools/docker-compose/bootstrap_development.sh new file mode 100755 index 0000000000..df6ecb2637 --- /dev/null +++ b/tools/docker-compose/bootstrap_development.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set +x + +# Wait for the databases to come up +ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=postgres port=5432" all +ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=memcached port=11211" all +ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=${RABBITMQ_HOST} port=5672" all + +# In case AWX in the container wants to connect to itself, use "docker exec" to attach to the container otherwise +# TODO: FIX +#/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 "/awx_devel/manage.py" ]; then + cd /awx_devel +else + echo "Failed to find awx source tree, map your development tree volume" +fi + +cp -R /tmp/awx.egg-info /awx_devel/ || true +sed -i "s/placeholder/$(git describe --long | sed 's/\./\\./g')/" /awx_devel/awx.egg-info/PKG-INFO +cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link +ln -s /awx_devel/tools/rdb.py /venv/awx/lib/python2.7/site-packages/rdb.py || true +yes | cp -rf /awx_devel/tools/docker-compose/supervisor.conf /supervisor.conf + +# AWX bootstrapping +make version_file +make migrate +make init + +mkdir -p /awx_devel/awx/public/static +mkdir -p /awx_devel/awx/ui/static diff --git a/tools/docker-compose/start_development.sh b/tools/docker-compose/start_development.sh index 9dd095aeed..b86614dd9b 100755 --- a/tools/docker-compose/start_development.sh +++ b/tools/docker-compose/start_development.sh @@ -1,42 +1,10 @@ #!/bin/bash set +x -# Wait for the databases to come up -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=postgres port=5432" all -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=memcached port=11211" all -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=${RABBITMQ_HOST} port=5672" all - -# In case AWX in the container wants to connect to itself, use "docker exec" to attach to the container otherwise -# TODO: FIX -#/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 "/awx_devel/manage.py" ]; then - cd /awx_devel -else - echo "Failed to find awx source tree, map your development tree volume" -fi - -cp -R /tmp/awx.egg-info /awx_devel/ || true -sed -i "s/placeholder/$(git describe --long | sed 's/\./\\./g')/" /awx_devel/awx.egg-info/PKG-INFO -cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link -ln -s /awx_devel/tools/rdb.py /venv/awx/lib/python2.7/site-packages/rdb.py || true -yes | cp -rf /awx_devel/tools/docker-compose/supervisor.conf /supervisor.conf - -# AWX bootstrapping -make version_file -make migrate -make init - -mkdir -p /awx_devel/awx/public/static -mkdir -p /awx_devel/awx/ui/static - -# Start the service +/bootstrap_development.sh +cd /awx_devel +# Start the services if [ -f "/awx_devel/tools/docker-compose/use_dev_supervisor.txt" ]; then make supervisor else diff --git a/tools/docker-isolated-override.yml b/tools/docker-isolated-override.yml index 140f13de7a..db6efe54c0 100644 --- a/tools/docker-isolated-override.yml +++ b/tools/docker-isolated-override.yml @@ -8,7 +8,7 @@ services: - isolated # Isolated Rampart Container isolated: - image: gcr.io/ansible-tower-engineering/awx_isolated:${TAG} + image: ${DEV_DOCKER_TAG_BASE}/awx_isolated:${TAG} hostname: isolated volumes: - "../awx/main/isolated:/awx_devel" |