Nulecule: Packaging, Distributing and Deploying Multi-Container Applications the Cloud Way ContainerCon North America 2016
Charlie Drage Container Tools / Project Atomic @ Red Hat cdrage @ http://projectatomic.io
Wait, what’s Project Atomic? Lightweight OS designed with the sole purpose of deploying containerized applications Container tools such as the Atomic CLI to deploy your applications GUI tools such as the Cockpit Project to help manage
What’s the current problem? Multiple standards in multi-container deployment orchestrators (Kubernetes, OpenShift, Docker Compose, Mesos, Nomad, Dokku, Flynn, etc..) Even though… We’re slowly converging to a single standard in the container front (single image and runtime spec) via the OCI (Open Container Initiative) e.g. rkt + docker https://www.opencontainers.org/
Nulecule && Atomic App A simple way of deploying multi-container applications to provider-agnostic environments Nulecule = specification Atomic App = implementation "Well, it all starts when a nulecule comes out of its nest...” - Homer
Issues with container distribution / orchestration As awesome as container orchestration tools are, (imo) they’ve got a high learning curve. What distribution, parameterization methods? How do I deploy a Kubernetes example as simple as `docker run -p 80:80 nginx`?
Containers galore Over 941 different MariaDB containers on Docker Hub So many varieties and yet only one that people should use * Last checked August 3rd 2016
How we help Creating a multi-container application for say, ex. Ops to deploy Building a single image for deployment Deploy and undeploy from multiple providers Distributing parameterized apps Composability to multiple orchestration providers Atomic App is packaged into a single deployment container
Multi-container applications
Composability Import and use an official container into your application *Similar to “Docker Compose”
Metadata Most environment variables require some sort of change
Metadata and various orchestrators Metadata: No common way to distribute metadata from ops to devs and vice-versa. Unable to provide environment variables at deployment time (have to specify in an .env file) Orchestrators: Multiple deployment tools and file formats
--- Creating your first specversion: 0.0.2 id: helloapache-app Nulecule file metadata: name: Hello Apache App appversion: 0.0.1 description: Atomic app for deploying a really basic Apache HTTP It’s super easy! “Hello world” server location: docker.io/projectatomic/helloapache params: Includes: specification, - name: provider composability, distribution, description: The specified default provider. default: kubernetes parametrization, orchestrator graph: agnostic - name: helloapache-app params: - name: image description: The webserver image default: centos/httpd - name: hostport description: The host TCP port as the external endpoint default: 80 artifacts: docker: - file://artifacts/docker/hello-apache-pod_run kubernetes: - file://artifacts/kubernetes/hello-apache-pod.json marathon: - file://artifacts/marathon/helloapache.json
Another spec?
Let’s build an Etherpad example with MariaDB
Identifier and Specification Version --- specversion: "0.0.2" id: etherpad-app Give the ID that will be used for import into different applications as well as the current spec version
metadata: Metadata name: etherpad-app appversion: 0.0.1 description: Etherpad demo location: docker.io/user/etherpad-app Included metadata available for scraping
params: Params - name: provider description: Default provider default: kubernetes Global parameters
graph: Graph - name: mariadb-centos7-atomicapp ... - name: etherpad-app ... The “bread and butter” of the Nulecule file format. Define application components and dependencies.
Graph Source graph: - name: mariadb-centos7-atomicapp source: docker://user/mariadb-atomicapp ... Import an already pre-made Nulecule application
graph: ... - name: etherpad-app params: - name: image description: Container image default: centos/etherpad - name: hostport description: Host TCP Port Graph Params default: 9001 - name: db_user description: Database User - name: db_pass Provide the correct values at description: Database Password - name: db_name deployment time description: Database Name - name: db_host description: Database hostname/IP default: mariadb - name: db_port description: Database service port default: 3306
[general] provider = kubernetes Answers file [etherpad-app] db_user = foo db_host = bar Graph parameters can be ... pre-defined prior to deployment instead of “answered”
graph: ... - name: etherpad-app params: ... Graph Artifacts artifacts: docker: ... kubernetes: - file://artifacts/kubernetes/etherpad-rc.yaml Metadata templates for - file://artifacts/kubernetes/etherpad-svc.yaml different orchestrators openshift: - i nherit: - kubernetes
--- apiVersion: v1 kind: ReplicationController metadata: name: etherpad labels: name: etherpad spec: replicas: 1 selector: name: etherpad template: metadata: labels: Graph Params in name: etherpad spec: kubernetes/etherpad-rc.yaml containers: - name: etherpad image: $image Dollar sign variable ports: - name: etherpad-server replacement in each artifact containerPort: $hostport env: file - name: DB_HOST value: $db_host - name: DB_DBID value: $db_name - name: DB_PASS value: $db_pass - name: DB_PORT value: $db_port - name: DB_USER value: $db_user
Atomic App Reference implementation of Nulecule Installer, manager, container builder, single command deployment
Create a Nulecule application in one FROM projectatomic/atomicapp:0.6.1 MAINTAINER Red Hat, Inc. <container-tools@redhat.com> container LABEL io.projectatomic.nulecule.providers="kubernetes" \ io.projectatomic.nulecule.specversion="0.0.2" Build your app on top of our ADD /Nulecule /Dockerfile README.md /application-entity/ ADD /artifacts /application-entity/artifacts Atomic App base image
DEMO
Learn more at Project: http://projectatomic.io Github: http://github.com/projectatomic/nulecule http://github.com/projectatomic/atomicapp IRC: #nulecule @ freenode Mailing list: container-tools@redhat.com Charlie Drage, @cdrage, cdrage@redhat.com
Recommend
More recommend