Last active
December 26, 2016 23:55
-
-
Save get-data-/98af5457370399458dd10e0204888479 to your computer and use it in GitHub Desktop.
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
$sudo apt-get update | |
$sudo apt-get install python3-pip python3-dev nginx | |
$sudo pip3 install virtualenv | |
$git clone https://github.com/path/to/repo.git | |
$cd my_repo | |
$virtualenv my_repo_env | |
$source my_repo_env/bin/activate | |
$pip install -r requirements.txt | |
$nano ~/my_repo/config.py #copy any config settings here | |
(my_repo_env) $deactivate | |
$nano ~/my_repo/my_repo.ini | |
#############Start_File############## | |
[uwsgi] | |
module = wsgi:app | |
master = true | |
processes = 5 | |
socket = my_repo.sock | |
chmod-socket = 660 | |
vacuum = true | |
die-on-term = true | |
#############End_File############## | |
$sudo nano /etc/systemd/system/my_repo.service | |
#############Start_File############## | |
[Unit] | |
Description=uWSGI instance to serve my_repo | |
After=network.target | |
[Service] | |
User=ubuntu | |
Group=www-data | |
WorkingDirectory=/home/ubuntu/my_repo | |
Environment="PATH=/home/ubuntu/my_repo/my_repo_env/bin" | |
ExecStart=/home/ubuntu/my_repo/my_repo_env/bin/uwsgi --ini my_repo.ini | |
[Install] | |
WantedBy=multi-user.target | |
#############End_File############## | |
$sudo systemctl start my_repo | |
$sudo systemctl enable my_repo | |
#Get Nginx to proxy requests | |
$sudo nano /etc/nginx/sites-available/my_repo | |
#############Start_File############## | |
server { | |
listen 80; | |
server_name IP_ADDRESS_GOES_HERE; | |
location / { | |
include uwsgi_params; | |
uwsgi_pass unix:/home/ubuntu/my_repo/my_repo.sock; | |
} | |
} | |
#############End_File############## | |
$sudo ln -s /etc/nginx/sites-available/my_repo /etc/nginx/sites-enabled | |
$sudo nginx -t | |
$sudo systemctl restart nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment