Skip to content

Commit

Permalink
Add bin and etc
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfs committed Sep 5, 2021
1 parent acb36db commit 07c98bd
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 29 deletions.
109 changes: 84 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,107 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
lib
lib64
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.tox
.coverage.*
.cache
nosetests.xml
htmlcov/
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Django stuff:
*.log
local_settings.py
db.sqlite3

.DS_Store
# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

reminder.md
# PyBuilder
target/

*.sqlite3
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

*.bib
maildumps
.idea
# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea/
.DS_Store
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
python:
- "2.7"
install: "pip install -r requirements.txt"
- "3.9"
install: "pip install -r requirements/tests.txt"
before_script:
- cp .env.example .env
- python manage.py migrate
script:
- python manage.py test --settings=parsifal.test_settings
sudo: false
- python manage.py test --settings=parsifal.settings.tests
sudo: false
25 changes: 25 additions & 0 deletions bin/gunicorn_start
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

NAME="parsifal"
DIR=/home/parsifal/parsifal
USER=parsifal
GROUP=parsifal
WORKERS=3
BIND=unix:/home/parsifal/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=parsifal.settings.production
DJANGO_WSGI_MODULE=parsifal.wsgi
LOG_LEVEL=info

source /home/parsifal/venv/bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH

exec /home/parsifal/venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
64 changes: 64 additions & 0 deletions etc/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
upstream app_server {
server unix:/home/parsifal/run/gunicorn.sock fail_timeout=0;
}

server {
server_name www.parsif.al parsif.al;
listen 80;
return 301 https://parsif.al$request_uri;
}

server {
server_name www.parsif.al;
listen 443;
return 301 https://parsif.al$request_uri;
}

server {
server_name parsif.al;
listen 443;

keepalive_timeout 5;
client_max_body_size 64M;

access_log /home/parsifal/logs/nginx-access.log;
error_log /home/parsifal/logs/nginx-error.log;

gzip on;
gzip_types text/plain text/css application/x-javascript image/svg+xml;
gzip_comp_level 1;
gzip_disable msie6;
gzip_http_version 1.0;
gzip_proxied any;
gzip_vary on;

location = /favicon.ico {
alias /home/parsifal/static/img/favicon.ico;
}

location /static/ {
access_log off;
expires 3600;
alias /home/parsifal/static/;
}

location /media/ {
access_log off;
expires 3600;
alias /home/parsifal/media/;
}

location / {
try_files $uri @proxy_to_app;
}

location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://app_server;
}

}
7 changes: 7 additions & 0 deletions etc/supervisord
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:parsifal]
command=/home/parsifal/parsifal/bin/gunicorn_start
user=parsifal
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/parsifal/logs/gunicorn.log

0 comments on commit 07c98bd

Please sign in to comment.