Setting up the project

The first step to use azk in any project is to create an Azkfile.js file. This file has the function to define the root directory of your project and also define the application architecture.

The Azkfile.js file can be created manually, but to make that process easier we have the azk init command. It's an Azkfile.js generator that will do the heavy lifting of figuring out how your application is designed and suggest a pre-configured Azkfile.js.

Note: Remember that you may still have to edit the Azkfile.js generated by azk init so it can work correctly with your application.

$ cd azkdemo
$ azk init
azk: [azkdemo] A `node` system was detected at '/path/to/azkdemo'.
azk: [azkdemo] The image suggested was `{"docker":"azukiapp/node:0.12"}`.
azk: [azkdemo] ! It was not possible to detect the `node` specific version, so the standard version was suggested instead.
azk: [azkdemo] ! To change the image version you must edit the `Azkfile.js` file.
azk: [azkdemo] ! For more information see the documentation at
azk: 'Azkfile.js' generated

  Adds the `.azk` to .gitignore
  echo '.azk' >> .gitignore

This should generate the following Azkfile.js:

 * Documentation:
// Adds the systems that shape your system
  azkdemo: {
    // Dependent systems
    depends: [],
    // More images:
    image: {"docker": "azukiapp/node:0.12"},
    // Steps to execute before running instances
    provision: [
      "npm install",
    workdir: "/azk/#{manifest.dir}",
    shell: "/bin/bash",
    command: ["npm", "start"],
    wait: {"retry": 20, "timeout": 1000},
    mounts: {
      '/azk/#{manifest.dir}': path("."),
      '/azk/#{manifest.dir}/node_modules': persistent("node-modules-#{}"),
    scalable: {"default": 2},
    http: {
      domains: [ "#{}.#{azk.default_domain}" ]
    ports: {
      // exports global variables
      http: "3000/tcp",
    envs: {
      // Make sure that the PORT value is the same as the one
      // in ports/http below, and that it's also the same
      // if you're setting it in a .env file
      NODE_ENV: "dev",
      PORT: "3000",

In the Azkfile.js section you can find detailed information on how to build an Azkfile.js and what options are available. For now, we have enough to run our application.