Skip to content

Commit

Permalink
Add back vagrant config
Browse files Browse the repository at this point in the history
  • Loading branch information
theskumar committed Dec 20, 2023
1 parent 9c1ddf6 commit 7a397d8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Install cookiecutter and poetry
run: |
python -m pip install --upgrade pip
pip3 install cookiecutter==2.1.1 poetry==1.3.1
pip3 install cookiecutter==2.1.1 poetry==1.7.1
- name: Run tests
run: bash run_test.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- Django 4.1.x
- Python 3.9.x
- [Poetry][poetry] Support
- Dependency management via [Poetry][poetry]
- Support for [black](https://pypi.org/project/black/)!
- [12-Factor][12factor] based settings management via [django-environ], reads settings from `.env` if present.
- Supports PostreSQL 13.0 (support of postgis-3.0 is available).
Expand Down
17 changes: 17 additions & 0 deletions {{cookiecutter.github_repository}}/provisioner/hosts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[all:vars]
vm=0
user=ubuntu
project_namespace={% raw %}{{ project_name }}-{{ deploy_env }}{% endraw %}
project_path=/home/ubuntu/{% raw %}{{ deploy_env }}{% endraw %}/{{ cookiecutter.github_repository }}
Expand All @@ -7,6 +8,22 @@ use_letsencrypt={{ 'True' if cookiecutter.letsencrypt.lower() == 'y' else 'False
letsencrypt_email={{ cookiecutter.letsencrypt_email }}
django_settings="settings.production"

[vagrant]
192.168.33.12

[vagrant:vars]
vm=1
deploy_env=vagrant
user=vagrant
project_path=/home/vagrant/{{ cookiecutter.github_repository }}
venv_path=/home/vagrant/venv
django_settings="settings.development"
use_letsencrypt=False
pg_db={{ cookiecutter.main_module }}
pg_user=vagrant
pg_password=vagrant
domain_name=vagrant.{{ cookiecutter.main_module }}.com

[dev]
dev.{{ cookiecutter.main_module }}.com

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- name: make sure ssl directory exists
file: path={{ ssl_cert_dir }} state=directory
when: use_letsencrypt
when: vm == 0 and use_letsencrypt

- name: check {{ letsencrypt_ssl_cert_dir }} exists
stat: path={{ letsencrypt_ssl_cert_dir }}
Expand All @@ -18,7 +18,7 @@
- import_tasks: htpasswd.yml

- import_tasks: letsencrypt.yml
when: use_letsencrypt and letsencrypt_dir.stat.exists == false
when: vm == 0 and use_letsencrypt and letsencrypt_dir.stat.exists == false

- name: check ssl/nginx.crt exists
stat: path={{ ssl_certificate }}
Expand All @@ -29,10 +29,11 @@
register: nginx_key

- fail: msg="Whoops! ssl certificate doesn't exist"
when: use_letsencrypt and (nginx_cert.stat.exists == false or nginx_key.stat.exists == false)
when: (vm == 0 and use_letsencrypt) == true and (nginx_cert.stat.exists == false or nginx_key.stat.exists == false)

- name: generate ssl forward secrecy key
command: openssl dhparam -out {{ ssl_forward_secrecy_key_path }} {{ ssl_forward_secrecy_key_length }} creates={{ ssl_forward_secrecy_key_path }}
when: vm == 0

- name: copy base nginx configuration.
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
Expand Down
20 changes: 20 additions & 0 deletions {{cookiecutter.github_repository}}/provisioner/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
---
- hosts: vagrant
vars_files:
- vars.yml
gather_facts: true
become: true
become_method: sudo

roles:
- common
- nginx
- postgresql
- project_data
{%- if cookiecutter.add_celery.lower() == 'y' %}
- redis
- celery
{%- else %}
# - redis
# - celery
{%- endif %}

#= Dev
#===================================================
- hosts: dev
Expand Down

0 comments on commit 7a397d8

Please sign in to comment.