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

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
issue101:c_c [2015/10/03 20:20] erlevoissue101:c_c [2015/10/05 17:50] (Version actuelle) auntiee
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.**
  
-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 cible. C'est essentiellement ce que Vagrant propose. C'est un outil qui crée un fichier de configuration pour un serveur – les spécifications, l'OS, ce qu'il faut installer et les liens vers les sources (telles que des ISOs). 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.+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 cible. C'est essentiellement ce que Vagrant propose. C'est un outil qui crée un fichier de configuration pour un serveur les spécifications, l'OS, ce 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.
  
 **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 development, where certain combinations of software and OSes, or 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.** **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 development, where certain combinations of software and OSes, or 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.**
  
-Maintenant… vous pourriez vous demander pourquoi ne pas le faire à 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.+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 Vagrantfile (et probablement les fichiers source) et les autres membres de l'équipe pourront démarrer rapidement.
  
 **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 projects, this 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!** **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 projects, this 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!**
  
-Vagrant gère aussi certaines particularités – telles qu'installer un invité et ses options, permettre l'accès SSH et beaucoup d'autres aspects particuliers. Il 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 local. Pour tous ceux qui utilisent une installation Apache locale et des hôtes virtuels pour leur projet internet, c'est une façon de créer des machines virtuelles sur vos serveurs. Utiliser le logiciel va vous aider pour le déploiement. Si vous, comme moi, avez tendance à détruire les machines virtuelles au moment où vous n'en avez plus besoin parce qu'elles monopolisent votre espace disque, Vagrant est parfait. Vous conservez simplement le fichier Vagrant et effacez tous le reste. Économie d'espace !+Vagrant gère aussi certaines particularitéstelles qu'installer un invité et ses options, permettre l'accès SSH et divers autres aspects. Il 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 local. Pour tous ceux qui utilisent une installation Apache locale et des hôtes virtuels pour leur projet Internet, c'est une façon de créer des machines virtuelles sur vos serveurs. Utiliser le logiciel va vous aider pour le déploiement. Si vous, comme moi, avez tendance à détruire les machines virtuelles au moment où vous n'en avez plus besoin parce qu'elles monopolisent votre espace disque, Vagrant est parfait. Vous conservez simplement le Vagrantfile et effacez tous le reste. Économie d'espace !
  
 **How does it work?** **How does it work?**
Ligne 17: Ligne 17:
 **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 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. Dans 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.+Vagrant doit être installé (c'est un outil qui utilise la ligne de commande)de même que VirtualBox. Sous Ubuntuc'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.** **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/), ou 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 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 Vagrant init FIXME LA COMMANDE INIT DE VAGRANT ? Et d'ajuster le fichier Vagrant créé par défaut pour satisfaire vos besoins.+Une fois que Vagrant est installé, vous pouvez soit télécharger un Vagrantfile (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'instantnous allons nous focaliser sur le scénario le plus commun qui consiste à utiliser un Vagrantfile 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 Vagrantfile créé par défaut pour satisfaire vos besoins.
  
 **Getting started** **Getting started**
  
-commençons+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.** **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 préfabriqué nommé django-python3-vagrant. Voir le lien dans les lectures complémentaires en fin d'article.+Pour les besoins de cet article, j'utiliserai un Vagrantfile préfabriqué nommé « django-python3-vagrant ». Voir le lien dans les lectures complémentaires en fin d'article.
  
 **Download the file:** **Download the file:**
  
-Télécharger le fichier :+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**
Ligne 44: Ligne 44:
  
 **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 !**
  
-Malheureusement ce fichier Vagrant a été écrit pour Utopic – qui ne se trouve plus sur les serveurs Ubuntu. Il va donc falloir éditer le fichier Vagrant !+Malheureusementce Vagrantfile a été écrit pour Utopicqui ne se trouve plus sur les serveurs Ubuntu. Il va donc falloir éditer le Vagrantfile !
  
 **On line 6, you’ll want to change the line from “django_config.vm.box = "utopic64"” to “django_config.vm.box = "trusty64"”.** **On line 6, you’ll want to change the line from “django_config.vm.box = "utopic64"” to “django_config.vm.box = "trusty64"”.**
Ligne 55: Ligne 57:
 **Replace line 10 with the following:** **Replace line 10 with the following:**
  
-Remplacez la ligne 10 avec ce qui suit :+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"**
Ligne 61: Ligne 63:
 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
  
-**Once that command finishes running, you can log into the VM using** +Once that command finishes running, you can log into the VM using
- +
-**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** 
  
 +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 :  Là vous allez devoir exécuter : 
Ligne 77: Ligne 78:
 vagrant up vagrant up
  
-Quand cette commande se termine, vous allez pouvoir entrer dans la machine virtuelle en tapant:+Quand cette commande se termine, vous pourrez entrer dans la machine virtuelle en tapant :
  
 vagrant ssh vagrant ssh
  
-Une fois connecté, vous allez être 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 effective du serveur. Trouvez-la en utilisant ipconfig. Par exemple : python manage.py runserver 192.168.1.200:8000+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. **After that, you can access the django instance using the IP address of the server.
Ligne 107: Ligne 108:
 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 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 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.**+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 : 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 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)+ 
 +vous lancez les commandes vagrant depuis le dossier qui contient le Vagrantfile.
  
-Normalement ce 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 suggestion 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.+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 Vagrantfile 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.
  
  
 **Further Reading** **Further Reading**
  
-Lectures complémentaires :+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.1443896423.txt.gz · Dernière modification : 2015/10/03 20:20 de erlevo