Commit 1a61a90f authored by okhin's avatar okhin 🚴

Installation et configuration de la rp

parent bb2b5f10
Pipeline #2458 failed with stages
---
- name: create a rp user
user:
append: yes
groups: [gitlab-runner, www-data]
home: "{{ rp_path }}"
name: "{{ rp_unix_user }}"
state: present
system: yes
password: '*'
- name: install required nodejs packages
npm:
global: yes
production: "{% if rp_debug %}false{% else %}true{% endif %}"
name: "{{ item }}"
state: latest
loop: "{{ npm_packages }}"
- name: install uwsgi (emperor) packages
package:
name: "{{ item }}"
state: latest
loop:
- uwsgi-emperor
- uwsgi-plugin-python3
- libapache2-mod-uwsgi
- name: enable uwsgi (emperor) on start
service:
name: uwsgi-emperor
enabled: yes
state: started
- name: create /run/ directory
file:
state: directory
path: /run/uwsgi/app/rp/
owner: "{{ rp_unix_user }}"
group: www-data
mode: 0775
- block:
- name: create the directory for code and environment
file:
path: "{{ rp_path }}"
state: directory
group: gitlab-runner
- name: unzip the rp code
unarchive:
src: "{{ rp_download_url }}"
dest: "{{ rp_path }}"
keep_newer: yes
remote_src: yes
mode: g+rw
owner: "{{ rp_unix_user }}"
group: gitlab-runner
- name: install python requirement
pip:
requirements: "{{ rp_source_path }}/requirements.txt"
virtualenv: "{{ rp_path }}/env"
virtualenv_python: python3
- name: install python dev requirements
pip:
requirements: "{{ rp_source_path }}/requirements-dev.txt"
virtualenv: "{{ rp_path }}/env"
virtualenv_python: python3
when: rp_debug
- name: yarn install the application
yarn:
path: "{{ rp_source_path }}/"
state: latest
register: yarn_out
changed_when: '"Already up-to-date." not in yarn_out.out'
- name: webpack the css
command: webpack
args:
chdir: "{{ rp_source_path }}/"
changed_when: false
- name: create the local env settings for django
template:
src: templates/env.py.j2
dest: "{{ rp_source_path }}/project/settings/env.py"
- name: migrate the database
django_manage:
command: migrate
virtualenv: "{{ rp_path }}/env/"
pythonpath: "{{ rp_source_path }}/project"
settings: project.settings
app_path: "{{ rp_source_path }}"
- name: collect static file for django
django_manage:
command: collectstatic
link: true
virtualenv: "{{ rp_path }}/env/"
pythonpath: "{{ rp_source_path }}/project"
settings: project.settings
app_path: "{{ rp_source_path }}"
become: yes
become_user: "{{ rp_unix_user }}"
- name: adds a vassal for rp
template:
src: templates/vassals-rp.j2
dest: /etc/uwsgi-emperor/vassals/rp.ini
{% if rp_debug %}
DEBUG = True
{% endif %}
SITE_ID = {{ rp_site_id }}
SECRET_KEY = '{{ rp_secret_key | replace('\n', '') }}'
[uwsgi]
plugins = python3
module = project.wsgi:application
env = DJANGO_SETTINGS_MODULE=project.settings
chdir = {{ rp_source_path }}
home = {{ rp_path }}/env
socket = /run/uwsgi/app/rp/socket
pidfile = /run/uwsgi/app/rp/pid
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment