-
Notifications
You must be signed in to change notification settings - Fork 0
oneprofittips/install_aio_webapp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Β | Β | |||
Repository files navigation
ΠΠ΅ΡΠ²ΡΠΌ Π΄Π΅Π»ΠΎΠΌ ΡΠΎΠ·Π΄Π°Π΄ΠΈΠΌ Π΄Π»Ρ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ ΠΏΠ°ΠΏΠΊΡ Π΄Π»Ρ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ Π‘ΠΎΠ·Π΄Π°ΠΈΠΌ Π²ΠΈΡΡ ΠΎΠΊΡΡΠΆΠ΅Π½ΠΈΠ΅ pip install virtualenv python3 -m venv env Π°ΠΊΡΠΈΠ²Π°ΡΠΈΡ source env/bin/activate Π΄Π΅Π°ΠΊΡΠΈΠ²Π°ΡΠΈΡ deactivate pip install uvloop Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° gunicorn pip install gunicorn ΠΡΠΎΠ±Π½ΡΠΉ Π·Π°ΠΏΡΡΠΊ 1. Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ ΠΊΠΎΠ½ΡΠΈΠ³ ΡΠ°ΠΉΠ» gunicorn.conf.py 2. Π‘ΡΡΠΎΠΊΠ° Π·Π°ΠΏΡΡΠΊΠ° 1.1 gunicorn main_api:my_web_app --bind localhost:8080 --worker-class aiohttp.GunicornUVLoopWebWorker --workers 2 ΠΈΠ»ΠΈ Ρ ΠΏΠΎΠΌΠΎΡΡΡ ΠΊΠΎΠ½ΡΠΈΠ³ ΡΠ°ΠΉΠ»Π° 1.2 gunicorn main_api:my_web_app -c gunicorn.conf.py Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Nginx apt install nginx Π‘ΠΎΠ·Π΄Π°Π΄ΠΈΠΌ Π² ΠΏΠ°ΠΏΠΊΠ΅ /etc/nginx/sites-available/ ΡΠ°ΠΉΠ» Π΄Π»Ρ ΡΠ°ΠΉΡΠ° ΠΈ Π²ΠΏΠΈΡΠ΅ΠΌ ΡΡΠ΄Π° ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΡ server { listen 80; server_name 111.222.333.44; # Π·Π΄Π΅ΡΡ ΠΏΡΠΎΠΏΠΈΡΠ°ΡΡ ΠΈΠ»ΠΈ IP-Π°Π΄ΡΠ΅Ρ ΠΈΠ»ΠΈ Π΄ΠΎΠΌΠ΅Π½Π½ΠΎΠ΅ ΠΈΠΌΡ ΡΠ΅ΡΠ²Π΅ΡΠ° access_log /var/log/nginx/example.log; location /static/ { root /home/user/myprojectenv/myproject/myproject/; expires 30d; } location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $server_name; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } Π‘ΠΎΠ·Π΄Π°Π΄ΠΈΠΌ ΡΡΡΠ»ΠΊΡ ln -s /etc/nginx/sites-available/<ΠΠΠ― Π€ΠΠΠΠ> /etc/nginx/sites-enabled/ ΠΡΠΎΠ²Π΅ΡΠΊΠ° Π½Π° ΡΠΈΠ½ΡΠ°ΠΊΡΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΠΎΡΠΈΠ±ΠΊΠΈ nginx -t ΠΠΎΠΌΠ°Π½Π΄Ρ ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Nginx systemctl stop nginx systemctl restart nginx systemctl start nginx systemctl reload nginx systemctl disable nginx systemctl enable nginx ΠΠ°ΡΡΡΠΎΠΉΠΊΠ° ΡΡΠΏΠ΅ΡΠ²ΠΈΠ·ΠΎΡΠ° apt-get install supervisor Π ΡΠ°ΠΉΠ»Π΅ cd /etc/supervisor/supervisord.conf Π΄ΠΎΠ±Π°Π²ΠΈΠΌ Π² ΠΊΠΎΠ½Π΅Ρ [program:app] command=/root/app/appenv/bin/gunicorn app:inst_app --bind 0.0.0.0:5000 --worker-class aiohttp.GunicornUVLoopWebWorker --workers=4 directory=/root/app user=root autorestart=true redirect_stderr=true ΠΠΊΠ»ΡΡΠΈΠΌ ΡΡΠΏΠ΅ΡΠ²ΠΈΠ·ΠΎΡ update-rc.d supervisor enable ΠΠ°ΠΏΡΡΡΠΈΠΌ service supervisor start /etc/init.d/supervisor restart ΠΡΠ½ΠΎΠ²Π½ΡΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ ΡΡΠΏΠ΅ΡΠ²ΠΈΠ·ΠΎΡΠ° supervisorctl reread supervisorctl update supervisorctl status <ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π° ΠΊΠΎΠ½Ρ> supervisor restart <ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π° ΠΊΠΎΠ½Ρ> Π£Π±ΠΈΡΡΡ ΠΏΡΠΎΡΠ΅ΡΡ killall gunicorn PG apt-get install postgresql su - postgres psql CREATE DATABASE yourdbname; CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpass'; GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published