Merge "Run gitea with memcached cache adapter"
This commit is contained in:
commit
343dacc4bc
@ -34,8 +34,12 @@
|
|||||||
- name: Install distro packages
|
- name: Install distro packages
|
||||||
package:
|
package:
|
||||||
name:
|
name:
|
||||||
|
# TODO(clarkb) does the install-docker role handle these two packages?
|
||||||
- docker-compose
|
- docker-compose
|
||||||
- python3-requests
|
- python3-requests
|
||||||
|
# Installed to make checking memcached stats easy in testing and for
|
||||||
|
# human led debugging.
|
||||||
|
- netcat-openbsd
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install reverse proxy
|
- name: Install reverse proxy
|
||||||
@ -63,9 +67,9 @@
|
|||||||
shell:
|
shell:
|
||||||
cmd: docker-compose stop --timeout 60
|
cmd: docker-compose stop --timeout 60
|
||||||
chdir: /etc/gitea-docker/
|
chdir: /etc/gitea-docker/
|
||||||
- name: Run docker-compose up mariadb gitea-web
|
- name: Run docker-compose up mariadb memcached gitea-web
|
||||||
shell:
|
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/
|
chdir: /etc/gitea-docker/
|
||||||
|
|
||||||
# We wait here for the main gitea service to start before starting
|
# We wait here for the main gitea service to start before starting
|
||||||
|
@ -30,6 +30,10 @@ PASSWD = {{ gitea_db_password }}
|
|||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
LOG_SQL = false
|
LOG_SQL = false
|
||||||
|
|
||||||
|
[cache]
|
||||||
|
ADAPTER = memcache
|
||||||
|
HOST = 127.0.0.1:11211
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
ROOT = /data/git/repositories
|
ROOT = /data/git/repositories
|
||||||
DISABLED_REPO_UNITS = repo.issues,repo.pulls,repo.wiki,repo.projects,repo.actions
|
DISABLED_REPO_UNITS = repo.issues,repo.pulls,repo.wiki,repo.projects,repo.actions
|
||||||
|
@ -20,9 +20,22 @@ services:
|
|||||||
driver: journald
|
driver: journald
|
||||||
options:
|
options:
|
||||||
tag: "docker-mariadb"
|
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:
|
gitea-web:
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
|
- memcached
|
||||||
image: docker.io/opendevorg/gitea:latest
|
image: docker.io/opendevorg/gitea:latest
|
||||||
network_mode: host
|
network_mode: host
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -26,6 +26,8 @@ def test_gitea_listening(host):
|
|||||||
assert gitea_ssh.is_listening
|
assert gitea_ssh.is_listening
|
||||||
gitea_proxy = host.socket("tcp://0.0.0.0:3081")
|
gitea_proxy = host.socket("tcp://0.0.0.0:3081")
|
||||||
assert gitea_proxy.is_listening
|
assert gitea_proxy.is_listening
|
||||||
|
memcached = host.socket("tcp://127.0.0.1:11211")
|
||||||
|
assert memcached.is_listening
|
||||||
|
|
||||||
def test_ulimit(host):
|
def test_ulimit(host):
|
||||||
cmd = host.run("/usr/local/bin/docker-compose "
|
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')
|
mariadb_log = host.file('/var/log/containers/docker-mariadb.log')
|
||||||
assert mariadb_log.exists
|
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')
|
gitea_log = host.file('/var/log/containers/docker-gitea.log')
|
||||||
assert gitea_log.exists
|
assert gitea_log.exists
|
||||||
|
|
||||||
@ -135,11 +143,14 @@ def test_no_500_template_content(host):
|
|||||||
assert '<title>Internal Server Error' not in cmd.stdout
|
assert '<title>Internal Server Error' not in cmd.stdout
|
||||||
|
|
||||||
def test_gitea_screenshots(host):
|
def test_gitea_screenshots(host):
|
||||||
|
|
||||||
shots = (
|
shots = (
|
||||||
('https://localhost:3081', None, 'gitea-main.png'),
|
('https://localhost:3081', None, 'gitea-main.png'),
|
||||||
('https://localhost:3081/opendev/system-config', None,
|
('https://localhost:3081/opendev/system-config', None,
|
||||||
'gitea-project-system-config.png'),
|
'gitea-project-system-config.png'),
|
||||||
|
# Fetch system-config twice to ensure we exercise the caching
|
||||||
|
# system.
|
||||||
|
('https://localhost:3081/opendev/system-config', None,
|
||||||
|
'gitea-project-system-config2.png'),
|
||||||
('https://localhost:3081/opendev/disk-image-builder', None,
|
('https://localhost:3081/opendev/disk-image-builder', None,
|
||||||
'gitea-project-dib.png'),
|
'gitea-project-dib.png'),
|
||||||
('https://localhost:3081/opendev/', None,
|
('https://localhost:3081/opendev/', None,
|
||||||
@ -150,3 +161,11 @@ def test_gitea_screenshots(host):
|
|||||||
|
|
||||||
take_screenshots(host, shots)
|
take_screenshots(host, shots)
|
||||||
|
|
||||||
|
def test_memcached_has_data(host):
|
||||||
|
# We only listen on localhost on the gitea server otherwise we could
|
||||||
|
# open a socket directly from this test case and request the stats data.
|
||||||
|
cmd = host.run("echo 'stats' | nc -N 127.0.0.1 11211")
|
||||||
|
assert cmd.succeeded
|
||||||
|
# Having more than 0 bytes in memcached implies gitea is using
|
||||||
|
# the server as a cache.
|
||||||
|
assert 'STAT bytes 0' not in cmd.stdout
|
||||||
|
@ -651,7 +651,7 @@
|
|||||||
parent: system-config-run-containers
|
parent: system-config-run-containers
|
||||||
description: |
|
description: |
|
||||||
Run the playbook for the gitea servers.
|
Run the playbook for the gitea servers.
|
||||||
timeout: 4800
|
timeout: 5400
|
||||||
nodeset:
|
nodeset:
|
||||||
nodes:
|
nodes:
|
||||||
- <<: *bridge_node_x86
|
- <<: *bridge_node_x86
|
||||||
|
Loading…
x
Reference in New Issue
Block a user