These are chat archives for azukiapp/azk

29th
Nov 2015
Vytenis
@FDiskas
Nov 29 2015 16:28

Hello, got strange problem can't use provision

azk: ↻ provisioning `web` system...
azk: TypeError: Object (npm upgrade -g npm; npm install -g gulp; npm install -g bower; npm install; composer install; bower install ) has no method 'join'
azk:     at Object.callee$1$0$ (/azk:0.16.2/src/system/run.js:57:64)
azk:     at tryCatch (/usr/lib/azk/node_modules/babel-runtime/regenerator/runtime.js:65:40)
azk:     at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/azk/node_modules/babel-runtime/regenerator/runtime.js:229:22)
azk:     at GeneratorFunctionPrototype.Gp.(anonymous function) [as next] (/usr/lib/azk/node_modules/babel-runtime/regenerator/runtime.js:262:19)
azk:     at GeneratorFunctionPrototype.tryCatcher (/usr/lib/azk/node_modules/bluebird/js/main/util.js:24:31)
azk:     at PromiseSpawn._next (/usr/lib/azk/node_modules/bluebird/js/main/generators.js:100:49)
azk:     at Promise._settlePromiseAt (/usr/lib/azk/node_modules/bluebird/js/main/promise.js:528:21)
azk:     at Promise._settlePromises (/usr/lib/azk/node_modules/bluebird/js/main/promise.js:646:14)
azk:     at Async._drainQueue (/usr/lib/azk/node_modules/bluebird/js/main/async.js:177:16)
azk:     at Async._drainQueues (/usr/lib/azk/node_modules/bluebird/js/main/async.js:187:10)
azk:     at Async.drainQueues (/usr/lib/azk/node_modules/bluebird/js/main/async.js:15:14)
azk:     at process._tickCallback (node.js:448:13)
azk: Due to the above error azk will stop all instances already running.

Azkfile.js

systems({
  "web": {
    // Dependent systems
    depends: [], // postgres, mysql, mongodb ...
    // More images:  http://images.azk.io
    image: {"docker": "azukiapp/php-apache"},
    // Steps to execute before running instances
    provision: [
      "npm upgrade -g npm",
      "npm install -g gulp",
      "npm install -g bower",
      "npm install",
      "composer install",
      "bower install"
    ],
    workdir: "/azk/#{manifest.dir}",
    shell: "/bin/bash",
    command: "# command to run app",
    wait: {"retry": 20, "timeout": 1000},
    mounts: {
      '/azk/#{manifest.dir}': path("."),
    },
    scalable: {"default": 1},
    http: {
      // my-app.dev.azk.io
      domains: [ "#{system.name}.#{azk.default_domain}" ]
    },
    ports: {
      // exports global variables
      http: "80/tcp",
    },
    envs: {
      // set instances variables
      APP_DIR: "/azk/#{manifest.dir}",
    },
  },
});
Gullit Miranda
@gullitmiranda
Nov 29 2015 20:33
This problem is related to the issue azukiapp/azk#571
Vytenis
@FDiskas
Nov 29 2015 20:33
thanks
Gullit Miranda
@gullitmiranda
Nov 29 2015 20:34
The solution is development: azukiapp/azk#573
Vytenis
@FDiskas
Nov 29 2015 20:36
I have one question not realy related to this project, but you may know that's the problem.
I installed on container the npm and grunt. So then i run "grunt" on kontainer all files are created with wrong permissions - I cant delete or edit them.
Gullit Miranda
@gullitmiranda
Nov 29 2015 20:38
To gulp processes, recommended is to have a build container and another to serve assets.
Compiled assets need not be synchronized or shared.
Vytenis
@FDiskas
Nov 29 2015 20:40
thank you for suggestion
Gullit Miranda
@gullitmiranda
Nov 29 2015 20:40
Note line 35 of Arkfile, where the files are persisted and then on line 11 where the files are used.
Vytenis
@FDiskas
Nov 29 2015 20:47
Is there any azukiapp with bower & grunt & npm & composer?
Gullit Miranda
@gullitmiranda
Nov 29 2015 20:48
I need to take a look. But I believe so.
Vytenis
@FDiskas
Nov 29 2015 20:51
$ azk init

azk: [mokausi] A `php_composer` system was detected at '/home/vytenis/Projects/web'.
azk: [mokausi] The image suggested was `{"docker":"azukiapp/php-fpm:5.6"}`.
azk: [mokausi] ! It was not possible to detect the `php_composer` specific version, so the standard version was suggested instead.
azk: [mokausi] ! To change the image version you must edit the `Azkfile.js` file.
azk: [mokausi] ! For more information see the documentation at http://docs.azk.io/en/images/index.html.
azk: 'Azkfile.js' generated

And I got generated file with some intresting mounts

/**
 * Documentation: http://docs.azk.io/Azkfile.js
 */
// Adds the systems that shape your system
systems({
  web: {
    // Dependent systems
    depends: [],
    // More images:  http://images.azk.io
    image: {"docker": "azukiapp/php-fpm:5.6"},
    // Steps to execute before running instances
    provision: [
      "composer install",
    ],
    workdir: "/azk/#{manifest.dir}",
    shell: "/bin/bash",
    wait: 20,
    mounts: {
      '/azk/#{manifest.dir}': sync("."),
      '/azk/#{manifest.dir}/vendor': persistent("./vendor"),
      '/azk/#{manifest.dir}/composer.phar': persistent("./composer.phar"),
      '/azk/#{manifest.dir}/composer.lock': path("./composer.lock"),
      '/azk/#{manifest.dir}/.env.php': path("./.env.php"),
      '/azk/#{manifest.dir}/bootstrap/compiled.php': path("./bootstrap/compiled.php"),
    },
    scalable: {"default": 1},
    http: {
      domains: [ "#{system.name}.#{azk.default_domain}" ]
    },
    ports: {
      // exports global variables
      http: "80/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
      APP_DIR: "/azk/#{manifest.dir}",
    },
  },
});

It would be nice that suggestion pay attention to more files like: package.json, bower.json, Gruntfile.js, composer.json not only composer.json

Gullit Miranda
@gullitmiranda
Nov 29 2015 20:57
Really it would be interesting. At the moment I do not know as well do it in a simple way, it would be necessary to add these checks for each suggestion.
This is suggestion file that was used to generate this Azkfile.
https://github.com/azukiapp/azk/blob/master/src/generator/suggestions/php_composer.js
Rule to select suggestion:
https://github.com/azukiapp/azk/blob/master/src/generator/rules/php_composer.js
It is possible, we just need to identify the best way to do this.
It will be much easier to control it when azk support plugins.
If you can contribute to this improvement will be very interesting.
Vytenis
@FDiskas
Nov 29 2015 21:01
I'm not a smart guy with node knowledge
Gullit Miranda
@gullitmiranda
Nov 29 2015 21:03
you can do the checks on the main rule and then add the provisions and mounts the main suggestion.
Vytenis
@FDiskas
Nov 29 2015 21:04
why this is mounted? '/azk/#{manifest.dir}/composer.phar': persistent("./composer.phar"), .phar is not a directory :/
Gullit Miranda
@gullitmiranda
Nov 29 2015 21:04
then you can at least open an issue 😁
Vytenis
@FDiskas
Nov 29 2015 21:05
:)
Gullit Miranda
@gullitmiranda
Nov 29 2015 21:05
The mounts also supports files.