diff --git a/deploy/ansible/README.md b/deploy/ansible/README.md index f5a501b0..649902ec 100644 --- a/deploy/ansible/README.md +++ b/deploy/ansible/README.md @@ -37,7 +37,7 @@ python -m pip install ansible - *Optional* - Host installation paths: - `project_root` - where this git repository will be cloned - `server_root` - where server configuration will be saved - - `web_root` - where the application will be served from + - `django_root` - where the application will be served from - `venv_root` - where the virtual env will be created diff --git a/deploy/ansible/group_vars/webservers.yml b/deploy/ansible/group_vars/webservers.yml index 1c36b911..a80ec2e6 100644 --- a/deploy/ansible/group_vars/webservers.yml +++ b/deploy/ansible/group_vars/webservers.yml @@ -44,7 +44,7 @@ project_root: /srv/sites/galaxy-media-site server_root: /srv/config # App will be served from here -web_root: "{{ project_root }}/webapp" +django_root: "{{ project_root }}/webapp" # Virtual environment will be created here venv_root: "{{ project_root }}/venv" diff --git a/deploy/ansible/group_vars/webservers.yml.sample b/deploy/ansible/group_vars/webservers.yml.sample index 8ec68d6c..22d63949 100644 --- a/deploy/ansible/group_vars/webservers.yml.sample +++ b/deploy/ansible/group_vars/webservers.yml.sample @@ -46,7 +46,7 @@ project_root: /home/ubuntu/galaxy-content-site server_root: /home/ubuntu/serve # App will be served from here -web_root: /srv/webapp +django_root: /srv/webapp # Virtual environment will be created here venv_root: "{{ project_root }}/.venv" diff --git a/deploy/ansible/roles/galaxy_media_site/defaults/main.yml b/deploy/ansible/roles/galaxy_media_site/defaults/main.yml index edcbd089..51612fa1 100644 --- a/deploy/ansible/roles/galaxy_media_site/defaults/main.yml +++ b/deploy/ansible/roles/galaxy_media_site/defaults/main.yml @@ -1,7 +1,7 @@ --- project_root: /home/ubuntu/galaxy-content-site server_root: /home/ubuntu/server -web_root: /srv/webapp +django_root: /srv/webapp venv_root: "{{ project_root }}/venv" webapp: diff --git a/deploy/ansible/roles/galaxy_media_site/tasks/main.yml b/deploy/ansible/roles/galaxy_media_site/tasks/main.yml index 456fa069..11a3e252 100644 --- a/deploy/ansible/roles/galaxy_media_site/tasks/main.yml +++ b/deploy/ansible/roles/galaxy_media_site/tasks/main.yml @@ -41,12 +41,12 @@ - name: create webapp media directory file: - path: "{{ web_root }}/webapp/media" + path: "{{ django_root }}/webapp/media" state: directory - name: create webapp logs directory file: - path: "{{ web_root }}/webapp/logs" + path: "{{ django_root }}/webapp/logs" state: directory - name: template webserver configuration @@ -82,7 +82,7 @@ - name: Ensure webapp superuser login shell: | - cd {{ web_root }} && \ + cd {{ django_root }} && \ export DJANGO_SUPERUSER_PASSWORD={{ admin_user.password }} && \ {{ venv_root }}/bin/python manage.py createsuperuser --noinput \ --email {{ admin_user.email }} \ @@ -100,10 +100,10 @@ group: ubuntu - name: update media file ownership - file: dest={{ web_root }}/webapp/media owner=www-data group=www-data mode=u=rwX,g=rwX,o=rwX recurse=yes + file: dest={{ django_root }}/webapp/media owner=www-data group=www-data mode=u=rwX,g=rwX,o=rwX recurse=yes - name: update log file ownership - file: dest={{ web_root }}/webapp/logs owner=www-data group=www-data mode=u=rwX,g=rwX,o=rwX recurse=yes + file: dest={{ django_root }}/webapp/logs owner=www-data group=www-data mode=u=rwX,g=rwX,o=rwX recurse=yes - name: make update.sh executable file: dest=/home/ubuntu/update.sh mode=a+x @@ -111,7 +111,7 @@ - name: check whether news scraper in GMS version ansible.builtin.shell: "{{ venv_root }}/bin/python manage.py scrape_news --help" args: - chdir: "{{ web_root }}" + chdir: "{{ django_root }}" register: check_scraper - name: add cron job to scrape news feed @@ -120,5 +120,5 @@ user: ubuntu hour: 9 minute: 0 - job: "cd {{ web_root }} && {{ venv_root }}/bin/python manage.py scrape_news" + job: "cd {{ django_root }} && {{ venv_root }}/bin/python manage.py scrape_news" when: check_scraper.rc == 0 diff --git a/deploy/ansible/roles/galaxy_media_site/templates/nginx.vhost.j2 b/deploy/ansible/roles/galaxy_media_site/templates/nginx.vhost.j2 index 7ee21fbc..00886a22 100644 --- a/deploy/ansible/roles/galaxy_media_site/templates/nginx.vhost.j2 +++ b/deploy/ansible/roles/galaxy_media_site/templates/nginx.vhost.j2 @@ -24,15 +24,15 @@ server { } location = /favicon.ico { - alias {{ web_root }}/webapp/static/favicon/favicon.ico; + alias {{ django_root }}/webapp/static/favicon/favicon.ico; } location /static { - root {{ web_root }}/webapp; + root {{ django_root }}/webapp; } location /media { - root {{ web_root }}/webapp; + root {{ django_root }}/webapp; } location / { diff --git a/deploy/ansible/roles/galaxy_media_site/templates/webapp.service.j2 b/deploy/ansible/roles/galaxy_media_site/templates/webapp.service.j2 index 03dbb852..bdd974d0 100644 --- a/deploy/ansible/roles/galaxy_media_site/templates/webapp.service.j2 +++ b/deploy/ansible/roles/galaxy_media_site/templates/webapp.service.j2 @@ -8,7 +8,7 @@ PIDFile=/run/gunicorn/pid User = www-data Group = www-data RuntimeDirectory=gunicorn -WorkingDirectory={{ web_root }} +WorkingDirectory={{ django_root }} Environment="PATH={{ venv_root }}/.venv/bin:$PATH" ExecStart={{ venv_root }}/bin/gunicorn --pid /run/gunicorn/pid \ --bind unix:/run/webapp.sock \