Git Product home page Git Product logo

django-wedding's Introduction

Deploying

nginx

$ sudo dnf install nginx
$ sudo ln -s /path/to/Wedding/root/www.stephandwill.com.conf /etc/nginx/conf.d/www.stephandwill.com.conf
# Install SELinux module to grant nginx permissions to write to sockets
$ sudo semodule -i nginx.pp

Lets Encrypt

$ sudo dnf install certbot
$ sudo pip install certbot-nginx
$ sudo certbot --nginx -d stephandwill.com -d www.stephandwill.com -d willandsteph.com -d www.willandsteph.com

Add 0 12 * * * /usr/bin/certbot renew --quiet within sudo crontab -e

https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/

python

$ source /path/to/Wedding/root/../py-venvs/Wedding/bin/activate
$ pip install -r /path/to/Wedding/root/requirements.txt

Services/Gunicorn

$ sudo echo "d /run/gunicorn-wedding 0755 <someuser> <somegroup> -" > /etc/tmpfiles.d/gunicorn-wedding.conf

http://docs.gunicorn.org/en/stable/deploy.html#systemd

$ sudo systemd-tmpfiles create

The above may be needed https://developers.redhat.com/blog/2016/09/20/managing-temporary-files-with-systemd-tmpfiles-on-rhel7/

$ sudo systemctl enable /path/to/Wedding/root/gunicorn-wedding.socket
$ sudo systemctl enable /path/to/Wedding/root/gunicorn-wedding.service

https://unix.stackexchange.com/a/344843

$ sudo systemctl start gunicorn-wedding.socket

Troubleshooting

SELinux

sudo tail -F /var/log/audit/audit.log

How to create a module to allow permissions comes from http://nts.strzibny.name/allowing-nginx-to-use-a-pumaunicorn-unix-socket-with-selinux/

$ sudo grep nginx /var/log/audit/audit.log | audit2allow -m nginx > nginx.te
$ checkmodule -M -m -o nginx.mod nginx.te
$ semodule_package -o nginx.pp -m nginx.mod
$ sudo semodule -i nginx.pp

Services/Gunicorn

$ systemctl status gunicorn-wedding.socket
$ systemctl status gunicorn-wedding.service

Reloading everything after config changes

$ sudo systemctl daemon-reload && sudo rm /run/gunicorn-wedding/socket && sudo systemctl stop gunicorn-wedding.socket && sudo systemctl stop gunicorn-wedding.service && sudo systemctl stop nginx && sudo systemctl start gunicorn-wedding.socket && sudo systemctl start gunicorn-wedding.service && sudo systemctl start nginx

Nginx

$ sudo tail -F /var/log/nginx/wedding-error.log
$ sudo nginx -t

Test nginx configurations

$ sudo systemctl reload nginx

django-wedding's People

Contributors

wgordon17 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.