mirror of https://gitlab.crans.org/bde/nk20
Compare commits
5 Commits
71f6daf0e8
...
4761d46696
Author | SHA1 | Date |
---|---|---|
Yohann D'ANELLO | 4761d46696 | |
Yohann D'ANELLO | 084d22d33f | |
Yohann D'ANELLO | 3f0208a664 | |
Yohann D'ANELLO | 3dfed70eb1 | |
Yohann D'ANELLO | cdc053718f |
|
@ -1,4 +1,4 @@
|
|||
DJANGO_APP_STAGE=dev
|
||||
DJANGO_APP_STAGE=prod
|
||||
# Only used in dev mode, change to "postgresql" if you want to use PostgreSQL in dev
|
||||
DJANGO_DEV_STORE_METHOD=sqllite
|
||||
DJANGO_DB_HOST=localhost
|
||||
|
@ -13,6 +13,6 @@ NOTE_URL=localhost
|
|||
# Config for mails. Only used in production
|
||||
NOTE_MAIL=notekfet@localhost
|
||||
EMAIL_HOST=smtp.localhost
|
||||
EMAIL_PORT=443
|
||||
EMAIL_PORT=465
|
||||
EMAIL_USER=notekfet@localhost
|
||||
EMAIL_PASSWORD=CHANGE_ME
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "apps/scripts"]
|
||||
path = apps/scripts
|
||||
url = git@gitlab.crans.org:bde/nk20-scripts.git
|
||||
url = https://gitlab.crans.org/bde/nk20-scripts.git
|
||||
|
|
|
@ -121,7 +121,7 @@ On supposera pour la suite que vous utilisez Debian/Ubuntu sur un serveur tout n
|
|||
# Le reste n'est utile qu'en production, pour configurer l'envoi des mails
|
||||
NOTE_MAIL=notekfet@localhost
|
||||
EMAIL_HOST=smtp.localhost
|
||||
EMAIL_PORT=443
|
||||
EMAIL_PORT=465
|
||||
EMAIL_USER=notekfet@localhost
|
||||
EMAIL_PASSWORD=CHANGE_ME
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[defaults]
|
||||
inventory = ./hosts
|
||||
timeout = 42
|
||||
|
||||
[privilege_escalation]
|
||||
become = True
|
||||
become_ask_pass = True
|
||||
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
retries = 3
|
||||
|
||||
[diff]
|
||||
always = yes
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env ansible-playbook
|
||||
---
|
||||
|
||||
- hosts: bde-nk20-beta.adh.crans.org
|
||||
roles:
|
||||
- 1-apt-basic
|
||||
- 2-nk20
|
||||
- 3-pip
|
||||
- 4-nginx
|
||||
- 5-psql
|
|
@ -0,0 +1,5 @@
|
|||
[server]
|
||||
bde-nk20-beta.adh.crans.org
|
||||
|
||||
[all:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- name: Install basic APT packages
|
||||
apt:
|
||||
update_cache: true
|
||||
name:
|
||||
- nginx
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-dev
|
||||
- uwsgi
|
||||
- uwsgi-plugin-python3
|
||||
- python3-venv
|
||||
- git
|
||||
- acl
|
||||
- texlive-latex-extra
|
||||
- texlive-fonts-extra
|
||||
- texlive-lang-french
|
||||
register: pkg_result
|
||||
retries: 3
|
||||
until: pkg_result is succeeded
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
- name: Create note_kfet dir with good permissions
|
||||
file:
|
||||
path: /var/www/note_kfet
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: u=rwx,g=rwxs,o=rx
|
||||
|
||||
- name: Clone Note Kfet
|
||||
git:
|
||||
repo: https://gitlab.crans.org/bde/nk20.git
|
||||
dest: /var/www/note_kfet
|
||||
version: beta-soon
|
||||
force: true
|
||||
|
||||
- name: Use default env vars (should be updated!)
|
||||
command: cp /var/www/note_kfet/.env_example /var/www/note_kfet/.env
|
||||
|
||||
- name: Update permissions for note_kfet dir
|
||||
file:
|
||||
path: /var/www/note_kfet
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: www-data
|
||||
group: www-data
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: Install PIP basic dependencies
|
||||
pip:
|
||||
requirements: /var/www/note_kfet/requirements/base.txt
|
||||
virtualenv: /var/www/note_kfet/env
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
become_user: www-data
|
||||
|
||||
- name: Install PIP production dependencies
|
||||
pip:
|
||||
requirements: /var/www/note_kfet/requirements/production.txt
|
||||
virtualenv: /var/www/note_kfet/env
|
||||
virtualenv_command: /usr/bin/python3 -m venv
|
||||
become_user: www-data
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
- name: Copy example conf of Nginx
|
||||
command: cp /var/www/note_kfet/nginx_note.conf_example /var/www/note_kfet/nginx_note.conf
|
||||
|
||||
- name: Update Nginx conf
|
||||
replace:
|
||||
path: /var/www/note_kfet/nginx_note.conf
|
||||
regexp: 'note.example.org'
|
||||
replace: 'bde-nk20-beta.adh.crans.org'
|
||||
|
||||
- name: Copy conf to Nginx
|
||||
file:
|
||||
src: /var/www/note_kfet/nginx_note.conf
|
||||
dest: /etc/nginx/sites-enabled/nginx_note.conf
|
||||
state: link
|
||||
|
||||
- name: Copy conf to UWSGI
|
||||
file:
|
||||
src: /var/www/note_kfet/uwsgi_note.ini
|
||||
dest: /etc/uwsgi/apps-enabled/uwsgi_note.ini
|
||||
state: link
|
||||
|
||||
- name: Reload Nginx
|
||||
systemd:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: Restart UWSGI
|
||||
systemd:
|
||||
name: uwsgi
|
||||
state: restarted
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- name: Install PostgreSQL APT packages
|
||||
apt:
|
||||
update_cache: true
|
||||
name:
|
||||
- postgresql
|
||||
- postgresql-contrib
|
||||
- libpq-dev
|
||||
register: pkg_result
|
||||
retries: 3
|
||||
until: pkg_result is succeeded
|
||||
|
||||
- name: Install Psycopg2
|
||||
pip:
|
||||
name: psycopg2-binary
|
||||
|
||||
- name: Create role note
|
||||
postgresql_user:
|
||||
name: note
|
||||
password: "CHANGE_ME"
|
||||
become_user: postgres
|
||||
|
||||
- name: Create NK20 database
|
||||
postgresql_db:
|
||||
name: note_db
|
||||
owner: note
|
||||
become_user: postgres
|
||||
|
||||
- name: Make Django migrations
|
||||
command: /var/www/note_kfet/env/bin/python manage.py makemigrations
|
||||
args:
|
||||
chdir: /var/www/note_kfet
|
||||
become_user: www-data
|
||||
|
||||
- name: Migrate Django database
|
||||
command: /var/www/note_kfet/env/bin/python manage.py migrate
|
||||
args:
|
||||
chdir: /var/www/note_kfet
|
||||
become_user: www-data
|
Loading…
Reference in New Issue