These are chat archives for azukiapp/azk

15th
Dec 2015
Vytenis
@FDiskas
Dec 15 2015 19:22
hello, if I want to add nginx config the syntax is ok?
    mounts: {
      '/azk/#{manifest.dir}': path("."),
      '/etc/nginx/sites-enabled/': path("./nginx/")
    },
Gullit Miranda
@gullitmiranda
Dec 15 2015 19:25
yes
Vytenis
@FDiskas
Dec 15 2015 19:36
thanks
I love azk thanks for the good tool. Now I'm promoting this
much better then docker-compose
I mean more user friendly
Vytenis
@FDiskas
Dec 15 2015 19:49
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: [
      "npm install -g bower && bower install --allow-root"
    ],
    workdir: "/azk/#{manifest.dir}",
    shell: "/bin/bash",
    wait: 20,
    mounts: {
      '/azk/#{manifest.dir}': path("."),
      '/etc/nginx/sites-enabled/': path("./nginx/")
    },
    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}"
    }
  }
});
then I start this - there is no bower installed. What I'm doing wrong?
Vytenis
@FDiskas
Dec 15 2015 19:55
$ azk restart --reprovision -v
azk: ↻ provisioning `web` system...
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
bower@1.7.1 /usr/local/lib/node_modules/bower
└── semver-utils@1.1.1
but then azk shell and bower got error bash: bower: command not found
Gullit Miranda
@gullitmiranda
Dec 15 2015 19:56
the problem is PATH.
azk shell -c 'echo $PATH'
Vytenis
@FDiskas
Dec 15 2015 19:57
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if I try the same command in the shell npm install -g bower && bower install --allow-root the bower is successfuly isntalled
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:02
what’s npm global path?
Vytenis
@FDiskas
Dec 15 2015 20:02
there is still big issue with a azk. Its about permissions. Would be great to allow run this with no root. Ex.: azk shell bower install
how to check that path?
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:04
one moment, please
Vytenis
@FDiskas
Dec 15 2015 20:05
npm@2.14.1 /usr/local/lib/node_modules/npm
all files that was created by the composer or bower are unaccessable. In docker there is uid 1000 and www-data
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:08
then you can use the full path to bin or create a PATH env
yes. in linux has this problem
Vytenis
@FDiskas
Dec 15 2015 20:10
But in docker you can access to shell with no root privilegies
docker exec --user www-data -it web bash
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:11
That's because the docker everything is root. the options are:
  1. create a user with uid 1000 and apply to files
  2. outside the shell apply permissions for you using sudo
Vytenis
@FDiskas
Dec 15 2015 20:13
Is this possible to make that upon installing azk?
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:15
the azk does not support this option. one reason for this is that to use this feature (—user), user must exist.
Vytenis
@FDiskas
Dec 15 2015 20:17
what about adding some?
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:18
I dont understend your question
Vytenis
@FDiskas
Dec 15 2015 20:22
sorry my English is very bad. The problem is permissions. Then php is creating images or cached files or some other tools like bower all thous files are not accessable.
Don't say that you can't fix that :)
as workaround I allways executing a command chmod 0777 -R . in shell
this is ridiculous.
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:25
the problem ocurre in this project: https://github.com/Bebras-2015/web
right?
Vytenis
@FDiskas
Dec 15 2015 20:32
yes
can't provision
Gullit Miranda
@gullitmiranda
Dec 15 2015 20:33
This problem only occurs on Linux.
I'll go up a machine to do some tests.
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:10
here the application works well.
Vytenis
@FDiskas
Dec 15 2015 21:17
bower installed correctly?
provision should install bower but I never got it working
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:18
yep
azk start
azk: ↑ starting `web` system, 1 new instances...
azk: ✓ checking `azukiapp/php-fpm:5.6` image...
azk: ◴ waiting for `web` system to start, trying connection to port http/tcp...

┌───┬────────┬───────────┬───────────────────────┬─────────────────┬────────────────┐
│   │ System │ Instances │ Hostname/url          │ Instances-Ports │ Provisioned    │
├───┼────────┼───────────┼───────────────────────┼─────────────────┼────────────────┤
│ ↑ │ web    │ 1         │ http://web.dev.azk.io │ 1-http:32770    │ 10 minutes ago │
└───┴────────┴───────────┴───────────────────────┴─────────────────┴────────────────┘
git@ubuntu-1gb-nyc3-01:~/web$ curl web.dev.azk.io
<!DOCTYPE html>
<html lang="en”>
   …
git@ubuntu-1gb-nyc3-01:~/web$ curl http://web.dev.azk.io/lib/angular-loading-bar/build/loading-bar.js
/*!
 * angular-loading-bar v0.8.0
 * https://chieffancypants.github.io/angular-loading-bar
 * Copyright (c) 2015 Wes Cruver
 * License: MIT
 */
/*
 * angular-loading-bar
 *
 * intercepts XHR requests and creates a loading bar.
 * Based on the excellent nprogress work by rstacruz (more info in readme)
 *
 * (c) 2013 Wes Cruver
 * License: MIT
 */
Vytenis
@FDiskas
Dec 15 2015 21:19
try azk chell web bower
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:21
so it will not function.
  1. the bower was installed globally, without being persisted.
2 - the bower binary (directory) is not available in PATH of container
Vytenis
@FDiskas
Dec 15 2015 21:27
Ok trying to add env
PATH: 'node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
this was not worked
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:32
I'm making some changes in Azkfile.
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:43
diff --git i/Azkfile.js w/Azkfile.js
index 29845a0..d28a711 100755
--- i/Azkfile.js
+++ w/Azkfile.js
@@ -10,14 +10,17 @@ systems({
     image: {"docker": "azukiapp/php-fpm:5.6"},
     // Steps to execute before running instances
     provision: [
-      "npm install -g bower && bower install --allow-root"
+      "npm install bower",
+      "node_modules/.bin/bower install --allow-root",
     ],
     workdir: "/azk/#{manifest.dir}",
     shell: "/bin/bash",
     wait: 20,
     mounts: {
-      '/azk/#{manifest.dir}': path("."),
-      '/etc/nginx/sites-enabled/': path("./nginx/")
+      '/azk/#{manifest.dir}'             : path("."),
+      '/etc/nginx/sites-enabled/'        : path("./nginx/"),
+      '/azk/#{manifest.dir}/lib'         : persistent("lib"),
+      '/azk/#{manifest.dir}/node_modules': persistent("node_modules"),
     },
     scalable: {"default": 1},
     http: {
I’ll make a PR
Bebras-2015/web#4
Vytenis
@FDiskas
Dec 15 2015 21:56
:+1: thankyou so mutch
works very well. Your pull request will fix about 3 or more projects :)
Gullit Miranda
@gullitmiranda
Dec 15 2015 21:59
very nice =D
these projects are open source?
you could add the [run project] button
Vytenis
@FDiskas
Dec 15 2015 22:26
This project is for temporary presentation. Its useless for anybody.
could you suggest me how to cleanup the project - delete all azk created containers for project?
if I run docker ps -a there is so many containers I can't understand which is needed or which is outdated?
Vytenis
@FDiskas
Dec 15 2015 23:27

if I run

azk restart -B -v

I got error in npm-debug.log

72 silly vacuum-fs purging /azk/bebras/node_modules/bower
73 silly vacuum-fs removing /azk/bebras/node_modules
74 silly vacuum-fs unable to remove /azk/bebras/node_modules due to EBUSY, rmdir '/azk/bebras/node_modules'
75 verbose unlock done using /root/.npm/_locks/bower-6bfe719386fb7abb.lock for /azk/bebras/node_modules/bower
76 verbose stack Error: EBUSY, rmdir '/azk/bebras/node_modules'
76 verbose stack     at Error (native)
I tryed to update the npm and problem was fixed. Could you please update the base image to the latest npm?
use this cheat sheet to clean containers and imagens
Vytenis
@FDiskas
Dec 15 2015 23:38
thank you
Gullit Miranda
@gullitmiranda
Dec 15 2015 23:40
On removing the folder node_modules: wont work. For container, the node_modules folder is a mount point, and thus can not be excluded as a directory.
You can only remove the contents.
Vytenis
@FDiskas
Dec 15 2015 23:42
gnome-shell-imgur-BDGP9X.png
lib and node_modules directory is empty after successufly started azk
p.s. I cant commit this directories to the repository bacouse it must contain anything in it
Gullit Miranda
@gullitmiranda
Dec 15 2015 23:45
It has not created one issue for this bug. The bug is that the AZK creates the folder without the need of it. It can be removed from the project folder, because they are ignored by container.
Vytenis
@FDiskas
Dec 15 2015 23:45
ok
Gullit Miranda
@gullitmiranda
Dec 15 2015 23:46
how these folders are empty, they will not be committed. And even if it does not affect the functioning of azk.
Vytenis
@FDiskas
Dec 15 2015 23:47
on first run there is error
npm ERR! Linux 4.2.6-301.fc23.x86_64
npm ERR! argv "node" "/usr/local/bin/npm" "install" "bower"
npm ERR! node v0.12.7
npm ERR! npm  v2.14.1
npm ERR! path /azk/bebras/node_modules
npm ERR! code EBUSY
npm ERR! errno -16

npm ERR! EBUSY, rmdir '/azk/bebras/node_modules'
before I removed lib and node_modules folder
Now they are created but unaccessable
Gullit Miranda
@gullitmiranda
Dec 15 2015 23:47
If possible, open a issue stating this problem, so it is already in backlog.
he keeps trying to remove node_modules directory.