From 7657b69387c8c8d0eb0ceb8348e6792c5cb5e5a1 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 13 Apr 2020 08:07:09 -0500 Subject: [PATCH] Build and use our own etherpad image We need to install the ep_headings plugin. We've got a hack in place to do it in prod, but it seems like every time we npm install the plugin in ansible, we need to restart the etherpad container for $reasons. It's cleaner to just build an image based on upstream with ep_headings installed. Change-Id: Id3b31bbabbbc5f6dcfe56486e48916384292f693 --- .zuul.yaml | 58 +++++++++++++++++-- docker/etherpad/Dockerfile | 20 +++++++ playbooks/roles/etherpad/tasks/main.yaml | 21 +++---- .../etherpad/templates/docker-compose.yaml.j2 | 3 +- 4 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 docker/etherpad/Dockerfile diff --git a/.zuul.yaml b/.zuul.yaml index 78cf21cf95..b02668feb2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -145,6 +145,34 @@ vars: *gitea_vars files: *gitea_files +# Etherpad jobs +- job: + name: system-config-build-image-etherpad + description: Build a etherpad image. + provides: etherpad-container-image + parent: system-config-build-image + vars: ðerpad_vars + docker_images: + - context: docker/etherpad + repository: opendevorg/etherpad + files: ðerpad_files + - docker/etherpad/.* + +- job: + name: system-config-upload-image-etherpad + description: Build and upload a etherpad image. + provides: etherpad-container-image + parent: system-config-upload-image + vars: *etherpad_vars + files: *etherpad_files + +- job: + name: system-config-promote-image-etherpad + description: Promote a previously published etherpad image to latest. + parent: system-config-promote-image + vars: *etherpad_vars + files: *etherpad_files + # Jitsi-meet jobs - job: name: system-config-build-image-jitsi-meet @@ -1215,10 +1243,11 @@ - job: name: system-config-run-etherpad - parent: system-config-run + parent: system-config-run-containers description: | Run the playbook for the etherpad servers. timeout: 3600 + requires: etherpad-container-image nodeset: nodes: - name: bridge.openstack.org @@ -2078,7 +2107,11 @@ - system-config-run-mirror-update - system-config-run-static - system-config-run-docker-registry - - system-config-run-etherpad + - system-config-run-etherpad: + dependencies: + - name: opendev-buildset-registry + - name: system-config-build-image-etherpad + soft: true - system-config-run-gitea: dependencies: - name: opendev-buildset-registry @@ -2103,6 +2136,7 @@ - name: opendev-buildset-registry - name: system-config-build-image-jinja-init soft: true + - system-config-build-image-etherpad - system-config-build-image-gitea - system-config-build-image-jitsi-meet - system-config-build-image-haproxy-statsd: @@ -2136,7 +2170,11 @@ - system-config-run-mirror-update - system-config-run-static - system-config-run-docker-registry - - system-config-run-etherpad + - system-config-run-etherpad: + dependencies: + - name: opendev-buildset-registry + - name: system-config-upload-image-etherpad + soft: true - system-config-run-gitea: dependencies: - name: opendev-buildset-registry @@ -2161,6 +2199,7 @@ - name: opendev-buildset-registry - name: system-config-upload-image-jinja-init soft: true + - system-config-upload-image-etherpad - system-config-upload-image-gitea - system-config-upload-image-jitsi-meet - system-config-upload-image-haproxy-statsd: @@ -2177,6 +2216,7 @@ - system-config-promote-image-jinja-init - system-config-promote-image-gitea-init - system-config-promote-image-gitea + - system-config-promote-image-etherpad - system-config-promote-image-jitsi-meet - system-config-promote-image-haproxy-statsd - system-config-promote-image-python-base-3.7 @@ -2208,7 +2248,17 @@ - infra-prod-service-gitea-lb - infra-prod-service-nameserver - infra-prod-service-nodepool - - infra-prod-service-etherpad + - infra-prod-service-etherpad: + dependencies: + - name: infra-prod-update-system-config + - name: infra-prod-install-ansible + soft: true + - name: infra-prod-base + soft: true + - name: infra-prod-service-letsencrypt + soft: true + - name: system-config-promote-image-etherpad + soft: true - infra-prod-service-meetpad - infra-prod-service-mirror-update - infra-prod-service-mirror diff --git a/docker/etherpad/Dockerfile b/docker/etherpad/Dockerfile new file mode 100644 index 0000000000..f0dd71d5a8 --- /dev/null +++ b/docker/etherpad/Dockerfile @@ -0,0 +1,20 @@ +# Copyright (c) 2020 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM docker.io/etherpad/etherpad:1.8.0 + +LABEL maintainer="infra-root@openstack.org" + +RUN cd /opt/etherpad-lite && npm install ep_headings diff --git a/playbooks/roles/etherpad/tasks/main.yaml b/playbooks/roles/etherpad/tasks/main.yaml index 84e1975d80..717c3fd203 100644 --- a/playbooks/roles/etherpad/tasks/main.yaml +++ b/playbooks/roles/etherpad/tasks/main.yaml @@ -80,21 +80,18 @@ package: name: - docker-compose - - npm state: present -- name: Install ep_headings plugin - shell: - cmd: npm install ep_headings - chdir: /etc/etherpad - -- name: Touch ep_initialize file +- name: Clean up from old ep_headings hack file: - path: /etc/etherpad/node_modules/ep_headings/.ep_initialized - # 5001 is the etherpad user in the container - owner: 5001 - group: 5001 - state: touch + path: /etc/etherpad/node_modules + state: absent + +- name: Remove npm + package: + name: + - npm + state: absent - name: Run docker-compose pull shell: diff --git a/playbooks/roles/etherpad/templates/docker-compose.yaml.j2 b/playbooks/roles/etherpad/templates/docker-compose.yaml.j2 index c1609e45a5..5e492dd998 100644 --- a/playbooks/roles/etherpad/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/etherpad/templates/docker-compose.yaml.j2 @@ -17,10 +17,9 @@ services: - /etc/etherpad/mysql:/etc/mysql/conf.d etherpad: restart: always - image: docker.io/etherpad/etherpad:1.8.0 + image: docker.io/opendevorg/etherpad network_mode: host environment: NODE_ENV: production volumes: - /etc/etherpad/settings.json:/opt/etherpad-lite/settings.json - - /etc/etherpad/node_modules/ep_headings:/opt/etherpad-lite/node_modules/ep_headings