SlideShare a Scribd company logo
NGINX & uWSGI &
PYTHON & PostgreSQL
install Part2
writing by bee
Client
http
socket or http
CentOS 7.5(x86_64)
WEB SERVER
(reverse proxy)
test system definition
APLICATION
SERVER
■ Step.1 NGINX Install (1:1.18.0-1.el7.ngx)
■ Step.2 PostgreSQL Install (0:9.2.24-2.el7_7)
■ Step.3 Python Install (3.7.1)
■ Step.4 uWSGI Install (2.0.18)
table of contents
■ Step.5 Create Database
■ Step.6 Install Python library
■ Step.7 Make Django Project
(Check the connection between Django and PosgreSQL)
■ Step.8 Make conection between uWSGI and Django
■ Step.9 Make conection between NGINX and uWSGI
[root@cent75 ~]# su – postgres
[root@cent75 ~]# psql -U postgres -c "CREATE DATABASE ¥"BACKEND_SPPF¥" WITH OWNER = ¥"jppf¥" TEMPLATE = template0
ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'C' LC_CTYPE = 'C'“
CREATE DATABASE
[root@cent75 ~]# psql -U jppf BACKEND_SPPF
psql (9.2.24)
"help" でヘルプを表示します.
BACKEND_SPPF=> ¥q
□ Step 5-1 Create Database
□ Step 6-1 Install Python library
[root@cent75 ~]# pip install Django==2.2.8
Collecting Django==2.2.8
Using cached Django-2.2.8-py3-none-any.whl (7.5 MB)
Requirement already satisfied: pytz in ./.pyenv/versions/3.7.1/lib/python3.7/site-packages (from Django==2.2.8) (2020.1)
Requirement already satisfied: sqlparse in ./.pyenv/versions/3.7.1/lib/python3.7/site-packages (from Django==2.2.8) (0.3.1)
Installing collected packages: Django
Successfully installed Django-2.2.8
[root@cent75 ~]# pip install psycopg2==2.8.3
Collecting psycopg2==2.8.3
Using cached psycopg2-2.8.3.tar.gz (377 kB)
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... done
Created wheel for psycopg2: filename=psycopg2-2.8.3-cp37-cp37m-linux_x86_64.whl size=380257
sha256=938b9a33e77d5dbe5ea46619b83f57892268ba5867f2a792db308e8f425b050c
Stored in directory: /root/.cache/pip/wheels/ab/7f/cb/706413aad012f25a7f06788a24f43b30972d9b481cbb2c7618
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.3
□ Step 7-1 Make Django Project
[root@cent75 ~]# mkdir -p /usr/local/sp_pf
[root@cent75 ~]# cd /usr/local/sp_pf
[root@cent75 sp_pf]# django-admin startproject mysite
[root@cent75 sp_pf]# ls mysite/
manage.py mysite
[root@cent75 ~]# cd /usr/local/sp_pf/mysite
[root@cent75 mysite]# vi mysite/settings.py
ALLOWED_HOSTS = ['192.168.1.202', '192.168.1.3', '127.0.0.1', 'localhost']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'BACKEND_SPPF',
'USER': 'jppf',
'PASSWORD': 'jppf',
'HOST': '127.0.0.1',
'PORT': 5432,
}
}
STATIC_URL = '/mysite_static/'
STATIC_ROOT = ‘mysite_static/'
□ Step 7-2 Modify the Django config file
□ Step 7-3 Perform a migration
[root@cent75 mysite]# python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
□ Step 7-4 Create static Objects
[root@cent75 mysite]# python manage.py collectstatic
119 static files copied to '/home2/work1/sp_pf/mysite/mysite_static'.
[root@cent75 mysite]# python manage.py runserver 0.0.0.0:8080
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
May 16, 2020 - 01:41:20
Django version 2.2.8, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.
□ Step 7-5 Start the application test server.
[root@cent75 mysite]# cd /usr/local/sp_pf/mysite
[root@cent75 mysite]# pyenv virtualenv 3.7.1 mysite371
Looking in links: /tmp/tmpnv_187q7
Requirement already satisfied: setuptools in /root/.pyenv/versions/3.7.1/envs/mysite371/lib/python3.7/site-packages (39.0.1)
Requirement already satisfied: pip in /root/.pyenv/versions/3.7.1/envs/mysite371/lib/python3.7/site-packages (10.0.1)
[root@cent75 backend]# cd /usr/local/src/uwsgi-2.0.18
[root@cent75 backend]# pyenv activate mysite371
□ Step 8-1 Make conection between uWSGI and Django
Create a virtual environment.
□ Step 8-2 Make python load module
(mysite371) [root@cent75 uwsgi-2.0.18]# python uwsgiconfig.py --plugin plugins/python core python371
using profile: buildconf/core.ini
detected include path: ['/usr/include', '/usr/local/include']
*** uWSGI building and linking plugin plugins/python ***
[gcc -pthread] ./python371_plugin.so
build time: 3 seconds
*** python371 plugin built and available in ./python371_plugin.so ***
(mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/plugins
(mysite371) [root@cent75 uwsgi-2.0.18]# mv python371_plugin.so /usr/local/sp_pf/plugins
(mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/socket
(mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/logs
(mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/environment/uwsgi-ini
(mysite371) [root@cent75 uwsgi-2.0.18]# vi /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini
[uwsgi]
plugins-dir = /usr/local/sp_pf/plugins
plugins = python371
home = /root/.pyenv/versions/3.7.1/envs/mysite371
socket = /usr/local/sp_pf/socket/mysite.sock
chmod-socket = 666
vacuum = true
chdir = /usr/local/sp_pf/mysite
mount = /mysite=mysite/wsgi.py
manage-script-name = true
logto = /usr/local/sp_pf/logs/uwsgi-mysite.log
processes = 1
threads = 8
master = true
thunder-lock = true
buffer-size = 32768
harakiri = 1500
(sample371) [root@cent75 uwsgi-2.0.18]# pyenv deactivate
□ Step 8-3 Edit the uWSGI server initialization file
[root@cent75 mysite]# cd /usr/local/sp_pf/mysite
[root@cent75 mysite]# python manage.py createsuperuser
Username (leave blank to use 'root'): jppf
Email address:
Password: jppfpasswd
Password (again): jppfpasswd
Superuser created successfully.
□ Step 8-4 Create an application admin user
[root@cent75 mysite]# vi /etc/systemd/system/mysite.service
[Unit]
Description=bert service server
[Service]
ExecStart=/usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini
[Install]
WantedBy=multi-user.target
[root@cent75 mysite]# systemctl enable mysite.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mysite.service to /etc/systemd/system/mysite.service.
□ Step 8-5 Creating system unit files
[root@cent75 mysite]# systemctl start mysite
[root@cent75 mysite]# systemctl status mysite
● mysite.service - bert service server
Loaded: loaded (/etc/systemd/system/mysite.service; enabled; vendor preset: disabled)
Active: active (running) since 土 2020-05-16 11:40:52 JST; 1s ago
Main PID: 16760 (uwsgi)
Tasks: 9
CGroup: /system.slice/mysite.service
tq16760 /usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini
mq16765 /usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini
5月 16 11:40:52 cent75 systemd[1]: Started bert service server.
5月 16 11:40:52 cent75 uwsgi[16760]: [uWSGI] getting INI configuration from /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini
□ Step 8-6 Startup application server
[root@cent75 mysite]# tail -f /usr/local/sp_pf/logs/uwsgi-mysite.log
your mercy for graceful operations on workers is 60 seconds
mapped 750976 bytes (733 KB) for 8 cores
*** Operational MODE: threaded ***
mounting mysite/wsgi.py on /mysite
WSGI app 0 (mountpoint='/mysite') ready in 0 seconds on interpreter 0x119f8c0 pid: 16760 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 16760)
spawned uWSGI worker 1 (pid: 16765, cores: 8)
[root@cent75 mysite]# vi /etc/nginx/conf.d/mysite.conf
server {
listen 80;
server_name 192.168.1.202; # <= server ip
# mysite server static
location /mysite/ {
uwsgi_read_timeout 1500;
uwsgi_pass unix:///usr/local/sp_pf/socket/mysite.sock;
include uwsgi_params;
}
# mysite server static
location /mysite_static {
alias /usr/local/sp_pf/mysite/mysite_static;
}
}
□ Step 9-1 Make conection between NGINX and uWSGI
URL: http://<server ip>/mysite/admin/
jppf
jppfpasswd

More Related Content

What's hot

Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4j
Christophe Willemsen
 
How to Install Odoo 11 on Ubuntu 16.04?
How to Install Odoo 11 on Ubuntu 16.04?How to Install Odoo 11 on Ubuntu 16.04?
How to Install Odoo 11 on Ubuntu 16.04?
Celine George
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
pkill
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16
Enrique Davila
 
Django Deployment-in-AWS
Django Deployment-in-AWSDjango Deployment-in-AWS
Django Deployment-in-AWS
Mindfire Solutions
 
Gitlab installation
Gitlab installationGitlab installation
Gitlab installationRaiful Hasan
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
Fredy Ntn Bautista
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16
Enrique Davila
 
Continuous delivery of Windows micro services in the cloud
Continuous delivery of Windows micro services in the cloud Continuous delivery of Windows micro services in the cloud
Continuous delivery of Windows micro services in the cloud
Owain Perry
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoop
Enrique Davila
 
How to install nginx vs unicorn
How to install nginx vs unicornHow to install nginx vs unicorn
How to install nginx vs unicorn
baran19901990
 
Django deployment best practices
Django deployment best practicesDjango deployment best practices
Django deployment best practicesErik LaBianca
 
Debug logpath
Debug logpathDebug logpath
Debug logpath
Nay Phyo Aung
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
Antony Gitomeh
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
Nicolas Blanco
 
Deploying on the cutting edge
Deploying on the cutting edgeDeploying on the cutting edge
Deploying on the cutting edge
ericholscher
 
Introduction to mercurial
Introduction to mercurialIntroduction to mercurial
Introduction to mercurialIT Booze
 
Ansible Crash Course
Ansible Crash CourseAnsible Crash Course
Ansible Crash Course
Peter Sankauskas
 
Nagios intro
Nagios intro Nagios intro
Nagios intro
Hsi-Kai Wang
 
Infrastructure development on windows ldn cd meetup
Infrastructure development on windows   ldn cd meetup Infrastructure development on windows   ldn cd meetup
Infrastructure development on windows ldn cd meetup
Owain Perry
 

What's hot (20)

Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4j
 
How to Install Odoo 11 on Ubuntu 16.04?
How to Install Odoo 11 on Ubuntu 16.04?How to Install Odoo 11 on Ubuntu 16.04?
How to Install Odoo 11 on Ubuntu 16.04?
 
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and KibanaPuppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
Puppetconf 2015 - Puppet Reporting with Elasticsearch Logstash and Kibana
 
Installing hive on ubuntu 16
Installing hive on ubuntu 16Installing hive on ubuntu 16
Installing hive on ubuntu 16
 
Django Deployment-in-AWS
Django Deployment-in-AWSDjango Deployment-in-AWS
Django Deployment-in-AWS
 
Gitlab installation
Gitlab installationGitlab installation
Gitlab installation
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
 
Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16Installing hadoop on ubuntu 16
Installing hadoop on ubuntu 16
 
Continuous delivery of Windows micro services in the cloud
Continuous delivery of Windows micro services in the cloud Continuous delivery of Windows micro services in the cloud
Continuous delivery of Windows micro services in the cloud
 
Installing apache sqoop
Installing apache sqoopInstalling apache sqoop
Installing apache sqoop
 
How to install nginx vs unicorn
How to install nginx vs unicornHow to install nginx vs unicorn
How to install nginx vs unicorn
 
Django deployment best practices
Django deployment best practicesDjango deployment best practices
Django deployment best practices
 
Debug logpath
Debug logpathDebug logpath
Debug logpath
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
Deploying on the cutting edge
Deploying on the cutting edgeDeploying on the cutting edge
Deploying on the cutting edge
 
Introduction to mercurial
Introduction to mercurialIntroduction to mercurial
Introduction to mercurial
 
Ansible Crash Course
Ansible Crash CourseAnsible Crash Course
Ansible Crash Course
 
Nagios intro
Nagios intro Nagios intro
Nagios intro
 
Infrastructure development on windows ldn cd meetup
Infrastructure development on windows   ldn cd meetup Infrastructure development on windows   ldn cd meetup
Infrastructure development on windows ldn cd meetup
 

Similar to Nginx3

Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
Yuriy Senko
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
ananelson
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
andrewmirskynet
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawa
Xoxzo Inc.
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with PuppetJoe Ray
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
 
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Raja Rozali Raja Hasan
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core
Binary Studio
 
Building a Django App on Heroku
Building a Django App on HerokuBuilding a Django App on Heroku
Building a Django App on Heroku
Joe Fusaro
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
Mike Pittaro
 
Booting Weblogic - OOW14
Booting Weblogic - OOW14Booting Weblogic - OOW14
Booting Weblogic - OOW14
Jon Petter Hjulstad
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profiling
ripienaar
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
Chef Software, Inc.
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
Henry Schreiner
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡Wei Jen Lu
 
Basic Rails Training
Basic Rails TrainingBasic Rails Training
Basic Rails Training
Arthit Hongchintakul
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
Jazkarta, Inc.
 
How to configure Nagios in Fedora ?
How to configure Nagios in Fedora ?How to configure Nagios in Fedora ?
How to configure Nagios in Fedora ?
Pankaj Rane
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04
SANTIAGO HERNÁNDEZ
 

Similar to Nginx3 (20)

Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawa
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core
 
Building a Django App on Heroku
Building a Django App on HerokuBuilding a Django App on Heroku
Building a Django App on Heroku
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 
Booting Weblogic - OOW14
Booting Weblogic - OOW14Booting Weblogic - OOW14
Booting Weblogic - OOW14
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profiling
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Basic Rails Training
Basic Rails TrainingBasic Rails Training
Basic Rails Training
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
How to configure Nagios in Fedora ?
How to configure Nagios in Fedora ?How to configure Nagios in Fedora ?
How to configure Nagios in Fedora ?
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

Nginx3

  • 1. NGINX & uWSGI & PYTHON & PostgreSQL install Part2 writing by bee
  • 2. Client http socket or http CentOS 7.5(x86_64) WEB SERVER (reverse proxy) test system definition APLICATION SERVER
  • 3. ■ Step.1 NGINX Install (1:1.18.0-1.el7.ngx) ■ Step.2 PostgreSQL Install (0:9.2.24-2.el7_7) ■ Step.3 Python Install (3.7.1) ■ Step.4 uWSGI Install (2.0.18) table of contents ■ Step.5 Create Database ■ Step.6 Install Python library ■ Step.7 Make Django Project (Check the connection between Django and PosgreSQL) ■ Step.8 Make conection between uWSGI and Django ■ Step.9 Make conection between NGINX and uWSGI
  • 4. [root@cent75 ~]# su – postgres [root@cent75 ~]# psql -U postgres -c "CREATE DATABASE ¥"BACKEND_SPPF¥" WITH OWNER = ¥"jppf¥" TEMPLATE = template0 ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'C' LC_CTYPE = 'C'“ CREATE DATABASE [root@cent75 ~]# psql -U jppf BACKEND_SPPF psql (9.2.24) "help" でヘルプを表示します. BACKEND_SPPF=> ¥q □ Step 5-1 Create Database
  • 5. □ Step 6-1 Install Python library [root@cent75 ~]# pip install Django==2.2.8 Collecting Django==2.2.8 Using cached Django-2.2.8-py3-none-any.whl (7.5 MB) Requirement already satisfied: pytz in ./.pyenv/versions/3.7.1/lib/python3.7/site-packages (from Django==2.2.8) (2020.1) Requirement already satisfied: sqlparse in ./.pyenv/versions/3.7.1/lib/python3.7/site-packages (from Django==2.2.8) (0.3.1) Installing collected packages: Django Successfully installed Django-2.2.8 [root@cent75 ~]# pip install psycopg2==2.8.3 Collecting psycopg2==2.8.3 Using cached psycopg2-2.8.3.tar.gz (377 kB) Building wheels for collected packages: psycopg2 Building wheel for psycopg2 (setup.py) ... done Created wheel for psycopg2: filename=psycopg2-2.8.3-cp37-cp37m-linux_x86_64.whl size=380257 sha256=938b9a33e77d5dbe5ea46619b83f57892268ba5867f2a792db308e8f425b050c Stored in directory: /root/.cache/pip/wheels/ab/7f/cb/706413aad012f25a7f06788a24f43b30972d9b481cbb2c7618 Successfully built psycopg2 Installing collected packages: psycopg2 Successfully installed psycopg2-2.8.3
  • 6. □ Step 7-1 Make Django Project [root@cent75 ~]# mkdir -p /usr/local/sp_pf [root@cent75 ~]# cd /usr/local/sp_pf [root@cent75 sp_pf]# django-admin startproject mysite [root@cent75 sp_pf]# ls mysite/ manage.py mysite [root@cent75 ~]# cd /usr/local/sp_pf/mysite [root@cent75 mysite]# vi mysite/settings.py ALLOWED_HOSTS = ['192.168.1.202', '192.168.1.3', '127.0.0.1', 'localhost'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'BACKEND_SPPF', 'USER': 'jppf', 'PASSWORD': 'jppf', 'HOST': '127.0.0.1', 'PORT': 5432, } } STATIC_URL = '/mysite_static/' STATIC_ROOT = ‘mysite_static/' □ Step 7-2 Modify the Django config file
  • 7. □ Step 7-3 Perform a migration [root@cent75 mysite]# python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply. □ Step 7-4 Create static Objects [root@cent75 mysite]# python manage.py collectstatic 119 static files copied to '/home2/work1/sp_pf/mysite/mysite_static'.
  • 8. [root@cent75 mysite]# python manage.py runserver 0.0.0.0:8080 Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). May 16, 2020 - 01:41:20 Django version 2.2.8, using settings 'mysite.settings' Starting development server at http://0.0.0.0:8080/ Quit the server with CONTROL-C. □ Step 7-5 Start the application test server.
  • 9. [root@cent75 mysite]# cd /usr/local/sp_pf/mysite [root@cent75 mysite]# pyenv virtualenv 3.7.1 mysite371 Looking in links: /tmp/tmpnv_187q7 Requirement already satisfied: setuptools in /root/.pyenv/versions/3.7.1/envs/mysite371/lib/python3.7/site-packages (39.0.1) Requirement already satisfied: pip in /root/.pyenv/versions/3.7.1/envs/mysite371/lib/python3.7/site-packages (10.0.1) [root@cent75 backend]# cd /usr/local/src/uwsgi-2.0.18 [root@cent75 backend]# pyenv activate mysite371 □ Step 8-1 Make conection between uWSGI and Django Create a virtual environment. □ Step 8-2 Make python load module (mysite371) [root@cent75 uwsgi-2.0.18]# python uwsgiconfig.py --plugin plugins/python core python371 using profile: buildconf/core.ini detected include path: ['/usr/include', '/usr/local/include'] *** uWSGI building and linking plugin plugins/python *** [gcc -pthread] ./python371_plugin.so build time: 3 seconds *** python371 plugin built and available in ./python371_plugin.so *** (mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/plugins (mysite371) [root@cent75 uwsgi-2.0.18]# mv python371_plugin.so /usr/local/sp_pf/plugins
  • 10. (mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/socket (mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/logs (mysite371) [root@cent75 uwsgi-2.0.18]# mkdir -p /usr/local/sp_pf/environment/uwsgi-ini (mysite371) [root@cent75 uwsgi-2.0.18]# vi /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini [uwsgi] plugins-dir = /usr/local/sp_pf/plugins plugins = python371 home = /root/.pyenv/versions/3.7.1/envs/mysite371 socket = /usr/local/sp_pf/socket/mysite.sock chmod-socket = 666 vacuum = true chdir = /usr/local/sp_pf/mysite mount = /mysite=mysite/wsgi.py manage-script-name = true logto = /usr/local/sp_pf/logs/uwsgi-mysite.log processes = 1 threads = 8 master = true thunder-lock = true buffer-size = 32768 harakiri = 1500 (sample371) [root@cent75 uwsgi-2.0.18]# pyenv deactivate □ Step 8-3 Edit the uWSGI server initialization file
  • 11. [root@cent75 mysite]# cd /usr/local/sp_pf/mysite [root@cent75 mysite]# python manage.py createsuperuser Username (leave blank to use 'root'): jppf Email address: Password: jppfpasswd Password (again): jppfpasswd Superuser created successfully. □ Step 8-4 Create an application admin user [root@cent75 mysite]# vi /etc/systemd/system/mysite.service [Unit] Description=bert service server [Service] ExecStart=/usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini [Install] WantedBy=multi-user.target [root@cent75 mysite]# systemctl enable mysite.service Created symlink from /etc/systemd/system/multi-user.target.wants/mysite.service to /etc/systemd/system/mysite.service. □ Step 8-5 Creating system unit files
  • 12. [root@cent75 mysite]# systemctl start mysite [root@cent75 mysite]# systemctl status mysite ● mysite.service - bert service server Loaded: loaded (/etc/systemd/system/mysite.service; enabled; vendor preset: disabled) Active: active (running) since 土 2020-05-16 11:40:52 JST; 1s ago Main PID: 16760 (uwsgi) Tasks: 9 CGroup: /system.slice/mysite.service tq16760 /usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini mq16765 /usr/local/bin/uwsgi --die-on-term --ini /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini 5月 16 11:40:52 cent75 systemd[1]: Started bert service server. 5月 16 11:40:52 cent75 uwsgi[16760]: [uWSGI] getting INI configuration from /usr/local/sp_pf/environment/uwsgi-ini/mysite.ini □ Step 8-6 Startup application server [root@cent75 mysite]# tail -f /usr/local/sp_pf/logs/uwsgi-mysite.log your mercy for graceful operations on workers is 60 seconds mapped 750976 bytes (733 KB) for 8 cores *** Operational MODE: threaded *** mounting mysite/wsgi.py on /mysite WSGI app 0 (mountpoint='/mysite') ready in 0 seconds on interpreter 0x119f8c0 pid: 16760 (default app) uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 16760) spawned uWSGI worker 1 (pid: 16765, cores: 8)
  • 13. [root@cent75 mysite]# vi /etc/nginx/conf.d/mysite.conf server { listen 80; server_name 192.168.1.202; # <= server ip # mysite server static location /mysite/ { uwsgi_read_timeout 1500; uwsgi_pass unix:///usr/local/sp_pf/socket/mysite.sock; include uwsgi_params; } # mysite server static location /mysite_static { alias /usr/local/sp_pf/mysite/mysite_static; } } □ Step 9-1 Make conection between NGINX and uWSGI