issue106:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue106:c_c [2016/03/09 11:32] – [1] frangi | issue106:c_c [2016/04/18 14:00] (Version actuelle) – créée andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ===== 1 ===== | + | **After having set up my intel NUC (see last month’s article for more information), I started using NGINX and Apache to serve my in-progress web projects. However, setting up various virtual hosts, managing it, and a complicated series |
- | ** | + | |
- | Near the end of January, I was informed that a local retailer would be receiving a shipment | + | |
- | Purpose | + | Après avoir installé mon NUC Intel (pour plus d' |
- | I ordered the taller model for the 2.5” drive, since I own a few spare drives, in case I need more storage space down the line. The goal is for this to become an “always-on” PC. It hosts a DNS for my internal network, a PXE boot server (for network booting ISOs), and will soon run NGINX + Apache. In order to help with my development work, it is now also hosting my Git repositories, | + | **What |
- | And, finally, I’ve also set it up with AwesomeWM (and GNOME3) | + | Docker is a way of creating virtualized containers |
- | I realize what some of you are probably thinking: “Can | + | While it’s difficult to explain the difference between Vagrant and Docker in layman’s terms (as much of the differences are in the details), there are some simple things |
- | ** | + | |
- | Vers la fin janvier, on m'a informé qu'un détaillant local allait recevoir une livraison de NUC6i5SYH (le mini-PC i5 NUC de Skylake avec un disque de 2,5”). J'en ai donc rapidement commandée un avec 16Go de RAM DDR4, un disque de 256 Go, et j'ai attendu à moitié patiemment qu'il soit livré. Dans cet article, je vais décrire pourquoi je l' | + | It does have to run on a Linux machine, but there are tools offered by Docker to easily set it up on Windows or Mac (using |
- | Le but | + | Qu' |
- | J'ai commandé le modèle plus grand pour le disque 2.5”, car j'ai déjà quelques disques de rechange, au cas où j' | + | Docker |
- | Et, finalement, j'ai installé AwesomeWM (et GNOME3) pour mon bureau. Deux écrans sont branchés dessus actuellement | + | Alors qu'il est difficile d' |
+ | Il doit fonctionner sur une machine Linux, mais Docker fournit des outils | ||
- | Je me rends compte que certains d' | ||
- | ** | + | **Setup |
- | The Setup | + | |
- | • 1 x Intel NUC6i5SYH | + | Docker containers can be assigned to various virtual networks, can expose ports, can run off specific images, and can share folders/ |
- | • 2 x 16GB Kingston HyperX Impact DDR4 SO-DIMM C13 2133 K2 | + | • Custom network (called “webnet”) |
- | • 1 x M.2 Samsung 850 EVO Basic 250GB SSD | + | • One Docker container running HAProxy, and exposing port 80. Also includes a static IP on webnet. |
- | • Running ArchLinux | + | • Multiple docker containers running the nickistre/ |
- | Peripherals: | + | I have set up dnsmasq with a catch-all DNS entry for all subdomains of home.lan. These get forwarded to the local machine at port 80 (which is, in turn, passed to the docker HAProxy machine). HAProxy is then used to check which subdomain it is, and (if configured) points it to the correct docker container’s static IP. |
- | • Anker 7-Port USB 3.0 HUB, connecting: | + | |
- | • Keyboard & Mouse | + | |
- | • MyBook 3TB | + | |
- | • USB surround sound audio card | + | |
- | I chose ArchLinux because I love the Arch User Repository, and it’s been my distribution of choice for many years. However, Ubuntu | + | To illustrate (pelican is a static site generator): pelican.home.lan points to 192.168.1.16 (local machine) via dnsmasq. Once the request arrives, HAProxy checks the configuration file, and then passes the request through to 172.18.0.4: |
- | ** | + | |
- | La Configuration | + | Installation |
- | • 1 x Intel NUC6i5SYH | + | Docker peut être affecté à différents réseaux virtuels, « exposer » des ports, faire tourner des images spécifiques, |
- | • 2 x 16Go Kingston HyperX Impact DDR4 SO-DIMM C13 2133 K2 | + | • Un réseau privé (appelé « webnet »). |
- | • 1 x SSD M.2 Samsung 850 EVO Basic 250 Go | + | • Un conteneur Docker utilisant HAProxy et « exposant » le port 80. Il inclut également une IP statique sur webnet. |
- | • Système ArchLinux | + | • De nombreux conteneurs Docker utilisant l' |
- | Péripheriques: | + | J'ai installé un dnsmasq avec une entrée DNS attrape-tout pour tous les sous-domaines de home.lan. Ils sont ensuite redirigés vers la machine locale au port 80 (qui à son tour le passe au HAProxy de la machine Docker). HAProxy vérifie alors de quel domaine il s' |
- | • Hub USB 3.0 7 Ports Anker, reliant: | + | |
- | • Clavier | + | |
- | • Disque MyBook 3To | + | |
- | • carte audio USB pour le son surround | + | |
- | J'ai choisi ArchLinux car j' | + | Pour illustrer (pelican |
+ | **What first? | ||
- | ===== 2 ===== | + | First, you’ll need to create the network you want to use. |
- | ** | + | |
- | My Thoughts | + | |
- | Overall, this device is pretty much what I expected. It’s quiet, quick, and graphically powerful enough to do everything I want (when the drivers work, at least). Not to mention small. Looking at the numbers doesn’t do it justice. It’s only about 2% wider/deeper than the coasters I keep on my desk, and the height (SYH model is 48mm, and SYK is 32mm) is really not that noticeable. Personally, if I was going to mount it to something thin using the vesa mount, I would take the SYK model. If you want to use the mount on something else (under a desk, on a wall, etc.) I think you’d be fine with either. That isn’t to say that I think the mount wouldn’t work with the taller model, I just find it may look odd, or make some smaller monitors too back-heavy. | + | docker network create --subnet=172.18.0.0/16 webnet |
- | For anyone concerned about noise - during the UEFI screen, the fans spin at full blast. To me, it’s | + | This creates a new network called webnet, with a possible IP range of 172.18.0.0 to 172.168.255.254. I won’t go into the specifics of the format used here. If you want to use a different IP range, just adjust the 172.18 part - it’s |
- | Nice bonus: | + | The reason why we need the custom network, is simply because |
- | ** | + | |
- | ** | + | Par où commencer ? |
- | Enough of the good - most people are probably interested in what it’s lacking. I don’t feel like the port options on the NUC are bad - I do feel like without a hub of some sort, you may run into issues (or simply not have any plugs free for thumb drives). That being said, I always prefer having a hub that I can position closer to me for ease of use (and they aren’t terribly expensive). That being said, there is one port I would have liked to have on the NUC. A USB Type-C Thunderbolt connector. According to rumor, the Skull Canyon model (core i7 model) should have one. Whether this is the case or not, we will have to wait and see. However, with the advent of type-c monitors with USB hubs and integrated power passthrough, | + | |
- | I’m sure some people would have preferred to see something besides a mini-displayport plug next to the HDMI. However, as someone who has owned and used a MacBook, I’ve grown accustomed to those adapters (not to mention having plenty lying around). | + | Il faut d' |
- | Lastly, design: I would have preferred the A/C adapter plug to be on the bottom edge of the device, instead of the top. However, based on the layout of the internals (and the mounting capabilities), | + | docker network create --subnet=172.18.0.0/16 webnet |
- | ** | + | |
+ | Cela crée un nouveau réseau appelé webnet avec des adresses IP allant de 172.18.0.0 jusqu' | ||
- | ** | + | La raison pour laquelle nous avons besoin d'un réseau particulier vient simplement du fait que le réseau par défaut de Docker ne permet pas d' |
- | The last negative thing I have to say about this setup isn’t really a knock at the device itself. Driver support. I realize that the Skylake processors are new, and as such, you can’t expect everything to run perfectly. That being said, having hardware acceleration enabled in the drivers currently causes my 4.4.1-2 kernel to crash. Not X, but the kernel itself. I’ve tried the 3 different acceleration methods (sna, uxa, and glamor), as well as disabling DRI (3d acceleration). I even tried to just enable DRI2. Nothing has completely solved the problem. Disabling 3d acceleration helped delay the crash, but it still occurred. Same with all the typical kernel boot options (intel_iommu=igfx_off, | + | |
- | Prior to publishing, I was able to find a fix that appears to work. Adding the kernel boot parameter i915.enable_rc6=0 seems to have solved the stability issues. It does disable powersaving in the i915 drivers, ensuring that the CPU is always running in high performance mode. However, I imagine this step will be necessary only temporarily, | + | **How do I go about creating my machines? |
- | ** | + | |
- | ===== 3 ===== | + | The standard docker command will pretty much always be the same. |
- | ** | + | |
- | Summary: | + | |
- | Pro | + | docker run -d -v {SHARE} --net webnet --ip 172.18.0.X --name {NAME} {IMAGE} |
- | Quiet | + | |
- | Powerful/ | + | |
- | Light and small | + | |
- | World power supply | + | |
- | Con | + | What it does: |
- | No USB Type-C | + | • ‘docker run’ fires up a container. |
- | Positioning of A/C port | + | • -d detaches the created container (otherwise all output from the container is automatically printed to the terminal, and closing the terminal will close the docker instance). |
- | Mini-Displayport (con for some) | + | • -v {SHARE} - specifies the shared folder, in the format |
+ | • --net webnet - configures which network the container should use. | ||
+ | • --ip 172.18.0.X - this is the static IP I’m assigning. I like to keep them in a basic order, in order to make adding HAProxy entries easier. If you chose a different IP range in the step above, adjust accordingly. | ||
+ | • --name {name} - this is the name the docker instance will be known as. For example --name pelican. This can be used in the docker start/ | ||
+ | • {IMAGE} - this is the image to use for the base of the container. I like the nickistre/ | ||
- | Overall, I’m extremely happy with the NUC. The driver issues are unfortunate, | + | Comment s'y prendre pour créer mes machines ? |
- | ** | + | |
- | ** | + | La commande standard de Docker sera toujours à peu près la même. |
- | Cost | + | |
- | I did not mention cost in this review at all. This is largely for two reasons: | + | docker run -d -v {SHARE} --net webnet --ip 172.18.0.X --name {NAME} {IMAGE} |
- | • Availability | + | |
- | • I chose the best performance/ | + | |
- | Bottom Line | + | Ce qu' |
+ | • « docker run » crée un conteneur. | ||
+ | • -d détache le conteneur créé (sinon toutes les sorties du conteneur seront automatiquement envoyées vers le terminal et la fermeture du terminal fermera l' | ||
+ | • -v{SHARE} donne l' | ||
+ | • --net webnet configure le réseau que doit utiliser le conteneur. | ||
+ | • --ip 172.18.0.X il s'agit de l'IP statique que je donne. J'aime les avoir bien organisés de façon à rendre plus facile l' | ||
+ | • --name{name} c'est le nom sous lequel l' | ||
+ | • {IMAGE} il s'agit de l' | ||
- | Yes, I would recommend it. Caveat: However, only to those who have done their research. Be it into the best distribution | + | **In the case of the HAProxy image (which should be created first), the command will look like this: |
+ | |||
+ | docker run -d -v ~/ | ||
+ | |||
+ | Main differences: | ||
+ | • -p 80:80 - exposes the guest port 80 to the host port 80 (so visiting 172.18.0.2 in a web browser should spit out the typical 503 error from HAProxy). | ||
+ | • -v - in the command above, I just like the actual HAProxy.cfg file into the location | ||
+ | |||
+ | Dans le cas de l' | ||
+ | |||
+ | config/ | ||
+ | |||
+ | Différences principales : | ||
+ | • -p 80:80 expose le port invité 80 au port hôte 80 (donc en allant à l' | ||
+ | • -v dans la commande ci-dessus, j'aime bien avoir le fichier de configuration HAProxy original à l' | ||
+ | |||
+ | **Autostarting | ||
+ | |||
+ | If you want the docker containers to always run (after crashing, reboots, or restarts), you can add --restart=always to the run command. This must be done when creating the container - so if you’ve already created one, you’ll need to stop it, remove it (rm), and then recreate it. | ||
+ | |||
+ | Does this work for only port 80? | ||
+ | |||
+ | The settings for the HAProxy container should never need to change (during docker run). However, if you want to point a domain to, for example, a NodeJS application running on 8000, just adjust the IP in the HAProxy configuration (see below). For example, 172.18.0.6: | ||
+ | |||
+ | Démarrage automatique | ||
+ | |||
+ | Si vous voulez que les conteneurs Docker soient toujours en fonction (après un crash, un redémarrage du système ou de session), vous pouvez ajouter –restart=always à la commande run. Ceci doit être fait à la création du conteneur. Donc, si vous en avez déjà créé un, vous devez l' | ||
+ | |||
+ | Cela ne fonctionne-t-il que pour le port 80 ? | ||
+ | |||
+ | Les réglages du HAProxy ne devraient jamais changer (pendant le fonctionnement de Docker). Toutefois, si vous voulez pointer un domaine particulier, | ||
+ | |||
+ | **HAProxy Config | ||
+ | |||
+ | I’ve saved an example of my configuration here: http:// | ||
+ | |||
+ | Basically, adding new containers is as simple as copying the acl line (#33), the use_backend line (#36), and the backend block (#39-43). Be sure to keep increasing the index numbers (host_test1 would become host_test2, etc.). And give each backend a unique name (and adjust the IP!).** | ||
+ | |||
+ | Configuration du HAProxy | ||
+ | |||
+ | J'ai sauvegardé un exemple de ma configuration ici : http:// | ||
+ | |||
+ | Pratiquement, | ||
+ | |||
+ | **How do I make a wildcard dnsmasq entry? | ||
+ | |||
+ | You can add a single line to your dnsmasq.conf file (typically found at / | ||
+ | |||
+ | address=/ | ||
+ | |||
+ | Replace the IP with your own, and the home.lan portion with the domain you’d like (minus any subdomains - so instead of www.google.com, | ||
+ | |||
+ | Comment faire une entrée générique pour DNSMASQ ? | ||
+ | |||
+ | Vous pouvez ajouter une simple ligne à votre fichier dnsmasq.conf (que vous trouverez normalement à / | ||
+ | |||
+ | address=/ | ||
+ | |||
+ | Remplacez l'IP par la vôtre et la partie home.lan avec le domaine de votre choix (sans les sous-domaines, | ||
+ | |||
+ | **I hope this article was helpful to anyone wondering about Docker, who has been looking for a better way to host local projects while in development. If you have any questions, or want to share a docker trick of your own, feel free to email me at lswest34+fcm@gmail.com.** | ||
+ | |||
+ | J' | ||
+ | |||
+ | |||
+ | **Further Reading | ||
+ | |||
+ | https:// | ||
+ | LXC | ||
+ | |||
+ | https:// | ||
+ | Docker VS Vagrant | ||
+ | |||
+ | https:// | ||
+ | Docker** | ||
+ | |||
+ | Pour aller plus loin | ||
+ | |||
+ | https:// | ||
+ | LXC | ||
+ | |||
+ | https:// | ||
+ | Comparaison entre Docker et Vagrant | ||
+ | |||
+ | https:// | ||
+ | Docker | ||
- | I hope this review/ | ||
- | ** |
issue106/c_c.1457519532.txt.gz · Dernière modification : 2016/03/09 11:32 de frangi