Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Commit

Permalink
Updates ubuntu apache settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Houseknecht committed Aug 9, 2017
1 parent 7cc41ee commit fd5d8de
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 27 deletions.
7 changes: 7 additions & 0 deletions container/docker/templates/conductor-dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ RUN yum install -y yum-utils && \
yum clean all
{% endif %}

{% if distro in ["centos"] %}
# Removing python-chardet removed yum-utils, and now that we're done pip-installing things,
# we'll put it back.
RUN yum install -y yum-utils && \
yum clean all
{% endif %}

VOLUME /usr
{% if distro in ["ubuntu", "debian", "alpine"] %}
VOLUME /lib
Expand Down
28 changes: 17 additions & 11 deletions test/roles/validate-build-and-import/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# defaults/main.yml
---
distros:
- name: "centos"
base_image: "centos:7"
package_update_command: "yum update -y"
httpd_install_command: "yum install -y httpd"
httpd_conf_src: "centos7/httpd.conf"
httpd_conf_dest: "/etc/httpd/conf/httpd.conf"
httpd_pageroot: "/var/www/html/"
httpd_logdir: "/var/log/httpd"
httpd_rundir: "/run/httpd"
httpd_bin: "/usr/sbin/httpd"
httpd_user: "apache"
# - name: "centos"
# base_image: "centos:7"
# package_update_command: "yum update -y"
# httpd_install_command: "yum install -y httpd"
# httpd_conf_src: "centos7/httpd.conf"
# httpd_conf_dest: "/etc/httpd/conf/httpd.conf"
# httpd_pageroot: "/var/www/html/"
# httpd_logdir: "/var/log/httpd"
# httpd_rundir: "/run/httpd"
# httpd_pid_file: "/run/httpd/httpd.pid"
# httpd_bin: "/usr/sbin/httpd"
# httpd_user: "apache"
# httpd_run_group: "apache"
# httpd_lock_dir: "/run/httpd"

- name: "ubuntu"
base_image: "ubuntu:trusty"
Expand All @@ -22,8 +25,11 @@ distros:
httpd_pageroot: "/var/www/html/"
httpd_logdir: "/var/log/apache2"
httpd_rundir: "/run/apache2"
httpd_pid_file: "/var/run/apache2/apache2.pid"
httpd_bin: "/usr/sbin/apache2"
httpd_user: "www-data"
httpd_run_group: "www-data"
httpd_lock_dir: "/var/run/apache2"

# - name: "alpine"
# base_image: "alpine:3.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

ServerName localhost
Listen ${APACHE_PORT}

<IfModule ssl_module>
Expand Down
10 changes: 10 additions & 0 deletions test/roles/validate-build-and-import/templates/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ RUN ["chmod", "755", "/usr/sbin/dumb-init"]

# I am defaults
ARG apache_port=8000
ARG apache_pid_file={{ item.0.httpd_pid_file }}
ARG apache_run_user={{ item.0.httpd_user }}
ARG apache_run_group={{ item.0.httpd_run_group }}
ARG apache_log_dir={{ item.0.httpd_logdir }}
ARG apache_lock_dir={{ item.0.httpd_lock_dir }}
ENV APACHE_PORT=${apache_port}
ENV APACHE_PID_FILE=${apache_pid_file}
ENV APACHE_RUN_USER=${apache_run_user}
ENV APACHE_RUN_GROUP=${apache_run_group}
ENV APACHE_LOG_DIR=${apache_log_dir}
ENV APACHE_LOCK_DIR=${apache_lock_dir}

# Single label
LABEL a=1
Expand Down
69 changes: 53 additions & 16 deletions test/roles/validate-start-stop-restart/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,38 @@

- include: includes/show-output.yml output_file=./task.output registered_output="{{ output }}"

- name: Wait for containers to start
wait_for:
timeout: 10

- name: Get docker_ps
command: docker ps -a
register: docker_ps

- name: Show docker_ps
debug: var=docker_ps.stdout_lines

- name: Get docker_logs
command: docker logs "test{{ item.name }}_{{ item.name }}_1"
with_items: "{{ distros }}"
register: docker_logs

- name: Show docker_logs
debug: var=docker_logs.results

- name: Wait until built containers are running
docker_container:
name: "test{{ item.name }}_{{ item.name }}_1"
command: "docker inspect test{{ item.name }}_{{ item.name }}_1 --format '{% raw %}{{ .State.Status }}{% endraw %}'"
with_items: "{{ distros }}"
register: container_run_status
until: container_run_status.ansible_facts.docker_container.State.Status == 'running'
until: container_run_status.stdout == 'running'
tags:
- restart
- run

- name: Get container start times
command: "docker inspect test{{ item.name }}_{{ item.name }}_1 --format '{% raw %}{{ .State.StartedAt }}{% endraw %}'"
with_items: "{{ distros }}"
register: container_run_startedat
tags:
- restart
- run
Expand All @@ -51,22 +77,28 @@

- include: includes/show-output.yml output_file=./task.output registered_output="{{ output }}"

- name: Get new container start times
docker_container:
name: "test{{ item.name }}_{{ item.name }}_1"
- name: Wait until restarted containers are running
command: "docker inspect test{{ item.name }}_{{ item.name }}_1 --format '{% raw %}{{ .State.Status }}{% endraw %}'"
with_items: "{{ distros }}"
register: container_restart_status
until: container_restart_status.ansible_facts.docker_container.State.Status == 'running'
until: container_restart_status.stdout == 'running'
tags:
- restart

- name: Get container restart times
command: "docker inspect test{{ item.name }}_{{ item.name }}_1 --format '{% raw %}{{ .State.StartedAt }}{% endraw %}'"
with_items: "{{ distros }}"
register: container_restart_startedat
tags:
- restart

- name: Ensure containers were restarted
assert:
that:
- item.0.ansible_facts.docker_container.State.StartedAt != item.1.ansible_facts.docker_container.State.StartedAt
- item.0.stdout != item.1.stdout
with_together:
- "{{ container_run_status.results }}"
- "{{ container_restart_status.results }}"
- "{{ container_run_startedat.results }}"
- "{{ container_restart_startedat.results }}"
tags:
- restart

Expand All @@ -89,13 +121,18 @@

- include: includes/show-output.yml output_file=./task.output registered_output="{{ output }}"

- name: Ensure containers were stopped
docker_container:
name: 'test{{ item.name }}_{{ item.name }}_1'
state: 'stopped'
- name: Get container status
command: "docker inspect test{{ item.name }}_{{ item.name }}_1 --format '{% raw %}{{ .State.Status }}{% endraw %}'"
with_items: "{{ distros }}"
register: output
failed_when: output.changed
register: container_status
tags:
- stop

- name: Ensure containers stop
assert:
that:
- item.0.stdout == 'exited'
with_together:
- "{{ container_status.results }}"
tags:
- stop

0 comments on commit fd5d8de

Please sign in to comment.