Outils pour utilisateurs

Outils du site


issue101:c_c

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
Dernière révisionLes deux révisions suivantes
issue101:c_c [2015/09/28 23:57] – créée d52frissue101:c_c [2015/10/05 13:49] d52fr
Ligne 1: Ligne 1:
-For any reader who has ever developed anything that needed to be tested or run on a system outside of the local development server or workstation, you’ve probably hoped for an easy way to control a test environment, or to emulate the target server.  This is essentially what vagrant wants to offer.  It’s a tool that creates a configuration file for a server - specifications, OS, what to install, and links to the sources (such as ISOs).  This is then run through vagrant, which created a VirtualBox virtual machine running everything outlined in the vagrant file.+**For any reader who has ever developed anything that needed to be tested or run on a system outside of the local development server or workstation, you’ve probably hoped for an easy way to control a test environment, or to emulate the target server.  This is essentially what vagrant wants to offer.  It’s a tool that creates a configuration file for a server - specifications, OS, what to install, and links to the sources (such as ISOs).  This is then run through vagrant, which created a VirtualBox virtual machine running everything outlined in the vagrant file.**
  
-Now...you may be asking yourself why you wouldn’t just do this by hand?  If you’re going to need the development server on and off (such as web developmentwhere certain combinations of software and OSesor particular versions are common), or if you need to be able to pass the exact development environment to other people Such as when working in a team.  This way, you can just share the vagrantfile (and, possibly, the source files), and the other team members will be up and running swiftly.+Pour tous les lecteurs qui ont développé quelque chose qui a besoin d'être testé sur un système extérieur au serveur de développement local ou à la station de travail, vous avez probablement rêvé d'une façon simple de contrôler un environnement de test ou d'émuler le serveur cibleC'est essentiellement ce que Vagrant proposeC'est un outil qui crée un fichier de configuration pour un serveur : les spécificationsl'OSce qu'il faut installer et les liens vers les sources (telles que des ISO). On l'essaie alors via Vagrant qui crée une machine virtuelle VirtualBox qui va exécuter tout ce qui est listé dans le fichier Vagrant.
  
-Vagrant also handles certain aspects - such as installing guest additions, enabling SSH access, and various other aspects.  It also ensures the networking interface is bridged, so that you can access software running on the server from your local network.  For anyone who uses a local Apache install and virtual hosts for their web projectsthis is one way of creating virtual machines of your server.  Running the actual software you’ll encounter on deployment.  If youlike metend to delete virtual machines the moment you’re done with them because they’re hogging your hard drive space, Vagrant is perfect match.  Keep the vagrantfile, and delete everything else Space saved!+**Now...you may be asking yourself why you wouldn’t just do this by hand?  If you’re going to need the development server on and off (such as web developmentwhere certain combinations of software and OSesor particular versions are common)or if you need to be able to pass the exact development environment to other people.  Such as when working in team.  This way, you can just share the vagrantfile (and, possibly, the source files), and the other team members will be up and running swiftly.**
  
-How does it work?+Maintenant… vous pourriez vous demander pourquoi ne pas le faire tout simplement à la main Si vous allez avoir besoin d'allumer et d'éteindre le serveur de développement (tel qu'un développement sur le Web, où certaines combinaisons de logiciels et d'OS, ou des versions particulières sont fréquentes) ou si vous avez besoin de transmettre l'environnement de développement exact à d'autres personnes, dans un travail en équipe, vous pourrez alors juste échanger le fichier Vagrant (et probablement les fichiers source) et les autres membres de l'équipe pourront démarrer rapidement.
  
-Vagrant must be installed (it’s a command-line tool), as well as VirtualBox.  In Ubuntu it’s as simple as sudo apt-get install vagrant virtualbox.  If you’re using different host OS, you’ll need to check how best to install them.+**Vagrant also handles certain aspects such as installing guest additions, enabling SSH access, and various other aspects.  It also ensures the networking interface is bridged, so that you can access software running on the server from your local network.  For anyone who uses local Apache install and virtual hosts for their web projectsthis is one way of creating virtual machines of your server.  Running the actual software you’ll encounter on deployment.  If you, like me, tend to delete virtual machines the moment you’re done with them because they’re hogging your hard drive space, Vagrant is a perfect match Keep the vagrantfile, and delete everything else.  Space saved!**
  
-Once Vagrant is installedyou can either download a Vagrantfile (there are many posted on githubor on http://www.vagrantbox.es/)or create one yourself Creating one on your own is something I haven’t yet done As suchwe’ll focus on the more common scenario of using a pre-built Vagrantfile.  If there is interest in creating custom Vagrantfilessend me an emailand I will follow up this article at a later date A rough scenario is using vagrant init, and then adjusting the default Vagrantfile to suit your needs.+Vagrant gère aussi certaines particularitéstelles qu'installer un invité et ses optionspermettre l'accès SSH et divers autres aspectsIl assure aussi que l'interface réseau est reliée et que vous pourrez donc accéder à des logiciels tournant sur le serveur depuis votre réseau localPour tous ceux qui utilisent une installation Apache locale et des hôtes virtuels pour leur projet Internetc'est une façon de créer des machines virtuelles sur vos serveursUtiliser le logiciel va vous aider pour le déploiementSi vouscomme moiavez tendance à détruire les machines virtuelles au moment où vous n'en avez plus besoin parce qu'elles monopolisent votre espace disqueVagrant est parfaitVous conservez simplement le fichier Vagrant et effacez tous le resteÉconomie d'espace !
  
-Getting started+**How does it work?**
  
-For the sake of this article, I’ll be using a prebuilt Vagrantfile called “django-python3-vagrant”.  See the Further Reading for a link.+Comment cela fonctionne-t-il ?
  
-Download the file:+**Vagrant must be installed (it’s a command-line tool), as well as VirtualBox.  In Ubuntu it’s as simple as sudo apt-get install vagrant virtualbox.  If you’re using a different host OS, you’ll need to check how best to install them.** 
 + 
 +Vagrant doit être installé (c'est un outil qui utilise la ligne de commande), de même que VirtualBox. Sous Ubuntu, c'est aussi simple que sudo apt-get install vagrant virtualbox. Si vous utilisez une autre distribution, vous devrez chercher la meilleure façon de les installer. 
 + 
 +**Once Vagrant is installed, you can either download a Vagrantfile (there are many posted on github, or on http://www.vagrantbox.es/), or create one yourself.  Creating one on your own is something I haven’t yet done.  As such, we’ll focus on the more common scenario of using a pre-built Vagrantfile.  If there is interest in creating custom Vagrantfiles, send me an email, and I will follow up this article at a later date.  A rough scenario is using vagrant init, and then adjusting the default Vagrantfile to suit your needs.** 
 + 
 +Une fois que Vagrant est installé, vous pouvez soit télécharger un fichier Vagrant (on en trouve beaucoup sur github ou sur http://www.vagrantbox.es/), soit en créer un vous-même. Créer son propre fichier est quelque chose que je n'ai pas encore fait. Pour l'instant, nous allons nous focaliser sur le scénario le plus commun qui consiste à utiliser un fichier Vagrant existant. Si utiliser son propre fichier Vagrant présente quelque intérêt, envoyez-moi un courriel et j'écrirai une suite à cet article plus tard. Une approche basique consiste à utiliser la commande « vagrant init », puis d'ajuster le fichier Vagrant créé par défaut pour satisfaire vos besoins. 
 + 
 +**Getting started** 
 + 
 +Commençons 
 + 
 +**For the sake of this article, I’ll be using a prebuilt Vagrantfile called “django-python3-vagrant”.  See the Further Reading for a link.** 
 + 
 +Pour les besoins de cet article, j'utiliserai un fichier Vagrant préfabriqué nommé « django-python3-vagrant ». Voir le lien dans les lectures complémentaires en fin d'article. 
 + 
 +**Download the file:** 
 + 
 +Téléchargez le fichier : 
 + 
 +**git clone https://github.com/FlipperPA/django-python3-vagrant.git**
  
 git clone https://github.com/FlipperPA/django-python3-vagrant.git git clone https://github.com/FlipperPA/django-python3-vagrant.git
  
-Then cd into the folder:+**Then cd into the folder:** 
 + 
 +Puis déplacez-vous dans le dossier : 
 + 
 +**cd django-python3-vagrant**
  
 cd django-python3-vagrant cd django-python3-vagrant
  
-Unfortunately, this vagrantfile is geared towards utopic - which is no longer located on the Ubuntu server.  So, time to edit the Vagrantfile!+**Unfortunately, this vagrantfile is geared towards utopic - which is no longer located on the Ubuntu server.  So, time to edit the Vagrantfile !**
  
-On line 6you’ll want to change the line from “django_config.vm.box = "utopic64"” to “django_config.vm.box = "trusty64".+Malheureusementce fichier Vagrant a été écrit pour Utopic, qui ne se trouve plus sur les serveurs UbuntuIl va donc falloir éditer le fichier Vagrant !
  
-Replace line 10 with the following:+**On line 6, you’ll want to change the line from “django_config.vm.box = "utopic64"” to “django_config.vm.box = "trusty64"”.** 
 + 
 +En ligne 6 vous devrez modifier « jango_config.vm.box = "utopic64" » en « django_config.vm.box = "trusty64" » 
 + 
 +**Replace line 10 with the following:** 
 + 
 +Remplacez la ligne 10 par ce qui suit : 
 + 
 +**django_config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"**
  
 django_config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" django_config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
  
-Here, you need to run:+**Here, you need to run:
  
 vagrant up vagrant up
Ligne 39: Ligne 71:
 vagrant ssh vagrant ssh
  
-Upon login, you’ll be greeted by some instructions on creating a django project.  Follow them.  However, on the runserver step, you’ll need to replace 0.0.0.0:8000 with the actual IP of the server.  Find this using ipconfig.  For example: python manage.py runserver 192.168.1.200:8000 
  
-After that, you can access the django instance using the IP address of the server.+Upon login, you’ll be greeted by some instructions on creating a django project.  Follow them.  However, on the runserver step, you’ll need to replace 0.0.0.0:8000 with the actual IP of the server.  Find this using ipconfig.  For example: python manage.py runserver 192.168.1.200:8000** 
 + 
 +Là vous allez devoir exécuter :  
 + 
 +vagrant up 
 + 
 +Quand cette commande se termine, vous pourrez entrer dans la machine virtuelle en tapant : 
 + 
 +vagrant ssh 
 + 
 +Une fois connecté, vous serez accueilli par quelques instructions vous indiquant comment créer un projet django. Suivez-les. Toutefois, sur l'instruction runserver vous allez devoir remplacer 0.0.0.0:8000 par l'IP du serveur. Trouvez-la en utilisant ipconfig. Par exemple : python manage.py runserver 192.168.1.200:8000 
 + 
 +**After that, you can access the django instance using the IP address of the server.
  
 To stop the VM: To stop the VM:
Ligne 50: Ligne 93:
  
 To delete the VM: To delete the VM:
 +
 +vagrant destroy**
 +
 +Après cela vous pouvez accéder à l'instance de django en utilisant l'adresse IP du serveur.
 +
 +Pour arrêter la machine virtuelle (VM) :
 +
 +vagrant halt
 +
 +Dans les versions précédentes la commande était shutdown. Donc si halt ne fonctionne pas dans votre cas, essayez shutdown.
 +
 +Pour détruire la machine virtuelle : 
  
 vagrant destroy vagrant destroy
  
-If you run into issues, make sure of the following things: +**If you run into issues, make sure of the following things: 
-• You’re using the right IP in both your browser, and the runserver command. + 
-• You’re running the vagrant commands from the folder that contains the Vagrantfile+  • You’re using the right IP in both your browser, and the runserver command. 
 + 
 +  • You’re running the vagrant commands from the folder that contains the Vagrantfile 
 + 
 +Hopefully, this will be of use to anyone who need to frequently create the same (or similar) virtual machines.  If you have questions, comments, or suggestions, feel free to contact me at lswest34+fcm@gmail.com. Have a Vagrantfile you can’t live without?  Or a Vagrant tip that saves time?  Email them to me, and I’ll compile them into an article.** 
 + 
 +Si vous rencontrez des problèmes, assurez-vous des éléments suivants : 
 + 
 +- vous utilisez la bonne adresse IP à la fois dans votre navigateur et dans la commande runserver ; 
 + 
 +- vous lancez les commandes vagrant depuis le dossier qui contient le fichier Vagrant (Vagrantfile). 
 + 
 +Normalement, ceci devrait être utile pour toute personne qui a besoin de créer fréquemment la même machine virtuelle (ou une machine approchante). Si vous avez des questions, des commentaires ou des suggestions, n'hésitez pas à me contacter à lswest34+fcm@gmail.com. Vous avez un fichier Vagrant tout à fait indispensable ? Ou une astuce sur Vagrant qui permet de gagner du temps ? Envoyez-moi un courriel et je rassemblerai toutes ces idées dans un article.
  
-Hopefully, this will be of use to anyone who need to frequently create the same (or similar) virtual machines.  If you have questions, comments, or suggestions, feel free to contact me at lswest34+fcm@gmail.com. Have a Vagrantfile you can’t live without?  Or a Vagrant tip that saves time?  Email them to me, and I’ll compile them into an article. 
  
 +**Further Reading**
  
-Further Reading+Pour aller plus loin :
  
 https://github.com/FlipperPA/django-python3-vagrant - Vagrantfile https://github.com/FlipperPA/django-python3-vagrant - Vagrantfile
  
-http://vagrantbox.es - Prebuilt boxes+http://vagrantbox.es - des box pré-construites
  
-https://www.vagrantup.com/ - Vagrant homepage+https://www.vagrantup.com/page d'accueil de Vagrant
issue101/c_c.txt · Dernière modification : 2015/10/05 17:50 de auntiee