วันเสาร์ที่ 24 ตุลาคม พ.ศ. 2558

Container (vs VM)

Docker เป็นเครื่องมือในการสร้างและแจกจ่าย image ที่บรรจุ (container) สภาพแวดล้อมที่ประกอบขึ้นจากซอฟตแวรต่างๆ ที่มีรุ่นที่เฉพาะเจาะจงสำหรับรัน web application ที่สร้างขึ้นสำหรับสภาพแวดล้อมนั้นๆ ทำให้สามารถนำ image ไปรันบนแพลตฟอร์มใดก็ได้แม้ว่าจะมีสภาพแวดล้อมต่างจากที่จำเป็นต่อการทำงานของ web application ใช้แก้ปัญหาสำคัญว่า รันในเครื่อง dev ได้แต่พอเอา app ไปติดตั้งในเครื่อง production มักมีปัญหารันไม่ได้ ก็เลยหอบ libs ในเครื่อง dev ทั้งยวงไปรันบนเครื่อง production เสียเลย
และแน่นอนว่าแพลตฟอร์มที่จะรัน image ได้นั้นต้องติดตั้ง docker runtime (docker engine) ไว้ด้วย
http://www.siamhtml.com/getting-started-with-docker/

คำอธิบายโดยละเอียด
http://nuuneoi.com/blog/blog.php?read_id=868

สรุป docker container = docker engine + application + lightweight guest OS (เฉพาะ libraries ส่วนที่จำเป็นต่อการรัน web app; docker engine เทียบเท่ากับ hypervisor that virtualizes host OS 

docker engine (= container runtime) ก็ต้องเลือกติดตั้ง เช่น สำหรับรัน/ติดตั้งบน windows แต่รองรับ linux/windows (apps) container ได้ (ต้อง toggle between Linux and Windows containers in Docker cf.https://docs.docker.com/desktop/install/windows-install/)
https://hub.docker.com/editions/community/docker-ce-desktop-windows
เทคนิคอื่นที่ช่วยให้รัน Linux app inside container atop Windows host OS ได้: https://ubuntu.com/tutorials/windows-ubuntu-hyperv-containers#1-overview










รูปขวาบนอาจวาดใหม่เป็นแบบนี้










Containers share the machine’s OS system kernel and therefore do not require an OS per application, driving higher server efficiencies and reducing server and licensing costs.

Container vs. VM https://www.blognone.com/node/105928

How to load existing application into a chosen Docker image: https://youtu.be/lpr2tO-FCEw

Kubernetes VS Docker
Docker is a platform and tool for building, distributing, and running Docker containers. It offers its own native clustering tool that can be used to orchestrate and schedule containers on machine clusters. Kubernetes is a container orchestration system for Docker containers that is more extensive than Docker Swarm and is meant to coordinate clusters of nodes at scale in production in an efficient manner. It works around the concept of pods, which are scheduling units (and can contain one or more containers) in the Kubernetes ecosystem, and they are distributed among nodes to provide high availability. (https://www.sumologic.com/blog/devops/kubernetes-vs-docker/Kubernetes is meant to run across a cluster while Docker runs on a single node. Docker enables you to run multiple containers on a single OS host. 
Kubernetes orchestrates multiple Docker hosts (nodes).

Kubeflow (https://www.kubeflow.org/)
The Kubeflow project is dedicated to making deployments of machine learning (ML) workflows on Kubernetes simple, portable and scalable. 

Containers vs. VMs: What are the differences? (cf. https://www.ibm.com/cloud/blog/containers-vs-vms)
  • In VM, a hypervisor virtualizes physical hardware. The result is that each virtual machine contains a guest OS, a virtual copy of the hardware that the OS requires to run and an application and its associated libraries and dependencies. VMs with different operating systems can be run on the same physical server. For example, a VMware VM can run next to a Linux VM, which runs next to a Microsoft VM, etc.
  • Instead of virtualizing the underlying hardware, containers virtualize the operating system (typically Linux or Windows) so each individual container contains only the application and its libraries and dependencies. Containers are small, fast, and portable because, unlike a virtual machine, containers do not need to include a guest OS in every instance and can, instead, simply leverage the features and resources of the host OS. 
  • Docker delivers software in packages called containers. Because all of the containers share the services of a single OS kernel, they use fewer resources than VMs.
Benefit of VM over Container (cf. https://www.datamation.com/data-center/containers-vs-virtual-machines/)
  • Virtual Machines offer more resources. Because you are using the full OS and not a custom, whittled down version, you have the full strength of OS, i.e. more flexible. That means all OS resources are available and you have a full suite of management and security tools. In short, you have the full OS, whether it’s Windows, Red Hat, Ubuntu, or some other flavor of Linux.
  • We use container for testing&deployment phases; not for development phase, which must be done locally or on VM.
  • To run more apps, docker requires to create an image for those additional apps followed by deployment. But in VM, those apps can just be directly run.
  • In a virtualized environment, you run multiple operating systems on a hypervisor that manages I/O on one machine. In a containerized environment, it’s not virtualized and no hypervisor but container engine is used instead. 
  • We can run several applications / processes in the same container but not recommended. (cf. https://www.tutorialworks.com/containers-single-or-multiple-processes/)
  • Containers need OS, thus they can run inside VM.

Node.js

คือ software platform ที่ประกอบด้วย web server และ Javascript interpreter ที่ทำให้สามารถรัน Javascript ที่ฝั่งเครื่องบริการเป็น server application ได้

คำอธิบายเพิ่มเติม 
http://www.siamhtml.com/introduction-to-node-js/

ตัวอย่างโค้ด
http://www.tutorialspoint.com/nodejs/nodejs_first_application.htm

วันอังคารที่ 20 ตุลาคม พ.ศ. 2558

Lease VS Rent

Lease ปกติจะเป็นสัญญาระยะยาวเช่น 3-12 เดือนขึ้นไป ส่วน Rent จะเป็นสัญญารายเดือน