SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Django deployment and
RPM+YUM
by Walter Liu
Agenda
● Apache, WSGI, Django
● Django deployment/security note
● Using RPM and YUM
Apache+WSGI+Django
Why use Apache?

runserver is not stable
WSGI

Web
Server
Gateway
Interface
Apache, WSGI, Django
Apache contain multi WSGI
Example WSGI parameters
TraceEnable Off
WSGIScriptAlias / /var/www/html/axx_service/wsgi.py
WSGIPythonPath /var/www/html/axx_service/
WSGISocketPrefix /var/run/wsgi
WSGIProcessGroup axxais
WSGIDaemonProcess axxais processes=4 threads=16 maximum-requests=4096 display-name=%{GROUP}
# no embedded mode for WSGI. for smaller memory and log message.
WSGIRestrictEmbedded on
<Directory "/var/www/html/axx_service/">
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
Questions?
Django deployment note
Deployment note
●
●
●
●
●
●
●

DEBUG = False
TEMPLATE_DEBUG = False
404 template
500 template
Host static files
Error alert e-mail (ADMINS, MANAGERS)
Logging settings
Apache+wsgi: Host static files
Alias /robots.txt /usr/local/wsgi/static/robots.txt
Alias /favicon.ico /usr/local/wsgi/static/favicon.ico
AliasMatch /([^/]*.css) /usr/local/wsgi/static/styles/$1
Alias /media/ /usr/local/wsgi/static/media/
<Directory /usr/local/wsgi/static>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /usr/local/wsgi/scripts/myapp.wsgi
<Directory /usr/local/wsgi/scripts>
Order allow,deny
Allow from all
</Directory>
Django Security note
●
●
●
●

SQL Injection protection (ORM)
XSS protection
Csrf protection (middleware)
Clickjacking protection
(middleware, default off)
● Possible weak points
○ Weak admin password
○ DEBUG = True
○ Secret Key
Questions?
Using RPM and YUM
Deployment is ?
●
●
●
●
●
●
●
●
●

ssh to each host
copy files
remove files
check file integrity
[option] config file upgrade
[option] POST: restart httpd
[option] check service/security status
[option] mock test
.......
Using git?
● No remove files.
(may lead to accidents)
● No other script action in update.
● Config files?
● Version report?
(at least not easy to read.)
● Not for OPS
● No package dependency
● Not scalable for large deployment
Using RPM
●
●
●
●

Ensure package version.
Add/remove/update files.
Pre/Post installation scripting.
YUM for remote and repository
How to create RPM
● Prepare *.spec file
● Use rpmbuild to build rpm. (refer AIS)
RPM SPEC File
rpmbuild script
YUM server and repo RPM
Now, setup a YUM server + repo RPM, and you
may
● yum install pitlane
● yum install pitlane-worker
● yum update pitlane
● #rollback version
with
● Auto-dependency
What left?
Concurrent command to
hosts
omnitty vs. ssh-keygen
● omnitty
● ssh-key and scripting
● fabric + ssh-key
Omnitty
sshkey + scripting
Example:
pitlane_web.py update
-> host_list = ......
-> for host in host_list:
->
os.system("ssh $s yum update pitlane")
How

● generate ssh public key
● copy/cat to target host .ssh/authorized_key
Fabric
Based on sshkey
Made for deployment.
Q&A

Contenu connexe

Tendances

Useful Vim Plugins
Useful Vim PluginsUseful Vim Plugins
Useful Vim Plugins
anveo
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
WO Community
 
EuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD SystemsEuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD Systems
Vinícius Zavam
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
Anatoly Bubenkov
 

Tendances (20)

Devenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.jsDevenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.js
 
Porting Puppet to OpenBSD
Porting Puppet to OpenBSD Porting Puppet to OpenBSD
Porting Puppet to OpenBSD
 
Ch2.setup.node.and.npm
Ch2.setup.node.and.npmCh2.setup.node.and.npm
Ch2.setup.node.and.npm
 
Libvirt API Certification
Libvirt API CertificationLibvirt API Certification
Libvirt API Certification
 
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGIEuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
EuroPython 2014 - How we switched our 800+ projects from Apache to uWSGI
 
Useful Vim Plugins
Useful Vim PluginsUseful Vim Plugins
Useful Vim Plugins
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for Beginners
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
 
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngineOhio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
Ohio Linux Fest 2013: Provisioning VMs Quickly with Vagrant and CFEngine
 
Docker and fig for dev
Docker and fig for devDocker and fig for dev
Docker and fig for dev
 
Vagrant
VagrantVagrant
Vagrant
 
EuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD SystemsEuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD Systems
 
Installing nagios core_from_source
Installing nagios core_from_sourceInstalling nagios core_from_source
Installing nagios core_from_source
 
Git hooks
Git hooksGit hooks
Git hooks
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easy
 
DevOps Series: Defining and Sharing Testable Machine Configurations with vagrant
DevOps Series: Defining and Sharing Testable Machine Configurations with vagrantDevOps Series: Defining and Sharing Testable Machine Configurations with vagrant
DevOps Series: Defining and Sharing Testable Machine Configurations with vagrant
 
Using the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLIUsing the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLI
 
Git hooks
Git hooksGit hooks
Git hooks
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
 
Node.js x Azure, cli usage, website deployment
Node.js x Azure, cli usage, website deploymentNode.js x Azure, cli usage, website deployment
Node.js x Azure, cli usage, website deployment
 

Similaire à Django deployment and rpm+yum

Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
Marcus Sá
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
rkhatibi
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
Arpad Szasz
 
Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012
Yuji Takayama
 

Similaire à Django deployment and rpm+yum (20)

Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginxMultiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
 
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet System
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Turbo charge your logs
Turbo charge your logsTurbo charge your logs
Turbo charge your logs
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
 
0507 057 01 98 * Adana Klima Servisleri
0507 057 01 98 * Adana Klima Servisleri0507 057 01 98 * Adana Klima Servisleri
0507 057 01 98 * Adana Klima Servisleri
 
Shall we play a game
Shall we play a gameShall we play a game
Shall we play a game
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
 
We shall play a game....
We shall play a game....We shall play a game....
We shall play a game....
 
NodeJS
NodeJSNodeJS
NodeJS
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
 
Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012
 

Plus de Walter Liu

Salty OPS – Saltstack Introduction
Salty OPS – Saltstack IntroductionSalty OPS – Saltstack Introduction
Salty OPS – Saltstack Introduction
Walter Liu
 
Service production from d3 pitfall viewpoint
Service production from d3 pitfall viewpointService production from d3 pitfall viewpoint
Service production from d3 pitfall viewpoint
Walter Liu
 

Plus de Walter Liu (18)

Generative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdfGenerative AI 在手機遊戲發行上的應用介紹.pdf
Generative AI 在手機遊戲發行上的應用介紹.pdf
 
Infrastructure as code using Kubernetes
Infrastructure as code using KubernetesInfrastructure as code using Kubernetes
Infrastructure as code using Kubernetes
 
手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談手機遊戲數位行銷工具淺談
手機遊戲數位行銷工具淺談
 
關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒關於第三方追蹤廣告再行銷的那些事兒
關於第三方追蹤廣告再行銷的那些事兒
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
 
Using Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCPUsing Kubernetes to deploy Django in GCP
Using Kubernetes to deploy Django in GCP
 
Game DDOS Prevention
Game DDOS PreventionGame DDOS Prevention
Game DDOS Prevention
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
 
Super Fast Gevent Introduction
Super Fast Gevent IntroductionSuper Fast Gevent Introduction
Super Fast Gevent Introduction
 
HTTP/2 to web dev
HTTP/2 to web devHTTP/2 to web dev
HTTP/2 to web dev
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
Consul - service discovery and others
Consul - service discovery and othersConsul - service discovery and others
Consul - service discovery and others
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
WRS GIT Branching Model - draft
WRS GIT Branching Model - draftWRS GIT Branching Model - draft
WRS GIT Branching Model - draft
 
Salty OPS – Saltstack Introduction
Salty OPS – Saltstack IntroductionSalty OPS – Saltstack Introduction
Salty OPS – Saltstack Introduction
 
Game Localization in Python
Game Localization in PythonGame Localization in Python
Game Localization in Python
 
Service production from d3 pitfall viewpoint
Service production from d3 pitfall viewpointService production from d3 pitfall viewpoint
Service production from d3 pitfall viewpoint
 
Celery in the Django
Celery in the DjangoCelery in the Django
Celery in the Django
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Django deployment and rpm+yum