Last active
October 22, 2018 12:21
-
-
Save 63phc/64dc009d2ebf1fb66a1b5a34d713870d to your computer and use it in GitHub Desktop.
deploy python app
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
##! root | |
ssh root@ip | |
adduser username | |
usermod -aG sudo username | |
##! username | |
sudo apt update | |
sudo apt install python3-pip git -y | |
sudo pip3 install pipenv | |
git clone http://github.com/63phc/django-urlshorter.git project | |
cd project | |
mkdir logs | |
mkdir run | |
pipenv shell | |
pipenv install | |
./src/manage.py makemigrations | |
./src/manage.py migrate | |
./src/manage.py collectstatic | |
sudo pipenv install gunicorn | |
git clone http://github.com/63phc/conf.git | |
ls conf/ | |
chmod u+x conf/gunicorn | |
nano conf/gunicorn # вставить путь pipenv | |
sudo apt install supervisor -y | |
nano conf/supervisor.conf | |
sudo cp conf/supervisor.conf /etc/supervisor/conf.d/ | |
sudo supervisorctl reread | |
sudo supervisorctl update | |
sudo apt install nginx | |
sudo cp conf/nginx.conf /etc/nginx/sites-available/default | |
sudo nginx -t | |
sudo systemctl enable supervisor | |
sudo systemctl start supervisor | |
sudo supervisorctl restart project && sudo service nginx restart | |
##! local | |
git clone http://github.com/63phc/ansible-tools ansible | |
cd ansible | |
ansible-playbook -i host site.yml | |
##! root | |
usermod -aG docker username | |
##! username | |
nano Dockerfile | |
sudo docker build -t web . | |
sudo docker images | |
sudo docker tag f83 63phc/web | |
nano docker-compose.yml | |
sudo docker-compose up | |
nano src/core/settings.py | |
sudo docker-compose up | |
##!username 2 | |
docker ps | |
docker exec -it HASH bash | |
./manage.py migrate | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment