CentOS7下的Django2集成部署一:部署环境

  • 达成目标
    • 最近稍微接触了点持续集成,实验过程中再次把django的部署又捋了一遍,有了些新的认识,于是就决定记录一下本次实验过程。
    • 实验成果如下,后面几篇将重新部署在一台新的客户机上面,再次把这周的实验过程再现下,加深下记忆
  • 实验部署环境
    1. 操作系统
      1. 主要有2台机器,配置相同。gitlab在my-ct75222客户机上,其他的都在my-ct76211上面,后面试下放在一台客户机上试下
        #my-ct76211
        [root@my-ct76211 ~]# cat /etc/redhat-release 
        CentOS Linux release 7.6.1810 (Core) 
        #my-ct75222
        [root@my-ct75222 ~]# cat /etc/redhat-release 
        CentOS Linux release 7.5.1804 (Core)
    2. nginx
      [root@my-ct76211 ~]# nginx -v
      nginx version: nginx/1.14.2
    3. mysql
      [root@my-ct76211 ~]# mysql --version
      mysql  Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using  EditLine wrapper
    4. python
      [root@my-ct76211 ~]# python3
      Python 3.7.1 (default, Dec 10 2018, 16:20:35) 
      [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> 
    5. uwsgi
      [root@my-ct76211 ~]# pip3 show uwsgi
      Name: uWSGI
      Version: 2.0.17.1
      Summary: The uWSGI server
      Home-page: https://uwsgi-docs.readthedocs.io/en/latest/
      Author: Unbit
      Author-email: info@unbit.it
      License: GPLv2+
      Location: /usr/local/lib/python3.7/site-packages
      Requires: 
      Required-by: 
    6. virtualenv
      [root@my-ct76211 ~]# pip3 show virtualenv
      Name: virtualenv
      Version: 16.1.0
      Summary: Virtual Python Environment builder
      Home-page: https://virtualenv.pypa.io/
      Author: Ian Bicking
      Author-email: ianb@colorstudy.com
      License: MIT
      Location: /usr/local/lib/python3.7/site-packages
      Requires: 
      Required-by: 
    7. jenkins
      [root@my-ct76211 ~]# rpm -qa jenkins
      jenkins-2.99-1.1.noarch
    8. gitlab-ce
      [root@my-ct75222 ~]# rpm -qa gitlab-ce
      gitlab-ce-10.2.2-ce.0.el7.x86_64
    • my-blog的pip list  
      [root@my-ct76211 ~]# source python-envs/py3web/bin/activate
      (py3web) [root@my-ct76211 ~]# pip list
      Package                Version   
      ---------------------- ----------
      asn1crypto             0.24.0    
      certifi                2018.11.29
      cffi                   1.11.5    
      chardet                3.0.4     
      cryptography           2.4.2     
      Django                 2.1.4     
      django-ranged-response 0.2.0     
      django-simple-captcha  0.5.9     
      django-summernote      0.8.11.1  
      idna                   2.8       
      Pillow                 5.3.0     
      pip                    18.1      
      pycparser              2.19      
      PyMySQL                0.9.2     
      pytz                   2018.7    
      setuptools             40.6.2    
      six                    1.12.0    
      urllib3                1.24.1    
      wheel                  0.32.3    
    • 整体环境前提是关闭firewalld和selinux 
      systemctl stop firewalld
      systemctl disabled firewalld
      setenforce 0
      vim /etc/sysconfig/selinux
      # This file controls the state of SELinux on the system.
      # SELINUX= can take one of these three values:
      #     enforcing - SELinux security policy is enforced.
      #     permissive - SELinux prints warnings instead of enforcing.
      #     disabled - No SELinux policy is loaded.
      SELINUX=disabled
      # SELINUXTYPE= can take one of three two values:
      #     targeted - Targeted processes are protected,
      #     minimum - Modification of targeted policy. Only selected processes are protected. 
      #     mls - Multi Level Security protection.
      SELINUXTYPE=targeted
         
原文地址:https://www.cnblogs.com/zhujingxiu/p/10119254.html