Browse Source

Install docker-compose from pypi

We want to use stop_grace_period to manage gerrit service stops. This
feature was added in docker-compose 1.10 but the distro provides 1.5.
Work around this by installing docker-compose from pypi.

This seems like a useful feature and we want to manage docker-compose
the same way globally so move docker-compose installation into the
install-docker role.

New docker-compose has slightly different output that we must check for
in the gitea start/stop machinery. We also need to check for different
container name formatting in our test cases. We should pause here and
consider if this has any upgrade implications for our existing services.

Change-Id: Ia8249a2b84a2ef167ee4ffd66d7a7e7cff8e21fb
changes/89/719589/8
Clark Boylan 2 years ago committed by James E. Blair
parent
commit
8eb981b47f
  1. 6
      playbooks/roles/etherpad/tasks/main.yaml
  2. 6
      playbooks/roles/gerrit/tasks/main.yaml
  3. 6
      playbooks/roles/gitea/tasks/main.yaml
  4. 5
      playbooks/roles/haproxy/tasks/main.yaml
  5. 14
      playbooks/roles/install-docker/tasks/main.yaml
  6. 5
      playbooks/roles/jitsi-meet/tasks/main.yaml
  7. 6
      playbooks/roles/nodepool-builder/tasks/main.yaml
  8. 5
      playbooks/roles/registry/tasks/main.yaml
  9. 5
      playbooks/roles/zuul-preview/tasks/main.yaml
  10. 4
      testinfra/test_gitea.py
  11. 2
      testinfra/test_gitea_lb.py
  12. 2
      testinfra/test_nodepool.py

6
playbooks/roles/etherpad/tasks/main.yaml

@ -76,12 +76,6 @@
src: settings.json.j2
dest: /etc/etherpad/settings.json
- name: Install docker-compose and npm
package:
name:
- docker-compose
state: present
- name: Clean up from old ep_headings hack
file:
path: /etc/etherpad/node_modules

6
playbooks/roles/gerrit/tasks/main.yaml

@ -282,12 +282,6 @@
when: gerrit_redirect_vhost is defined
notify: gerrit Reload apache2
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Start gerrit
include_tasks: start.yaml

6
playbooks/roles/gitea/tasks/main.yaml

@ -37,7 +37,7 @@
register: docker_compose_pull
- name: Stop/Start gitea safely for Gerrit replication
when: "'Downloaded newer image' in docker_compose_pull.stdout"
when: "'downloaded newer image' in docker_compose_pull.stderr"
block:
- name: Run docker-compose stop
shell:
@ -83,7 +83,7 @@
when: root_user_check.status==404
block:
- name: Create root user
command: "docker exec -t giteadocker_gitea-web_1 gitea admin create-user --name root --password {{ gitea_root_password }} --email {{ gitea_root_email }} --admin"
command: "docker exec -t gitea-docker_gitea-web_1 gitea admin create-user --name root --password {{ gitea_root_password }} --email {{ gitea_root_email }} --admin"
no_log: "{{ gitea_no_log }}"
- name: Check if gerrit user exists
uri:
@ -153,7 +153,7 @@
cron:
name: pack-git-refs
state: present
job: "docker exec -t giteadocker_gitea-web_1 find /data/git/repositories/ -maxdepth 2 -name *.git -type d -execdir git --git-dir={} gc --quiet \\;"
job: "docker exec -t gitea-docker_gitea-web_1 find /data/git/repositories/ -maxdepth 2 -name *.git -type d -execdir git --git-dir={} gc --quiet \\;"
minute: '{{ 59 | random(seed=inventory_hostname) }}'
hour: '{{ 23 | random(seed=inventory_hostname) }}'
weekday: 0

5
playbooks/roles/haproxy/tasks/main.yaml

@ -20,11 +20,6 @@
src: haproxy.cfg.j2
dest: /var/haproxy/etc/haproxy.cfg
notify: Reload haproxy
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull

14
playbooks/roles/install-docker/tasks/main.yaml

@ -14,3 +14,17 @@
- name: reset ssh connection to pick up docker group
meta: reset_connection
# We install docker-compose from pypi to get features like
# stop_grace_period.
- name: Remove distro docker-compose
package:
name:
- docker-compose
state: absent
- name: Install docker-compose
pip:
name: docker-compose
state: present
executable: pip3

5
playbooks/roles/jitsi-meet/tasks/main.yaml

@ -12,11 +12,6 @@
copy:
src: config.js
dest: /var/jitsi-meet/web/config.js
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull

6
playbooks/roles/nodepool-builder/tasks/main.yaml

@ -26,12 +26,6 @@
dest: /etc/nodepool-builder-compose/docker-compose.yaml
mode: 0644
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull

5
playbooks/roles/registry/tasks/main.yaml

@ -18,11 +18,6 @@
template:
src: registry.yaml.j2
dest: /var/registry/conf/registry.yaml
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull

5
playbooks/roles/zuul-preview/tasks/main.yaml

@ -2,11 +2,6 @@
synchronize:
src: zuul-preview-docker/
dest: /etc/zuul-preview-docker/
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull

4
testinfra/test_gitea.py

@ -25,11 +25,11 @@ def test_gitea_listening(host):
assert gitea_ssh.is_listening
def test_ulimit(host):
cmd = host.run("docker exec giteadocker_gitea-web_1 prlimit")
cmd = host.run("docker exec gitea-docker_gitea-web_1 prlimit")
expected = ("STACK max stack size "
"16777216 9223372036854775807 bytes")
assert expected in cmd.stdout.split('\n')
def test_sshd_logs(host):
cmd = host.run("docker logs giteadocker_gitea-ssh_1")
cmd = host.run("docker logs gitea-docker_gitea-ssh_1")
assert cmd.stdout != '' or cmd.stderr != ''

2
testinfra/test_gitea_lb.py

@ -25,7 +25,7 @@ def test_gitea_listening(host):
assert gitea_http.is_listening
def test_haproxy_statsd_running(host):
cmd = host.run("docker inspect haproxydocker_haproxy-statsd_1")
cmd = host.run("docker inspect haproxy-docker_haproxy-statsd_1")
out = json.loads(cmd.stdout)
assert out[0]["State"]["Status"] == "running"
assert out[0]["RestartCount"] == 0

2
testinfra/test_nodepool.py

@ -42,7 +42,7 @@ def test_builder_container_running(host):
pytest.skip()
cmd = host.run("docker ps -a --format '{{ .Names }}'")
assert 'nodepoolbuildercompose_nodepool-builder_1' in cmd.stdout
assert 'nodepool-builder-compose_nodepool-builder_1' in cmd.stdout
def test_builder_webserver_running(host):
if host.backend.get_hostname() != 'nb01-test.opendev.org':

Loading…
Cancel
Save