Skip to content

Instantly share code, notes, and snippets.

Starting Out

  • User is on app.habitat.sh
  • User signs in
  • User clicks on "Origins" in side menu
  • User clicks on a specific origin
  • User clicks on "Upload public origin key"

Builder-Web

Code for "Upload public origin key" button

builder-sessionsrv

builder-sessionsrv/src/data_store.rs

use db::pool::Pool;
use db::migration::Migrator;
use hab_net::privilege;
use protocol::sessionsrv;
use postgres;
use protobuf;

User creates a new origin through the API like this:

http POST http://localhost:9636/v1/depot/origins Content-Type:application/json Authorization:Bearer:${HAB_AUTH_TOKEN} name=my_new_origin

This goes to builder-depot.

builder-depot

Creating a test app

(Based on this tutorial)

$ express --git my_app
$ cd my_app
$ npm install
$ vim routes/index.js

What do I need to know?

I need to know how core/scaffolding-node figures out what version of node to use.

Normally, I would expect core/scaffolding-node to have a direct dependency on core/node, but it does not appear to.

core-plans/scaffolding-node/plan.sh

pkg_deps=(core/tar core/jq-static core/rq)

Intro

  • Title Slide
  • Who am I?
  • Why am I here?
  • Overview

Body

Habitat

  • Habitat 101

Intro

This documents various ways of deploying/running Node JS applications including Express, React, and Angular. This is intended to help brainstorm how to make node scaffolding work better for Habitat.

General Notes

Express

  • framework that sits ontop of Node.js's web server and makes it easier to use (Source: Express in Action)

React

Running docker exporter locally with local builder

$ sudo cargo run core-sample-node-app-1.0.1-20180104232800-x86_64-linux.hart -- --url http://localhost:9636

Creating, Running, Destroying hab studio in a location

 hab studio -r /opt/slim new
thread 'main' panicked at 'could not export.: "Is a directory (os error 21)"', /checkout/src/libcore/result.rs:906:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:69
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:58
             at /checkout/src/libstd/panicking.rs:381

Package Name

Brief description of package

Maintainers

Names of core plans maintainers (The Habitat Maintainers [email protected] is usually sufficient)

Type of Package