Skip to content

Commit 6b76f99

Browse files
committed
Add back vagrant config
1 parent 9c1ddf6 commit 6b76f99

File tree

6 files changed

+44
-6
lines changed

6 files changed

+44
-6
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ jobs:
3131
- name: Install cookiecutter and poetry
3232
run: |
3333
python -m pip install --upgrade pip
34-
pip3 install cookiecutter==2.1.1 poetry==1.3.1
34+
pip3 install cookiecutter==2.1.1 poetry==1.7.1
3535
- name: Run tests
3636
run: bash run_test.sh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
- Django 4.1.x
1616
- Python 3.9.x
17-
- [Poetry][poetry] Support
17+
- Dependency management via [Poetry][poetry]
1818
- Support for [black](https://pypi.org/project/black/)!
1919
- [12-Factor][12factor] based settings management via [django-environ], reads settings from `.env` if present.
2020
- Supports PostreSQL 13.0 (support of postgis-3.0 is available).

{{cookiecutter.github_repository}}/provisioner/hosts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[all:vars]
2+
vm=0
23
user=ubuntu
34
project_namespace={% raw %}{{ project_name }}-{{ deploy_env }}{% endraw %}
45
project_path=/home/ubuntu/{% raw %}{{ deploy_env }}{% endraw %}/{{ cookiecutter.github_repository }}
@@ -7,6 +8,22 @@ use_letsencrypt={{ 'True' if cookiecutter.letsencrypt.lower() == 'y' else 'False
78
letsencrypt_email={{ cookiecutter.letsencrypt_email }}
89
django_settings="settings.production"
910

11+
[vagrant]
12+
192.168.33.12
13+
14+
[vagrant:vars]
15+
vm=1
16+
deploy_env=vagrant
17+
user=vagrant
18+
project_path=/home/vagrant/{{ cookiecutter.github_repository }}
19+
venv_path=/home/vagrant/venv
20+
django_settings="settings.development"
21+
use_letsencrypt=False
22+
pg_db={{ cookiecutter.main_module }}
23+
pg_user=vagrant
24+
pg_password=vagrant
25+
domain_name=vagrant.{{ cookiecutter.main_module }}.com
26+
1027
[dev]
1128
dev.{{ cookiecutter.main_module }}.com
1229

{{cookiecutter.github_repository}}/provisioner/roles/nginx/tasks/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

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

1414
- name: check {{ letsencrypt_ssl_cert_dir }} exists
1515
stat: path={{ letsencrypt_ssl_cert_dir }}
@@ -18,7 +18,7 @@
1818
- import_tasks: htpasswd.yml
1919

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

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

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

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

3738
- name: copy base nginx configuration.
3839
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf

{{cookiecutter.github_repository}}/provisioner/roles/nginx/templates/site.80.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
server {
33
listen 80;
44
listen [::]:80;
5-
server_name {{ domain_name }};
5+
server_name {% if vm %}_{% else %}{{ domain_name }}{% endif %};
66

77
{% if use_letsencrypt %}
88
location /.well-known/acme-challenge/ {

{{cookiecutter.github_repository}}/provisioner/site.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
---
2+
- hosts: vagrant
3+
vars_files:
4+
- vars.yml
5+
gather_facts: true
6+
become: true
7+
become_method: sudo
8+
9+
roles:
10+
- common
11+
- nginx
12+
- postgresql
13+
- project_data
14+
{%- if cookiecutter.add_celery.lower() == 'y' %}
15+
- redis
16+
- celery
17+
{%- else %}
18+
# - redis
19+
# - celery
20+
{%- endif %}
21+
222
#= Dev
323
#===================================================
424
- hosts: dev

0 commit comments

Comments
 (0)