Wednesday, February 28, 2018

Buildpack basics


What is a buildpack? 
Any application deployment will require softwares to be downloaded, container to be initialized and app to be deployed. A build pack is noting but the runtime and libraries on which the apps will be deployed. It defines how to run application - provide runtime support and framework for apps. 

A Java build pack for example takes care of the JRE and memory management, Container which the app should run on (tomcat, spring boot etc) and makes it easy for the developer to configure with the service. 

Why are they important?
provides runtime support and framework for applications. 
- examine your app artifacts, decides which build pack to use. 
  • Determines which dependencies to download.

Can you name some buildpacks? 
  • Go, Java, .net, Node.js, PHP, Python, Ruby, Staticfile. 

How does Cloud Foundry know which buildpack to run? 
  • Each build pack has a position in the priority list. If it is in 1 position and is compatible then it takes the 1st build pack, if not it goes on to second build pack and so on till the correct build pack. If no build pack found it says staging failed - no app detected error. 


How does a buildpack work? Are you aware of the scripts that run and how they might be written or modified? 
A build pack is in the form of a script, bash script. 
  • Detect script
    • Identifies which language this code and decides if it need to apply the build pack to an app. 
  • Supply script: 
    • Provides the dependencies for the app. 
    • Installing the runtime libraries 
      • Java: (JAR files, tomcat, sprint boot etc., 
      • Python (Puython2x, package manager, flask etc., )
  • Finalize script
    • prepares the app for launch. 
      • Handle and config params, 

  • Release script
    • Tell the cloud foundry platform how to start the application
    • Spits out a YML file which explains how to start. 
      • Tomcat - catalina.sh file. 

No comments:

Post a Comment