diff --git a/playbooks/roles/gitea/tasks/main.yaml b/playbooks/roles/gitea/tasks/main.yaml index 8b46c6de46..3235d5b37d 100644 --- a/playbooks/roles/gitea/tasks/main.yaml +++ b/playbooks/roles/gitea/tasks/main.yaml @@ -34,8 +34,12 @@ - name: Install distro packages package: name: + # TODO(clarkb) does the install-docker role handle these two packages? - docker-compose - python3-requests + # Installed to make checking memcached stats easy in testing and for + # human led debugging. + - netcat-openbsd state: present - name: Install reverse proxy @@ -63,9 +67,9 @@ shell: cmd: docker-compose stop --timeout 60 chdir: /etc/gitea-docker/ - - name: Run docker-compose up mariadb gitea-web + - name: Run docker-compose up mariadb memcached gitea-web shell: - cmd: docker-compose up -d --timeout 60 mariadb gitea-web + cmd: docker-compose up -d --timeout 60 mariadb memcached gitea-web chdir: /etc/gitea-docker/ # We wait here for the main gitea service to start before starting diff --git a/playbooks/roles/gitea/templates/app.ini.j2 b/playbooks/roles/gitea/templates/app.ini.j2 index 013c3dfbc2..cb35ee6fee 100644 --- a/playbooks/roles/gitea/templates/app.ini.j2 +++ b/playbooks/roles/gitea/templates/app.ini.j2 @@ -30,6 +30,10 @@ PASSWD = {{ gitea_db_password }} SSL_MODE = disable LOG_SQL = false +[cache] +ADAPTER = memcache +HOST = 127.0.0.1:11211 + [repository] ROOT = /data/git/repositories DISABLED_REPO_UNITS = repo.issues,repo.pulls,repo.wiki,repo.projects,repo.actions diff --git a/playbooks/roles/gitea/templates/docker-compose.yaml.j2 b/playbooks/roles/gitea/templates/docker-compose.yaml.j2 index 5f0ca67c24..60185e5515 100644 --- a/playbooks/roles/gitea/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/gitea/templates/docker-compose.yaml.j2 @@ -20,9 +20,22 @@ services: driver: journald options: tag: "docker-mariadb" + memcached: + image: quay.io/opendevmirror/memcached:latest + network_mode: host + restart: always + command: + - -v + - --listen=127.0.0.1:11211 + - --memory-limit=1024 + logging: + driver: journald + options: + tag: "docker-memcached" gitea-web: depends_on: - mariadb + - memcached image: docker.io/opendevorg/gitea:latest network_mode: host restart: always diff --git a/testinfra/test_gitea.py b/testinfra/test_gitea.py index 42a6a6e7aa..4af24bbc16 100644 --- a/testinfra/test_gitea.py +++ b/testinfra/test_gitea.py @@ -26,6 +26,8 @@ def test_gitea_listening(host): assert gitea_ssh.is_listening gitea_proxy = host.socket("tcp://0.0.0.0:3081") assert gitea_proxy.is_listening + memcached = host.socket("tcp://127.0.0.1:11211") + assert memcached.is_listening def test_ulimit(host): cmd = host.run("/usr/local/bin/docker-compose " @@ -73,6 +75,12 @@ def test_ondisk_logs(host): mariadb_log = host.file('/var/log/containers/docker-mariadb.log') assert mariadb_log.exists + # Commented out for now as memcached logging is either very quiet and + # we don't create the file or very verbose and far too chatty for + # production (basically no logs or every set and get is logged). + #memcached_log = host.file('/var/log/containers/docker-memcached.log') + #assert memcached_log.exists + gitea_log = host.file('/var/log/containers/docker-gitea.log') assert gitea_log.exists @@ -135,11 +143,14 @@ def test_no_500_template_content(host): assert '