Arborescence des pages

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte root
[root@ts-sun-videoroot ~]# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
[root@ts-sun-videoroot ~]# yum update
[root@ts-sun-videoroot ~]# yum install -y python36u python36u-libs python36u-devel python36u-pip
[root@ts-sun-videoroot ~]# python3.6 -V

Requêtes annexes en lien avec pip

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte root
# Pour vérifier la version
[root@ts-sun-videoroot ~]# python3.6 -m pip -V
# Pour mettre à jour pip3
[root@ts-sun-videoroot ~]# python3.6 -m pip install --upgrade pip
# Pour vérifier la version 
[root@ts-sun-videoroot ~]# pip3 -V
 # Autant installer les autres packages, utiles pour la reprise de l'existant
[root@ts-sun-videoroot ~]# pip3 install requests
[root@ts-sun-videoroot ~]# pip3 install request
[root@ts-sun-videoroot ~]# pip3 install wget

Par la suite, pour utiliser la nouvelle version de pip, il est nécessaire d'utiliser - en lieu et place de la commande pip :

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte root
[root@ts-sun-videoroot ~]# cd /data/www/%userpod%
[root@ts-sun-videoroot /data/www/%userpod%]# pip3 install virtualenvwrapper

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod% ~]$ cd
[%userpod%@ts-sun-video%userpod% ~]$ emacs .bashrc

Si besoin, commenter les anciennes lignes, puis ajouter ces quelques lignes en fin de fichier :

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod% ~]$ source .bashrc

Et créer un nouvel environnement virtuel :

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod% ~]$ cd /data/www/%userpod%
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%]$ mkvirtualenv --system-site-packages --python=/usr/bin/python3.6 django_pod

...

Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod% ~]$ cd
[%userpod% ~]$ ln -s /data/www/%userpod%/django_projects django_projects

...

?? S'il y a besoin de supprimer un ancien lien symbolique existant, penser à faire - sous root - : unlink django_projects


Récupérer les sources :
Bloc de code
languagebash
themeMidnight
titleServeur(s) Pod / Compte %userpod%
[%userpod% ~]$ cd /data/www/%userpod%/django_projects
[%userpod% /data/www/%userpod%/django_projects]$ git clone https://github.com/esupportail/podv2.git

...

Bloc de code
languagebash
[root@ts-sun-videoroot]# yum install mod_wsgi
[root@ts-sun-videoroot]# yum install expat-devel
[root@ts-sun-videoroot]# yum install httpd-devel
[root@ts-sun-videoroot]# yum install python36u-mod_wsgi
[root@ts-sun-videoroot]# # ATTENTION: nouveau fichier créé /etc/httpd/conf.modules.d/10-wsgi-python3.6.conf
[root@ts-sun-videoroot]# # Configurer 10-wsgi.conf
[root@ts-sun-videoroot]# # Configurer pod.conf
[root@ts-sun-videoroot]# chmod 755 /data/www/%userpod%/django_projects/podv2/pod/wsgi.py

[%userpod%@ts-sun-video][/data/www/%userpod%/django_projects/podv2]# pip3 install requests

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte root
[root@ts-sun-videoroot]# yum install --enablerepo=epel nginx
[root@ts-sun-videoroot]# emacs /etc/nginx/nginx.conf # vérifier que include /etc/nginx/conf.d/*.conf n'est pas en commentaire. Ne pas configurer d'adresse IP ni de server_name.
[root@ts-sun-videoroot]# systemctl start nginx
[root@ts-sun-videoroot]# systemctl enable nginx

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod%]# cd /data/www/%userod%/django_projects/podv2/
# Copie du fichier
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%/django_projects/podv2]# cp pod_nginx.conf pod/custom/.
# EditionÉdition du nouveau fichier
[%userpod%@ts-sun-video%userpod /data/www/%userpod%/django_projects/podv2]# emacs pod/custom/pod_nginx.conf
# Création d'un lien symbolique, directement dans le répertoire de Nginx
[%userpod%@ts-sun-video%userpod /data/www/%userpod%/django_projects/podv2]# sudo ln -s /data/www/%userpod%/django_projects/podv2/pod/custom/pod_nginx.conf /etc/nginx/conf.d/pod_nginx.conf
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%/django_projects/podv2]# sudo /etc/init.d/nginxsystemctl restart nginx


Voici le contenu du fichier pod_nginx.conf UM :

Bloc de code
languagetext
titleServeur(s) Pod / Fichier pod_nginx.conf (ompte %userpod%)
# mysite_nginx.conf
# Add this line in /etc/nginx/nginx.conf
#http {
#    [...]
#    # reserve 1MB under the name 'uploads' to track uploads
#    upload_progress uploadp 1m;
#    [...]
#}
# the upstream component nginx needs to connect to
upstream podupstream {
    server unix:///data/www/%userpod%/django_projects/podv2/uwsgi/podv2.sock max_fails=2 fail_timeout=3s;
}

# configuration of the server
server {
    # the port your site will be served on
    listen      80;
    # the domain name it will serve for
    server_name xxxxx.umontpellier.fr; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 4G;   # adjust to taste

    #location ^~ /video_edit {
    #    track_uploads uploadp 30s
    #}

    #location ^~ /progressbarupload/upload_progress {
        # JSON document rather than JSONP callback, pls
    #    upload_progress_json_output;
    #    report_uploads uploadp;
    #}

    # Django media
    location /media  {
        alias /data/www/%userpod%/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /data/www/%userpod%/django_projects/podv2/pod/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  podupstream;
        include     /data/www/%userpod%/django_projects/podv2/uwsgi_params;
        #track_uploads uploadp 30s;	
    }
}

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte root
[%userpod%@ts-sun-videoroot]# cd /data/www/%userod%/django_projects/podv2/
[%userpod%@ts-sun-videoroot /data/www/%userpod%/django_projects/podv2]# sudo pip3 install uwsgi

Configuration uWSGI

...

Bloc de code
languagetext
titleServeur(s) Pod / Fichier pod_uwsgi.ini (compte %userpod%)
# pod_uwsgi.ini file
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /data/www/%userpod%/django_projects/podv2
# Django's wsgi file
module          = pod.wsgi
#module          = pod.wsgi:application
# the virtualenv (full path)
home            = /data/www/%userpod%/.virtualenvs/django_pod
# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe)
socket          = /data/www/%userpod%/django_projects/podv2/uwsgi/podv2.sock
chown-socket 	= podtest:nginx
# ... with appropriate permissions - may be needed
#chmod-socket    = 666
chmod-socket    = 666
# clear environment on exit
vacuum          = true
#
daemonize		= /data/www/%userpod%/django_projects/podv2/uwsgi/uwsgi-pod.log
#
die-on-term		= true
limit-as 		= 5120
max-requests	= 5000

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod%]# cd
[%userpod%@ts-sun-video%userpod% /home/%userpod%]# source .bashrc
[%userpod%@ts-sun-video%userpod% /home/%userpod%]# cd /data/www/%userpod%/django_projects/podv2
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%/django_projects/podv2]# workon django_pod
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2]# /usr/bin/uwsgi --ini /data/www/%userpod%/django_projects/podv2/pod/custom/pod_uwsgi.ini --enable-threads --uid %userpod% --gid nginx --pidfile /data/www/%userpod%/django_projects/podv2/uwsgi/pod.pid

...

Bloc de code
languagebash
titleServeur(s) Pod / Compte %userpod%
[%userpod%@ts-sun-video%userpod%]# cd
[%userpod%@ts-sun-video%userpod% /home/%userpod%]# source .bashrc
[%userpod%@ts-sun-video%userpod% /home/%userpod%]# cd /data/www/%userpod%/django_projects/podv2
[%userpod%@ts-sun-video%userpod% /data/www/%userpod%/django_projects/podv2]# workon django_pod
(django_pod) [%userpod%@ts-sun-video%userpod%][/data/www/%userpod%/django_projects/podv2]# /usr/bin/uwsgi --stop /data/www/%userpod%/django_projects/podv2/uwsgi/pod.pid

...

Bloc de code
languagebash
titleMise en service uwsgi-pod (compte root)
[root@ts-sun-videoroot ~]# systemctl daemon-reload
[root@ts-sun-videoroot ~]# systemctl enable uwsgi-pod.service

...