[constellation] Deploy frontend
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>certbot_on_virtu
							parent
							
								
									4998e9d1aa
								
							
						
					
					
						commit
						42ee4dbb5e
					
				| 
						 | 
				
			
			@ -29,3 +29,33 @@ glob_constellation:
 | 
			
		|||
  version: master
 | 
			
		||||
  settings_local_owner: www-data
 | 
			
		||||
  settings_local_group: nounou
 | 
			
		||||
 | 
			
		||||
loc_nginx:
 | 
			
		||||
  service_name: constellation
 | 
			
		||||
  ssl: []
 | 
			
		||||
  servers:
 | 
			
		||||
    - ssl: false
 | 
			
		||||
      default: true
 | 
			
		||||
      server_name:
 | 
			
		||||
        - "constellation.crans.org"
 | 
			
		||||
        - "intranet.crans.org"
 | 
			
		||||
      locations:
 | 
			
		||||
        - filter: "/static"
 | 
			
		||||
          params:
 | 
			
		||||
            - "alias /var/local/constellation/static/"
 | 
			
		||||
 | 
			
		||||
        - filter: "/javascript"
 | 
			
		||||
          params:
 | 
			
		||||
            - "alias /usr/share/javascript/"
 | 
			
		||||
 | 
			
		||||
        - filter: "/media"
 | 
			
		||||
          params:
 | 
			
		||||
            - "alias /var/local/constellation/media/"
 | 
			
		||||
 | 
			
		||||
        - filter: "/"
 | 
			
		||||
          params:
 | 
			
		||||
            - "uwsgi_pass constellation"
 | 
			
		||||
            - "include /etc/nginx/uwsgi_params"
 | 
			
		||||
  upstreams:
 | 
			
		||||
    - name: 'constellation'
 | 
			
		||||
      server: 'unix:///var/run/uwsgi/app/constellation/constellation.sock'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,5 +3,8 @@
 | 
			
		|||
- hosts: constellation
 | 
			
		||||
  vars:
 | 
			
		||||
    constellation: "{{ glob_constellation | combine(loc_constellation | default({})) }}"
 | 
			
		||||
    nginx: "{{ glob_nginx | combine(loc_nginx | default({})) }}"
 | 
			
		||||
  roles:
 | 
			
		||||
    - constellation
 | 
			
		||||
    - nginx
 | 
			
		||||
    - constellation-front
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
---
 | 
			
		||||
- name: Reload NGINX
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: nginx
 | 
			
		||||
    state: reloaded
 | 
			
		||||
 | 
			
		||||
- name: Reload uWSGI
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: uwsgi
 | 
			
		||||
    state: reloaded
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
---
 | 
			
		||||
- name: Install uWSGI
 | 
			
		||||
  apt:
 | 
			
		||||
    install_recommends: false
 | 
			
		||||
    update_cache: true
 | 
			
		||||
    name:
 | 
			
		||||
      - uwsgi
 | 
			
		||||
      - uwsgi-plugin-python3
 | 
			
		||||
  register: apt_result
 | 
			
		||||
  retries: 3
 | 
			
		||||
  until: apt_result is succeeded
 | 
			
		||||
 | 
			
		||||
- name: Copy constellation uWSGI app
 | 
			
		||||
  template:
 | 
			
		||||
    src: "uwsgi/apps-available/constellation.ini.j2"
 | 
			
		||||
    dest: "/etc/uwsgi/apps-available/constellation.ini"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
  notify: Reload uWSGI
 | 
			
		||||
 | 
			
		||||
- name: Activate constellation uWSGI app
 | 
			
		||||
  file:
 | 
			
		||||
    src: "../apps-available/constellation.ini"
 | 
			
		||||
    dest: "/etc/uwsgi/apps-enabled/constellation.ini"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    state: link
 | 
			
		||||
  ignore_errors: "{{ ansible_check_mode }}"
 | 
			
		||||
  notify: Reload uWSGI
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
{{ ansible_header | comment }}
 | 
			
		||||
 | 
			
		||||
[uwsgi]
 | 
			
		||||
uid             = www-data
 | 
			
		||||
gid             = www-data
 | 
			
		||||
# Django-related settings
 | 
			
		||||
# the base directory (full path)
 | 
			
		||||
chdir           = /var/local/constellation
 | 
			
		||||
wsgi-file       = /var/local/constellation/constellation/wsgi.py
 | 
			
		||||
plugin          = python3
 | 
			
		||||
# process-related settings
 | 
			
		||||
# master
 | 
			
		||||
master          = true
 | 
			
		||||
# maximum number of worker processes
 | 
			
		||||
processes       = 10
 | 
			
		||||
# the socket (use the full path to be safe
 | 
			
		||||
socket          = /var/run/uwsgi/app/constellation/constellation.sock
 | 
			
		||||
# ... with appropriate permissions - may be needed
 | 
			
		||||
chmod-socket    = 664
 | 
			
		||||
# clear environment on exit
 | 
			
		||||
vacuum          = true
 | 
			
		||||
# Touch reload
 | 
			
		||||
touch-reload = /var/local/constellation/constellation/settings.py
 | 
			
		||||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
    update_cache: true
 | 
			
		||||
    install_recommends: false
 | 
			
		||||
    name:
 | 
			
		||||
      - gettext
 | 
			
		||||
      - python3-django
 | 
			
		||||
      - python3-django-crispy-forms
 | 
			
		||||
      - python3-django-extensions
 | 
			
		||||
| 
						 | 
				
			
			@ -68,3 +69,8 @@
 | 
			
		|||
    mode: 0660
 | 
			
		||||
    owner: "{{ constellation.settings_local_owner }}"
 | 
			
		||||
    group: "{{ constellation.settings_local_group }}"
 | 
			
		||||
 | 
			
		||||
- name: Compile messages
 | 
			
		||||
  django_manage:
 | 
			
		||||
    command: compilemessages
 | 
			
		||||
    project_path: "/var/local/constellation"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue