summaryrefslogtreecommitdiffstats
path: root/installer/roles/local_docker
diff options
context:
space:
mode:
authorchris meyers <chris.meyers.fsu@gmail.com>2020-04-01 22:09:57 +0200
committerchris meyers <chris.meyers.fsu@gmail.com>2020-04-06 14:35:12 +0200
commit7433aab258fd093d4c2de855ef3196b02e68f6d3 (patch)
treead1b905f2dc0fc87a230d3f46f1c4eb30f04ce36 /installer/roles/local_docker
parentuse memcached unix domain socket rather than tcp (diff)
downloadawx-7433aab258fd093d4c2de855ef3196b02e68f6d3.tar.xz
awx-7433aab258fd093d4c2de855ef3196b02e68f6d3.zip
switch memcached from tcp to unix domain socket
Diffstat (limited to 'installer/roles/local_docker')
-rw-r--r--installer/roles/local_docker/defaults/main.yml2
-rw-r--r--installer/roles/local_docker/tasks/compose.yml6
-rw-r--r--installer/roles/local_docker/templates/credentials.py.j210
-rw-r--r--installer/roles/local_docker/templates/docker-compose.yml.j26
-rw-r--r--installer/roles/local_docker/templates/environment.sh.j22
5 files changed, 12 insertions, 14 deletions
diff --git a/installer/roles/local_docker/defaults/main.yml b/installer/roles/local_docker/defaults/main.yml
index 056b9ecb96..96f7751bf1 100644
--- a/installer/roles/local_docker/defaults/main.yml
+++ b/installer/roles/local_docker/defaults/main.yml
@@ -8,7 +8,5 @@ postgresql_image: "postgres:{{postgresql_version}}"
memcached_image: "memcached"
memcached_version: "alpine"
-memcached_hostname: "memcached"
-memcached_port: "11211"
compose_start_containers: true
diff --git a/installer/roles/local_docker/tasks/compose.yml b/installer/roles/local_docker/tasks/compose.yml
index 120b81cc1a..3212732283 100644
--- a/installer/roles/local_docker/tasks/compose.yml
+++ b/installer/roles/local_docker/tasks/compose.yml
@@ -10,6 +10,12 @@
state: directory
mode: 0777
+- name: Create Memcached socket directory
+ file:
+ path: "{{ docker_compose_dir }}/memcached_socket"
+ state: directory
+ mode: 0777
+
- name: Create Docker Compose Configuration
template:
src: "{{ item }}.j2"
diff --git a/installer/roles/local_docker/templates/credentials.py.j2 b/installer/roles/local_docker/templates/credentials.py.j2
index 308ce1ff5e..9ea7ac2775 100644
--- a/installer/roles/local_docker/templates/credentials.py.j2
+++ b/installer/roles/local_docker/templates/credentials.py.j2
@@ -10,14 +10,4 @@ DATABASES = {
}
}
-CACHES = {
- 'default': {
- 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'LOCATION': '{}:{}'.format("{{ memcached_hostname }}", "{{ memcached_port }}")
- },
- 'ephemeral': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- },
-}
-
BROADCAST_WEBSOCKET_SECRET = "{{ broadcast_websocket_secret | b64encode }}"
diff --git a/installer/roles/local_docker/templates/docker-compose.yml.j2 b/installer/roles/local_docker/templates/docker-compose.yml.j2
index 5b5f22277a..e9a26f4416 100644
--- a/installer/roles/local_docker/templates/docker-compose.yml.j2
+++ b/installer/roles/local_docker/templates/docker-compose.yml.j2
@@ -25,6 +25,7 @@ services:
- "{{ docker_compose_dir }}/credentials.py:/etc/tower/conf.d/credentials.py"
- "{{ docker_compose_dir }}/nginx.conf:/etc/nginx/nginx.conf:ro"
- "{{ docker_compose_dir }}/redis_socket:/var/run/redis/:rw"
+ - "{{ docker_compose_dir }}/memcached_socket:/var/run/memcached/:rw"
{% if project_data_dir is defined %}
- "{{ project_data_dir +':/var/lib/awx/projects:rw' }}"
{% endif %}
@@ -78,6 +79,7 @@ services:
- "{{ docker_compose_dir }}/environment.sh:/etc/tower/conf.d/environment.sh"
- "{{ docker_compose_dir }}/credentials.py:/etc/tower/conf.d/credentials.py"
- "{{ docker_compose_dir }}/redis_socket:/var/run/redis/:rw"
+ - "{{ docker_compose_dir }}/memcached_socket:/var/run/memcached/:rw"
{% if project_data_dir is defined %}
- "{{ project_data_dir +':/var/lib/awx/projects:rw' }}"
{% endif %}
@@ -125,15 +127,19 @@ services:
volumes:
- "{{ docker_compose_dir }}/redis.conf:/usr/local/etc/redis/redis.conf:ro"
- "{{ docker_compose_dir }}/redis_socket:/var/run/redis/:rw"
+ - "{{ docker_compose_dir }}/memcached_socket:/var/run/memcached/:rw"
memcached:
image: "{{ memcached_image }}:{{ memcached_version }}"
container_name: awx_memcached
+ command: ["-s", "/var/run/memcached/memcached.sock", "-a", "0666"]
restart: unless-stopped
environment:
http_proxy: {{ http_proxy | default('') }}
https_proxy: {{ https_proxy | default('') }}
no_proxy: {{ no_proxy | default('') }}
+ volumes:
+ - "{{ docker_compose_dir }}/memcached_socket:/var/run/memcached/:rw"
{% if pg_hostname is not defined %}
postgres:
diff --git a/installer/roles/local_docker/templates/environment.sh.j2 b/installer/roles/local_docker/templates/environment.sh.j2
index 5053f1afbe..fc0763178d 100644
--- a/installer/roles/local_docker/templates/environment.sh.j2
+++ b/installer/roles/local_docker/templates/environment.sh.j2
@@ -6,7 +6,5 @@ DATABASE_PASSWORD={{ pg_password|default('awxpass')|quote }}
{% if pg_admin_password is defined %}
DATABASE_ADMIN_PASSWORD={{ pg_admin_password|quote }}
{% endif %}
-MEMCACHED_HOST={{ memcached_hostname|default('memcached') }}
-MEMCACHED_PORT={{ memcached_port|default('11211')|quote }}
AWX_ADMIN_USER={{ admin_user|quote }}
AWX_ADMIN_PASSWORD={{ admin_password|quote }}