mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2025-01-18 08:06:16 +01:00
roles/memcached: Initial work on the memcached role.
roles/archweb: Make archweb install and use it's own memcached service, running as the archweb user and using a socket.
This commit is contained in:
parent
514813871a
commit
36212039d5
17
roles/archweb/files/archweb-memcached.service
Normal file
17
roles/archweb/files/archweb-memcached.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Archweb Memcached Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=archweb
|
||||
Group=memcached
|
||||
# Remove '-l 127.0.0.1' to listen on all addresses
|
||||
ExecStart=/usr/bin/memcached -s /run/memcached/archweb.sock -o modern
|
||||
Restart=always
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectSystem=full
|
||||
MemoryDenyWriteExecute=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: install git
|
||||
pacman: name=git,memcached,python2,python2-virtualenv,uwsgi-plugin-python2 state=present
|
||||
pacman: name=git,python2,python2-virtualenv,uwsgi-plugin-python2 state=present
|
||||
|
||||
- name: make archweb user
|
||||
user: name=archweb shell=/bin/false home="{{ archweb_dir }}" createhome=no groups=uwsgi
|
||||
@ -48,11 +48,22 @@
|
||||
- daemon reload
|
||||
when: services
|
||||
|
||||
- name: copy archweb memcached service
|
||||
copy: src="archweb-memcached.service" dest="/etc/systemd/system/archweb-memcached.service" owner=root group=root mode=0644
|
||||
notify:
|
||||
- daemon reload
|
||||
when: not services
|
||||
|
||||
- name: configure archweb
|
||||
template: src=local_settings.py.j2 dest=/srv/http/archweb/local_settings.py owner=archweb group=archweb mode=0660
|
||||
|
||||
- name: deploy archweb
|
||||
template: src=archweb.ini.j2 dest=/etc/uwsgi/vassals/archweb.ini owner=archweb group=http mode=0644
|
||||
when: not services
|
||||
|
||||
- name: start and enable archweb memcached service
|
||||
service: name="archweb-memcached.service" enabled=yes state=started
|
||||
when: not services
|
||||
|
||||
- name: start and enable archweb services
|
||||
service: name="{{ item }}" enabled=yes state=started
|
||||
|
@ -26,7 +26,7 @@ DATABASES = {
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
'LOCATION': 'unix:/run/memcached/archweb.sock',
|
||||
}
|
||||
}
|
||||
|
||||
|
12
roles/memcached/tasks/main.yml
Normal file
12
roles/memcached/tasks/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
- name: install memcached
|
||||
pacman: name=memcached state=present
|
||||
|
||||
- name: put memcached.conf into tmpfiles
|
||||
template: src=memcached-tmpfiles.d.j2 dest=/etc/tmpfiles.d/memcached.conf owner=root group=root mode=0644
|
||||
register: memcachedtmpfiles
|
||||
|
||||
- name: use tmpfiles.d/memcached.conf
|
||||
command: systemd-tmpfiles --create
|
||||
when: memcachedtmpfiles.changed
|
1
roles/memcached/templates/memcached-tmpfiles.d.j2
Normal file
1
roles/memcached/templates/memcached-tmpfiles.d.j2
Normal file
@ -0,0 +1 @@
|
||||
d /run/memcached 0775 memcached memcached - -
|
Loading…
Reference in New Issue
Block a user