github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/docs/examples/example-osv-nodejs/README.md (about)

     1  # Example NodeJS application for OSv
     2  
     3  Simple NodeJS application is provided (server.js) with configuration files that are
     4  needed by UniK.
     5  
     6  ## Configuration files
     7  
     8  ### manifest.yaml
     9  ```
    10  image_size: 1GB
    11  ```
    12  This file tells UniK what logical filesystem size would we like to use for the unikernel.
    13  
    14  ### meta/run.yaml
    15  ```
    16  config_set:
    17     conf1:
    18        main: server.js
    19        env:
    20           PORT: 3000
    21  
    22  config_set_default: conf1
    23  ```
    24  This file describes our NodeJS project structure. A single configuration set
    25  `conf1` (that is also set as default) is specified. It tells UniK what JavaScript file
    26  to run on boot (server.js) and what environment variables to set inside unikernel
    27  (PORT=3000).
    28  
    29  ## Build command
    30  
    31  ### Prepare application
    32  You must install some NodeJS libraries prior using UniK to build unikernel for you.
    33  Make sure that you have version 4.x of node installed:
    34  ```
    35  $ node -v
    36  4.3.0
    37  ```
    38  Then install required libraries:
    39  ```
    40  $ npm install
    41  ```
    42  That's it, application is prepared. Go on, build unikernel for it.
    43  
    44  ### Build
    45  ```
    46  $ unik build \
    47     --name osv-nodejs-example \
    48     --path ./ \
    49     --base osv \
    50     --language nodejs \
    51     --provider [qemu|openstack]
    52  ```
    53