-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/deploy-fly
- Loading branch information
Showing
22 changed files
with
186 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ default_context: | |
enable_whitenoise: "y" | ||
add_celery: "y" | ||
add_graphql: "y" | ||
add_asgi: "y" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Standard Library | ||
import os | ||
|
||
# Third Party Stuff | ||
from django.core.asgi import get_asgi_application | ||
from dotenv import load_dotenv | ||
|
||
# Read .env file and set key/value inside it as environment variables | ||
# see: http://github.com/theskumar/python-dotenv | ||
load_dotenv(os.path.join(os.path.dirname(__file__), ".env")) | ||
|
||
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.production") | ||
|
||
application = get_asgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
{{cookiecutter.github_repository}}/provisioner/roles/project_data/tasks/asgi-setup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% raw %}--- | ||
- name: apt_get install asgi packages | ||
apt: pkg={{ item }} state=present | ||
with_items: | ||
- uuid-dev | ||
- libcap-dev | ||
- libpcre3-dev | ||
tags: ["configure"] | ||
|
||
- name: make sure project directory is owned by asgi group | ||
file: path={{ project_path }} state=directory owner={{user}} group={{asgi_group}} recurse=yes | ||
tags: ["configure"] | ||
|
||
- name: copy django-asgi logrotate | ||
template: src=django.logrotate.j2 | ||
dest=/etc/logrotate.d/asgi-{{ deploy_environment}}-{{project_name}}-django | ||
mode=644 | ||
tags: ["configure"] | ||
|
||
- name: make sure log directory exists | ||
file: path={{ project_log_dir }} state=directory owner={{asgi_user}} group={{asgi_group}} mode=751 recurse=yes | ||
tags: ["configure"] | ||
|
||
- name: copy Django asgi service to systemd | ||
template: src=django.asgi.ini.j2 | ||
dest=/etc/systemd/system/asgi-{{project_namespace}}.service | ||
mode=644 | ||
tags: ["deploy"] | ||
{% endraw %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...kiecutter.github_repository}}/provisioner/roles/project_data/templates/django.asgi.ini.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% raw %}[Unit] | ||
Description={{ project_namespace }} gunicorn daemon | ||
After=network.target | ||
|
||
[Service] | ||
Environment=LC_ALL=en_US.utf-8 | ||
Environment=LANG=en_US.utf-8 | ||
StandardOutput=syslog | ||
StandardError=syslog | ||
SyslogIdentifier=gunicorn | ||
User={{ asgi_user }} | ||
Group={{ asgi_group }} | ||
WorkingDirectory={{ project_path }} | ||
ExecStart={{ venv_path }}/bin/gunicorn -w {{ asgi_workers }} --bind unix://{{ asgi_socket }} --access-logfile {{project_log_dir}}/asgi.log --capture-output --error-logfile {{project_log_dir}}/asgi-errors.log -k uvicorn.workers.UvicornWorker asgi:application | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
{% endraw %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
{{cookiecutter.github_repository}}/{{cookiecutter.main_module}}/graphql/middleware.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.