mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
add systemd service and add task to compile translations
This commit is contained in:
parent
4681099cba
commit
83e6627861
4 changed files with 55 additions and 13 deletions
|
@ -14,7 +14,7 @@ lokole_enabled: True
|
||||||
lokole_url: /lokole
|
lokole_url: /lokole
|
||||||
lokole_full_url: "http://{{ iiab_hostname }}.{{ iiab_domain }}/{{ lokole_url }}"
|
lokole_full_url: "http://{{ iiab_hostname }}.{{ iiab_domain }}/{{ lokole_url }}"
|
||||||
|
|
||||||
lokole_domain_socket: "{{ lokole_install_path }}/lokole_gunicorn.sock"
|
lokole_domain_socket: "{{ lokole_run_directory }}/lokole_gunicorn.sock"
|
||||||
|
|
||||||
# Global variables provided by setup-lokole.sh L157-166
|
# Global variables provided by setup-lokole.sh L157-166
|
||||||
# https://github.com/ascoderu/opwen-webapp/blob/master/setup/setup-lokole.sh#L157
|
# https://github.com/ascoderu/opwen-webapp/blob/master/setup/setup-lokole.sh#L157
|
||||||
|
|
|
@ -23,10 +23,21 @@
|
||||||
- install
|
- install
|
||||||
when: internet_available
|
when: internet_available
|
||||||
|
|
||||||
|
- name: Compile translations
|
||||||
|
shell: |
|
||||||
|
python_version=$(python3 -c 'from sys import version_info; print("%s.%s" % (version_info.major, version_info.minor));';)
|
||||||
|
{{ lokole_venv }}/bin/pybabel compile -d {{ item }}/translations
|
||||||
|
with_items:
|
||||||
|
- "{{ lokole_venv }}/lib/python${python_version}/site-packages/opwen_email_client/webapp"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
|
||||||
- name: Create run directory
|
- name: Create run directory
|
||||||
file:
|
file:
|
||||||
path: "{{ lokole_run_directory }}"
|
path: "{{ lokole_run_directory }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
tags:
|
||||||
|
- configure
|
||||||
|
|
||||||
- name: Configure Lokole
|
- name: Configure Lokole
|
||||||
template:
|
template:
|
||||||
|
@ -39,10 +50,31 @@
|
||||||
template:
|
template:
|
||||||
src: webapp.sh.j2
|
src: webapp.sh.j2
|
||||||
dest: "{{ lokole_run_directory }}/webapp.sh"
|
dest: "{{ lokole_run_directory }}/webapp.sh"
|
||||||
|
mode: a+x
|
||||||
tags:
|
tags:
|
||||||
- configure
|
- configure
|
||||||
|
|
||||||
|
- name: Create 'lokole' service
|
||||||
|
template:
|
||||||
|
src: lokole.service.j2
|
||||||
|
dest: "/etc/systemd/system/lokole.service"
|
||||||
|
tags:
|
||||||
|
- systemd
|
||||||
|
|
||||||
|
- name: Enable 'lokole' service
|
||||||
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
name: lokole
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
when: lokole_enabled
|
||||||
|
|
||||||
|
- name: Disable 'lokole' service
|
||||||
|
systemd:
|
||||||
|
name: lokole
|
||||||
|
enabled: no
|
||||||
|
state: stopped
|
||||||
|
when: not lokole_enabled
|
||||||
|
|
||||||
# Everything below this line is unused
|
# Everything below this line is unused
|
||||||
|
|
||||||
|
@ -53,7 +85,7 @@
|
||||||
|
|
||||||
- name: Enable httpd conf file if we are disabled (debuntu)
|
- name: Enable httpd conf file if we are disabled (debuntu)
|
||||||
file:
|
file:
|
||||||
src: /etc/apache2/sites-available/lokole.conf
|
src: /etc/{{ apache_config_dir }}/lokole.conf
|
||||||
dest: /etc/apache2/sites-enabled/lokole.conf
|
dest: /etc/apache2/sites-enabled/lokole.conf
|
||||||
state: link
|
state: link
|
||||||
when: lokole_enabled and is_debuntu
|
when: lokole_enabled and is_debuntu
|
||||||
|
@ -80,14 +112,8 @@
|
||||||
value: lokole
|
value: lokole
|
||||||
- option: description
|
- option: description
|
||||||
value: '"lokole is an email service."'
|
value: '"lokole is an email service."'
|
||||||
- option: lokole_src
|
- option: lokole_run_directory
|
||||||
value: "{{ lokole_src }}"
|
value: "{{ lokole_run_directory }}"
|
||||||
- option: lokole_abs_path
|
|
||||||
value: "{{ lokole_abs_path }}"
|
|
||||||
- option: lokole_db_name
|
|
||||||
value: "{{ lokole_db_name }}"
|
|
||||||
- option: lokole_db_user
|
|
||||||
value: "{{ lokole_db_user }}"
|
|
||||||
- option: lokole_url
|
- option: lokole_url
|
||||||
value: "{{ lokole_url }}"
|
value: "{{ lokole_url }}"
|
||||||
- option: lokole_full_url
|
- option: lokole_full_url
|
||||||
|
|
16
roles/lokole/templates/lokole.service.j2
Normal file
16
roles/lokole/templates/lokole.service.j2
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Provides the Lokole Server
|
||||||
|
#Requires=lokole.socket
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/bin/bash {{ lokole_run_directory }}/webapp.sh
|
||||||
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
ExecStop=/bin/kill -s TERM $MAINPID
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. '${opwen_webapp_envs}'
|
. '{{lokole_run_directory}}/webapp_secrets.sh'
|
||||||
|
|
||||||
'{{lokole_venv}}/bin/gunicorn' \
|
'{{lokole_venv}}/bin/gunicorn' \
|
||||||
--timeout='300' \
|
--timeout='300' \
|
||||||
|
|
Loading…
Reference in a new issue