diff --git a/.dependencies b/.dependencies index ae2b93f3..735be316 100644 --- a/.dependencies +++ b/.dependencies @@ -4,4 +4,4 @@ LIBNSS_RESOLVER_VERSION=0.3.0 RSYNC_MIN_VERSION=2.6.9 AZK_ISO_VERSION=0.4.0 BATS_VERSION=master -NPM_VERSION=2.14.8 +NPM_VERSION=2.14.9 diff --git a/Azkfile.js b/Azkfile.js index 6234d0be..db1c2185 100644 --- a/Azkfile.js +++ b/Azkfile.js @@ -2,68 +2,72 @@ * Documentation: http://docs.azk.io/Azkfile.js */ -var lodash = require('lodash'); -var join = require('path').join; -var config = require('azk').config; +var mounts = { + "/azk/#{manifest.dir}": sync('./', { shell: true }), + "/azk/#{manifest.dir}/package": path("./package"), + "/azk/#{manifest.dir}/node_modules": persistent('node_modules-#{system.name}'), + "/azk/demos" : path("../demos"), + "/azk/build" : persistent('build-#{system.name}'), + "/azk/lib" : persistent('lib-#{system.name}'), + "/azk/data" : persistent('data-#{system.name}'), + "/azk/aptly" : persistent('aptly-#{system.name}'), + "/var/lib/docker" : persistent('docker_files-#{system.name}'), + "/root/.npm" : persistent('npm-cache'), + "/usr/local/bin/make" : path("./src/libexec/make"), + "/root/.aptly.conf" : path("./src/libexec/aptly.json"), + "/.tmux.conf" : path(env.HOME + "/.tmux.conf"), +}; -var mounts = (function() { - // Default mounts - var mounts = { - "/root/.npm" : persistent('npm-cache'), - "/.tmux.conf" : join(env.HOME, ".tmux.conf"), - "/azk/demos" : "../demos", - "/azk/build" : persistent('build-#{system.name}'), - "/azk/lib" : persistent('lib-#{system.name}'), - "/azk/data" : persistent('data-#{system.name}'), - "/azk/aptly" : persistent('aptly-#{system.name}'), - "/var/lib/docker" : persistent('docker_files-#{system.name}'), - "/azk/#{manifest.dir}/node_modules" : persistent('node_modules-#{system.name}'), - "/root/.aptly.conf": path("./src/libexec/aptly.json") - } +var envs = { + PATH: "/azk/#{manifest.dir}/bin:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + AZK_DATA_PATH: "/azk/data", + AZK_LIB_PATH : "/azk/lib", + AZK_NAMESPACE: "azk.linux", + AZK_PACKAGE_PATH: "/azk/build", + AZK_BALANCER_HOST: "linux.azk.io", + AZK_BALANCER_PORT: 8080, + LOG: "file", + EXTRA_SCRIPT: "/azk/#{manifest.dir}/src/libexec/init_azk", + VERSION: "#{azk.version}", +}; - var glob = require('glob'); - var itens = glob.sync("./!(lib|data|node_modules|npm-debug.log|.git|.DS_Store|.azk)", { dot: true }); - - mounts = lodash.reduce(itens, function(mount, item) { - var key = join("/azk", "#{manifest.dir}", item); - mount[key] = path(item); - return mount; - }, mounts); - - return mounts; -})(); - -var agent_system = function(image, extras) { - extras = extras || {}; +systems({ + package: { + image: { docker: 'azukiapp/fpm:1.4.0' }, + shell: "/bin/bash", + workdir: "/azk/#{manifest.dir}", + command: "azk nvm ./src/libexec/package-tools/server", + scalable: { default: 0 }, + mounts: mounts, + envs: envs, + http: { + domains: ["#{system.name}.azk.#{azk.default_domain}"], + }, + ports: { + http: "8080/tcp", + }, + }, - return lodash.merge({ - image: { docker: image }, - scale: false, + 'dind-ubuntu': { + image: { docker: 'azukiapp/dind:ubuntu14' }, + scalable: false, workdir: "/azk/#{manifest.dir}", shell: "/usr/local/bin/wrapdocker", mounts: mounts, - envs: { - PATH: "/azk/#{manifest.dir}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - AZK_DATA_PATH: "/azk/data", - AZK_LIB_PATH : "/azk/lib", - AZK_NAMESPACE: "azk.linux", - AZK_PACKAGE_PATH: "/azk/build", - AZK_BALANCER_HOST: "linux.azk.io", - AZK_BALANCER_PORT: 8080, - LOG: "file", - EXTRA_SCRIPT: "/azk/#{manifest.dir}/src/libexec/init_azk", - VERSION: "#{azk.version}", - }, + envs: envs, docker_extra: { HostConfig: { Privileged: true }, } - }, extras); -} + }, + + 'dind-fedora': { + extends: "dind-ubuntu", + image: { docker: 'azukiapp/dind:fedora20' }, + }, -var test_package_system = function(image){ - return { + 'pkg-ubuntu12-test': { depends: ["package"], - image: { docker: image }, + image: { docker: 'azukiapp/dind:ubuntu12' }, workdir: "/azk/#{manifest.dir}", shell: "/usr/local/bin/wrapdocker", mounts: { @@ -80,55 +84,15 @@ var test_package_system = function(image){ docker_extra: { HostConfig: { Privileged: true }, } - } -} - -systems({ - 'dind-ubuntu': agent_system('azukiapp/dind:ubuntu14'), - 'dind-fedora': agent_system('azukiapp/dind:fedora20'), - - package: agent_system('azukiapp/fpm', { - shell: "/bin/bash", - command: "azk nvm ./src/libexec/package-tools/server", - scalable: { default: 0 }, - http: { - domains: ["#{system.name}.azk.#{azk.default_domain}"], - }, - ports: { - http: "8080/tcp", - }, - }), - - 'pkg-ubuntu12-test': test_package_system('azukiapp/dind:ubuntu12'), - 'pkg-ubuntu14-test': test_package_system('azukiapp/dind:ubuntu14'), - 'pkg-fedora-test' : test_package_system('azukiapp/dind:fedora20'), + }, - grunt: { - image: { docker: "azukiapp/node" }, - workdir: "/azk/#{manifest.dir}", - mounts: { - "/azk/#{manifest.dir}": ".", - }, - envs: { - PATH: "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/azk/#{manifest.dir}/node_modules/.bin" - } + 'pkg-ubuntu14-test': { + extends: "pkg-ubuntu12-test", + image: { docker: 'azukiapp/dind:ubuntu14' }, }, - docs: { - image: { docker: "azukiapp/python" }, - //provision: [ - //'export INSTALL_DIR=/azk/<%= manifest.dir %>/vendor/python', - //'pip install --target=$INSTALL_DIR --install-option="--install-scripts=$INSTALL_DIR/bin" sphinx', - //], - workdir: "/azk/#{manifest.dir}", - mounts: { - "/azk/#{manifest.dir}": ".", - }, - //envs: { - //PYTHONPATH: "/azk/<%= manifest.dir %>/vendor/python", - //PATH: "/bin:/sbin:/usr/bin:/usr/sbin:/azk/<%= manifest.dir %>/vendor/python/bin" - //} + 'pkg-ubuntu14-test': { + extends: "pkg-ubuntu12-test", + image: { docker: 'azukiapp/dind:fedora20' }, }, }); - -setDefault('docs'); diff --git a/CHANGELOG.md b/CHANGELOG.md index 69ebcfd9..dd4d867e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## v0.16.1 - (2015-11-06) + +* Enhancements + * [Agent] Avoiding showing messages in a loop during agent start; + * [Package] Adding support to Ubuntu 15.10; + * [Package] Simplify root `Azkfile`, replacing functions for `extends` property; + * [Package] Adding a `make` script to force `make -e` in `package` system; + * [Package] Making `git` a suggested dependency; + * [Core] Removing `Azkfile.js` from default exclude list of `sync` mount property; + +* Bug + * [Package] Fixing npm version check. Even manually installing a different npm version, `make` overrides it and install the correct version; + ## v0.16.0 - (2015-10-28) * Bug @@ -14,7 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). * [Cli] Added the command `azk open [system]` which opens a system URL in browser #528; * [Cli] Adding `deploy` command to cli; * [Kernel] Changing system to get `command` from image, but respect this priority for `azk shell`: shell option (`--shell`) > Azkfile.js > docker image #534; - * [Docker] Improving Docker version verify, making it more resistant; + * [Docker] Improving Docker version verification, making it more robust; ## v0.15.0 - (2015-09-15) diff --git a/Makefile b/Makefile index 5120dc49..5fa60557 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# Global vars and configs + SO:=$(shell uname -s | awk '{print tolower($$0)}') AZK_VERSION:=$(shell cat package.json | grep -e "version" | cut -d' ' -f4 | sed -n 's/\"//p' | sed -n 's/\"//p' | sed -n 's/,//p') @@ -14,22 +16,24 @@ include .dependencies # default target all: bootstrap -# BOOTSTRAP +###### Bootstrap session ###### + NVM_DIR := ${AZK_LIB_PATH}/nvm NVM_NODE_VERSION := $(shell cat ${AZK_ROOT_PATH}/.nvmrc) NODE = ${NVM_DIR}/${NVM_NODE_VERSION}/bin/node VM_DISKS_DIR := ${AZK_LIB_PATH}/vm/${AZK_ISO_VERSION} # Locking npm version -NPM_VERSIONS_PATH := ${NVM_DIR}/npm_versions -NPM_VERSION_FILE := ${NPM_VERSIONS_PATH}/${NPM_VERSION} +NPM_VERSION_FILE := ${NVM_DIR}/npm_version finished: @echo "Finished!" -clean_nvm_versions: +clean_nvm_versions: ${NODE} @echo "Checking npm version..." - @mkdir -p ${NPM_VERSIONS_PATH} && find ${NPM_VERSIONS_PATH} -type f -not -name '${NPM_VERSION}' -delete || true + @if [ ! "$$(${AZK_BIN} nvm npm --version)" = "${NPM_VERSION}" ] ; then \ + rm -f ${NPM_VERSION_FILE}; \ + fi SRC_JS = $(shell cd ${AZK_ROOT_PATH} && find ./src -name '*.*' -print 2>/dev/null) @@ -50,12 +54,13 @@ ${AZK_NPM_PATH}/.install: npm-shrinkwrap.json package.json ${AZK_BIN} nvm npm install && \ touch ${AZK_NPM_PATH}/.install -${NPM_VERSION_FILE}: ${NODE} +${NPM_VERSION_FILE}: @echo "task: install npm ${NPM_VERSION}" @rm -Rf ${AZK_NPM_PATH}/* @rm -Rf ${AZK_NPM_PATH}/.install + @touch package.json @${AZK_BIN} nvm npm install npm@${NPM_VERSION} -g - @touch ${NPM_VERSION_FILE} + @${AZK_BIN} nvm npm --version > ${NPM_VERSION_FILE} ${NODE}: @echo "task: $@: ${NVM_NODE_VERSION}" @@ -95,7 +100,8 @@ test: bootstrap @echo "task: $@" ${AZK_BIN} nvm gulp test ${TEST_SLOW} $(if $(filter undefined,$(origin TEST_GREP)),"",--grep "${TEST_GREP}") -# PACKAGE +###### Package session ###### + AZK_PACKAGE_PATH:=${AZK_ROOT_PATH}/package AZK_PACKAGE_PREFIX:=${AZK_PACKAGE_PATH}/v${AZK_VERSION} PATH_USR_LIB_AZK:=${AZK_PACKAGE_PREFIX}/usr/lib/azk @@ -107,11 +113,12 @@ NODE_PACKAGE = ${PATH_AZK_NVM}/${NVM_NODE_VERSION}/bin/node PATH_MAC_PACKAGE:=${AZK_PACKAGE_PATH}/azk_${AZK_VERSION}.tar.gz # Locking npm version -PACKAGE_NPM_VERSIONS_PATH := ${PATH_AZK_NVM}/npm_versions -PACKAGE_NPM_VERSION_FILE := ${PACKAGE_NPM_VERSIONS_PATH}/${NPM_VERSION} +PACKAGE_NPM_VERSION_FILE := ${PATH_AZK_NVM}/npm_versions -package_clean_nvm_versions: - @mkdir -p ${PACKAGE_NPM_VERSIONS_PATH} && find ${PACKAGE_NPM_VERSION_FILE} -type f -not -name '${NPM_VERSION}' -delete || true +package_clean_nvm_versions: ${NODE_PACKAGE} + @if [ ! "$$(${AZK_BIN} nvm npm --version)" = "${NPM_VERSION}" ] ; then \ + rm ${PACKAGE_NPM_VERSION_FILE}; \ + fi # Build package folders tree package_brew: package_build fix_permissions check_version ${PATH_AZK_LIB}/vm/${AZK_ISO_VERSION} ${PATH_MAC_PACKAGE} @@ -155,10 +162,10 @@ ${PATH_USR_LIB_AZK}/npm-shrinkwrap.json: ${PATH_USR_LIB_AZK}/package.json @cd ${PATH_USR_LIB_AZK} && ${AZK_BIN} nvm npm shrinkwrap @rm ${PATH_NODE_MODULES} -${PACKAGE_NPM_VERSION_FILE}: ${NODE_PACKAGE} +${PACKAGE_NPM_VERSION_FILE}: @echo "task: $@" @${AZK_BIN} nvm npm install npm@${NPM_VERSION} -g - @touch ${PACKAGE_NPM_VERSION_FILE} + @${AZK_BIN} nvm npm --version > ${PACKAGE_NPM_VERSION_FILE} ${NODE_PACKAGE}: @echo "task: $@" @@ -211,6 +218,8 @@ ${PATH_MAC_PACKAGE}: ${AZK_PACKAGE_PREFIX} package_build: bootstrap $(FILES_TARGETS) copy_transpiled_files package_clean_nvm_versions ${PATH_NODE_MODULES} +###### Shell completion session ###### + AZK_SHARED_PATH=${AZK_ROOT_PATH}/shared USAGE_FILE_PATH=${AZK_SHARED_PATH}/locales/usage-en-US.txt @@ -266,4 +275,8 @@ ${ZSH_COMPLETION_PATH}/_azk: ${ZSH_COMPLETION_FILE} install_shell_completion: ${COMPLETIONS_FILES} +# Mark not a file tasks .PHONY: bootstrap clean package_brew package_mac package_deb package_rpm package_build package_clean copy_transpiled_files fix_permissions creating_symbolic_links dependencies check_version slow_test test generate_shell_completion install_shell_completion + +# Just for fast reference, use this for debug a variable +# $(info $(value VARIABLE_NAME)) diff --git a/README.md b/README.md index c563dee4..938f9131 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ You can find our documentation online at: http://docs.azk.io/ ## `Run Project` button -Clicking the `Run Project` button (or "azk button") on a GitHub repo is the best way to quickly and safely run its code on your local machine. +Clicking the `Run Project` button (or "azk button") on a GitHub repo is the best way to quickly and safely run its code on your local machine. ![Run project](https://s3-sa-east-1.amazonaws.com/assets.azk.io/run-project-illustrative.png) @@ -139,4 +139,4 @@ Check LEGAL and LICENSE files for more information. [dockerfile]: http://dockerfile.github.io [docker_registry]: http://registry.hub.docker.com [azkfile]: http://docs.azk.io/en/azkfilejs/README.html -[run_project_gallery]: https://github.com/run-project/gallery \ No newline at end of file +[run_project_gallery]: https://github.com/run-project/gallery diff --git a/docs/content/en/SUMMARY.md b/docs/content/en/SUMMARY.md index c6ce91eb..48db199b 100644 --- a/docs/content/en/SUMMARY.md +++ b/docs/content/en/SUMMARY.md @@ -14,7 +14,7 @@ * [Running an application](getting-started/running-application.md) * [Databases](getting-started/database.md) * [Logs](getting-started/logs.md) - * [Mounting files](getting-started/mounts-files.md) + * [Mapping files and folders](getting-started/mounts-files.md) * [Persisting data](getting-started/persisting-data.md) /*****************************************************/ * [Azkfile.js](azkfilejs/README.md) diff --git a/docs/content/en/deploy/README.md b/docs/content/en/deploy/README.md index 3460c410..0225a34b 100644 --- a/docs/content/en/deploy/README.md +++ b/docs/content/en/deploy/README.md @@ -44,7 +44,7 @@ systems({ }); ``` -Get a [personal access token](https://cloud.digitalocean.com/settings/applications) from DigitalOcean and put it into a file named `.env`: +Get a [personal access token](https://cloud.digitalocean.com/settings/applications) *(must be logged in)* from DigitalOcean and put it into a file named `.env`: ```bash $ cd path/to/the/project @@ -88,7 +88,7 @@ $ azk deploy restart You can customize your deploy settings by adding options into the `envs` object. The available options are: -- **DEPLOY_API_TOKEN**: User's API token in [DigitalOcean](https://cloud.digitalocean.com/settings/applications); +- **DEPLOY_API_TOKEN**: User's API token in [DigitalOcean](https://cloud.digitalocean.com/settings/applications) *(must be logged in)*; - **BOX_NAME** (*optional, default: `$AZK_MID || azk-deploy`*): Droplet name; - **BOX_REGION** (*optional, default: nyc3*): Region where the droplet is allocated. Check all available regions and their slugs [here](https://developers.digitalocean.com/documentation/v2/#list-all-regions); - **BOX_IMAGE** (*optional, default: ubuntu-14-04-x64*): Image used in the droplet. Default is Ubuntu 14.04 x86-64 and **we strongly recommend you to use it**. Check all available images and their slugs [here](https://developers.digitalocean.com/documentation/v2/#list-all-distribution-images); diff --git a/docs/content/en/getting-started/mounts-files.md b/docs/content/en/getting-started/mounts-files.md index b2cfff0a..c35732a4 100644 --- a/docs/content/en/getting-started/mounts-files.md +++ b/docs/content/en/getting-started/mounts-files.md @@ -1,4 +1,4 @@ -# Mapping files +# Mapping files and folders If we look at the generated `Azkfile.js`, you can see an entry in the `azkdemo` system called `mounts`: diff --git a/docs/content/en/getting-started/persisting-data.md b/docs/content/en/getting-started/persisting-data.md index b164d681..0e04a1e1 100644 --- a/docs/content/en/getting-started/persisting-data.md +++ b/docs/content/en/getting-started/persisting-data.md @@ -1,4 +1,4 @@ -# Persisting information +# Persisting data If you [set up a database](database.md), you will see that several _refresh_ on page [http://azkdemo.dev.azk.io](http://azkdemo.dev.azk.io) will increment our access counter. But if you run `azk restart`, as shown below: diff --git a/docs/content/en/images/README.md b/docs/content/en/images/README.md index eca15d72..7462b252 100644 --- a/docs/content/en/images/README.md +++ b/docs/content/en/images/README.md @@ -5,7 +5,7 @@ ### What are these images? -The images are the basis of the systems described in the [Azkfile.js](../azkfilejs/README.md). The [image](../azkfilejs/image.md) property is the starting point for the systems installation. Images can be of type [docker](../azkfilejs/image.html#docker) or [dockerfile](../azkfilejs/image.html#dockerfile). When the system image is set to [docker](../azkfilejs/image.html#docker) it is downloaded directly from the **[Docker Registry](https://registry.hub.docker.com/)**. When set to [dockerfile](../azkfilejs/image.html#dockerfile), a local file will be fetched. +The images are the basis of the systems described in the [Azkfile.js](../azkfilejs/README.md). The [image](../reference/azkfilejs/image.md) property is the starting point for the systems installation. Images can be of type [docker](../reference/azkfilejs/image.html#docker) or [dockerfile](../reference/azkfilejs/image.html#dockerfile). When the system image is set to [docker](../reference/azkfilejs/image.html#docker) it is downloaded directly from the **[Docker Registry](https://registry.hub.docker.com/)**. When set to [dockerfile](../reference/azkfilejs/image.html#dockerfile), a local file will be fetched. ### Docker Registry @@ -33,7 +33,7 @@ That way we can take advantage of the configuration of the base image (shown in ### Local Dockerfile -Besides pointing to [images](../azkfilejs/image.html) from the Docker registry, we can still customize our own images using a [local dockerfile](../azkfilejs/image.html#dockerfile). That way we can create completely custom images and test them locally. +Besides pointing to [images](../reference/azkfilejs/image.html) from the Docker registry, we can still customize our own images using a [local dockerfile](../reference/azkfilejs/image.html#dockerfile). That way we can create completely custom images and test them locally. We recommend that after the appropriate configuration, to facilitate teamwork, the image is sent to the [Docker Registry](https://registry.hub.docker.com/). That way other developers of your project will have easy access to the same environment as you. diff --git a/docs/content/en/installation/README.md b/docs/content/en/installation/README.md index 15c16439..3f4af774 100644 --- a/docs/content/en/installation/README.md +++ b/docs/content/en/installation/README.md @@ -11,25 +11,13 @@ The installation process will add the `azk` command to your system path, making ## azk express installation -The easiest way to install `azk` is to use the script below. It will identify your operating system, and if it is compatible perform all installation tasks. - -#### via curl - -```sh -curl -Ls http://azk.io/install.sh | bash -``` - -#### via wget - -```sh -wget -qO- http://azk.io/install.sh | bash -``` +!INCLUDE "express.md" ## Mininum requirements * 64-bit architecture machine * Mac OS X or Linux (Windows: planned) * bash (command-line tool available on virtually all unix systems) -* Internet connection (only needed while downloading [images](../imagens/README.md)) +* Internet connection (only needed while downloading [images](../images/README.md)) !INCLUDE "../getting-started/banner.md" diff --git a/docs/content/en/installation/express.md b/docs/content/en/installation/express.md new file mode 100644 index 00000000..e586ee32 --- /dev/null +++ b/docs/content/en/installation/express.md @@ -0,0 +1,11 @@ +The easiest way to install `azk` is to use the script below. It will identify your operating system, and if it is compatible perform all installation tasks. +​ +```bash +# recommended for Mac users +$ curl -Ls http://azk.io/install.sh | bash + +# or + +# recommended for Linux users +$ wget -qO- http://azk.io/install.sh | bash +``` diff --git a/docs/content/en/installation/linux.md b/docs/content/en/installation/linux.md index 48c1c64c..aad7d639 100644 --- a/docs/content/en/installation/linux.md +++ b/docs/content/en/installation/linux.md @@ -1,96 +1,123 @@ # Linux -> The easiest way to install azk is following [azk express installation](./README.html#azk-express-installation) section. - !INCLUDE "warning.md" ## Requirements -* Distributions (tested): Ubuntu 12.04/14.04 and Fedora 20 -* [Docker][docker] 1.3.0 +* **Distributions (tested)**: Ubuntu 12.04/14.04/15.04 and Fedora 20/21/22 +* **Architecture**: 64-bits +* [Docker][docker] 1.8.1 * Not running any services on ports `80` and `53` **Important**: If you are running any service on port `80` and/or `53` you must customize the configuration of `azk` setting the following variables `AZK_BALANCER_PORT` and `AZK_DNS_PORT` respectively, before running `azk agent start`. -## Ubuntu Trusty 14.04 (LTS) (64-bit) +## Installing the newest Docker version + +There are two ways to install Docker: + +1. Express installation: + + ```bash + $ curl -sSL https://get.docker.com/ | sh + # or + $ wget -qO- https://get.docker.com/ | sh + ``` + +2. Manual installation: + + - [Ubuntu][docker_ubuntu_installation] + - [Fedora][docker_fedora_installation] -1. Install Docker: +## Granting access to Docker service to your user - >Note that in [Docker's installation instructions][docker_ubuntu-trusty-1404-lts-64-bit], the first part is for an Ubuntu maintained package (_docker.com_) and not to the correct version (_docker-engine_), maintained by Docker. +The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, docker daemon always runs as the root user. - - Install **Docker's latest version** [docker-engine][docker_ubuntu_14_04_maintained-package-installation] - Docker has a `curl script` for easy installation; - - Include your local user in the [docker group][docker_root_access]; Logoff for user group settings to take effect; - - [Disable the use of dnsmasq][docker_ubuntu_dns]; - - Stop dnsmasq and ensure it won't start at login: +To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group. - ``` bash - $ sudo service dnsmasq stop - $ sudo update-rc.d -f dnsmasq remove - ``` +> **Warning**: The docker group is equivalent to the root user; For details on how this impacts security in your system, see [Docker Daemon Attack Surface][docker_daemon_attack_surface] for details. -2. Add the Azuki keys to your local keychain: +To create the docker group and add your user: + +1. Log into Ubuntu as a user with sudo privileges; + +2. Create the docker group and add your user ```bash - $ sudo apt-key adv --keyserver keys.gnupg.net \ - --recv-keys 022856F6D78159DF43B487D5C82CF0628592D2C9 + $ sudo usermod -aG docker $(id -un) ``` -3. Add the Azuki repository to the apt sources list: +3. Log out and log back in + + This ensures your user is running with the correct permissions. + +4. Verify your work by running docker without sudo ```bash - $ echo "deb [arch=amd64] http://repo.azukiapp.com trusty main" | \ - sudo tee /etc/apt/sources.list.d/azuki.list + $ docker run hello-world ``` -4. Update the list of packages and install azk: + If this fails with a message similar to this: ```bash - $ sudo apt-get update - $ sudo apt-get install azk + Cannot connect to the Docker daemon. Is 'docker daemon' running on this host? ``` -5. You can [start the azk agent](../getting-started/starting-agent.md) now, but, **make sure that the Docker service is running**; + Check that the `DOCKER_HOST` environment variable is not set for your shell. If it is, unset it. + +## Disabling dnsmasq service (Ubuntu-only) + +In desktop systems running Ubuntu or one of its derivatives, there is a default dns service (dnsmasq) +that conflicts with azk built-in dns service. +To solve this, it's needed to stop dnsmasq and ensure it won't be auto started after the next login. +To do this, run: -## Ubuntu Precise 12.04 (LTS) (64-bit) + ```bash + $ sudo service dnsmasq stop + $ sudo update-rc.d -f dnsmasq remove + ``` -1. Install Docker: +## Installing azk - - [Install **Docker's latest version**][docker_ubuntu_12_04]; - - Include your local user in the [docker group][docker_root_access]; Logoff for user group settings to take effect; - - [Disable the use of dnsmasq by NetworkManager][docker_ubuntu_dns]; - - Stop dnsmasq and ensure it won't start at login: +### Express installation - ``` bash - $ sudo service dnsmasq stop - $ sudo update-rc.d -f dnsmasq remove - ``` +!INCLUDE "express.md" -2. Add the Azuki keys to your local keychain: +### Ubuntu + +1. Add the Azuki keys to your local keychain: ```bash $ sudo apt-key adv --keyserver keys.gnupg.net \ --recv-keys 022856F6D78159DF43B487D5C82CF0628592D2C9 ``` -3. Add the Azuki repository to the apt sources list: +2. Add the Azuki repository to the apt sources list: ```bash + # Ubuntu Precise (12.04) $ echo "deb [arch=amd64] http://repo.azukiapp.com precise main" | \ sudo tee /etc/apt/sources.list.d/azuki.list + + # Ubuntu Trusty (14.04) + $ echo "deb [arch=amd64] http://repo.azukiapp.com trusty main" | \ + sudo tee /etc/apt/sources.list.d/azuki.list + + # Ubuntu Wily (15.10) + $ echo "deb [arch=amd64] http://repo.azukiapp.com wily main" | \ + sudo tee /etc/apt/sources.list.d/azuki.list ``` -4. Update the list of packages and install azk: +3. Update the list of packages and install azk: ```bash $ sudo apt-get update $ sudo apt-get install azk ``` -5. You can [start the azk agent](../getting-started/starting-agent.md) now, but, **make sure that the Docker service is running**; - +4. You can [start the azk agent](../getting-started/starting-agent.md) now, but, **make sure that the Docker service is running**; -## Fedora 20 +### Fedora 1. Add the Azuki keys to your local keychain: @@ -116,12 +143,10 @@ $ sudo yum install azk ``` -4. Include your local user in the [docker group][docker_root_access]; Logoff for user group settings to take effect; - -5. You can [start the azk agent](../getting-started/starting-agent.md) now, but, **make sure that the Docker service is running**; +4. You can [start the azk agent](../getting-started/starting-agent.md) now, but, **make sure that the Docker service is running**; -## Other distributions +### Other distributions Coming soon... diff --git a/docs/content/en/installation/warning.md b/docs/content/en/installation/warning.md index c2842f9b..26b274f0 100644 --- a/docs/content/en/installation/warning.md +++ b/docs/content/en/installation/warning.md @@ -1 +1 @@ -_Upgrade notice_: If you already have `azk` installed, prior to the `0.6.0` release, follow [these steps](upgrading.md#upgrading-from-azk--051) before moving forward. If you do not have `azk` installed ignore this warning and continue the installation normally. +**Upgrade notice**: If you already have `azk` installed, prior to the `0.6.0` release, follow [these steps](upgrading.md#upgrading-from-azk--051) before moving forward. If you do not have `azk` installed ignore this warning and continue the installation normally. diff --git a/docs/content/en/reference/cli/README.md b/docs/content/en/reference/cli/README.md index fe6d5cc4..68c26424 100644 --- a/docs/content/en/reference/cli/README.md +++ b/docs/content/en/reference/cli/README.md @@ -11,6 +11,7 @@ The command line is the main way to use `azk`. It's from the terminal that we ca - [azk info](info.md) - [azk init](init.md) - [azk logs](logs.md) +- [azk open](open.md) - [azk restart](restart.md) - [azk scale](scale.md) - [azk shell](shell.md) diff --git a/docs/content/en/reference/cli/agent.md b/docs/content/en/reference/cli/agent.md index 5167f937..bfb3a912 100644 --- a/docs/content/en/reference/cli/agent.md +++ b/docs/content/en/reference/cli/agent.md @@ -1,6 +1,6 @@ ## azk agent -Controls the `azk agent` service. For further information about the agent see its [documentation](../agent/README.md). +Controls the `azk agent` service. Check out [agent documentation](../../agent/README.md) for further informations. #### Usage: diff --git a/docs/content/en/reference/cli/start.md b/docs/content/en/reference/cli/start.md index 914d1367..1d5cfcb9 100644 --- a/docs/content/en/reference/cli/start.md +++ b/docs/content/en/reference/cli/start.md @@ -14,6 +14,7 @@ $ azk start [] [] [--git-ref=] [--reprovision --re ``` system System name where the action will take place. git-repo Github URL to clone and start + dest-path Destination path to clone project from Github ``` #### Options: @@ -40,18 +41,18 @@ azk start azkdemo --open ##### start the azkdemo from Github -All examples bellow will do the same thing: clone and start `azkdemo` directly from Github on branch `final` +All examples bellow will do the same thing: clone and start `azkdemo` directly from Github on branch `final` to `/tmp/azkdemoDest` folder ```bash # this way -azk start git@github.com:azukiapp/azkdemo.git --git-ref final +azk start git@github.com:azukiapp/azkdemo.git /tmp/azkdemoDest --git-ref final # or this way -azk start https://github.com/azukiapp/azkdemo.git --git-ref final +azk start https://github.com/azukiapp/azkdemo.git /tmp/azkdemoDest --git-ref final # or this way -azk start azukiapp/azkdemo --git-ref final +azk start azukiapp/azkdemo /tmp/azkdemoDest --git-ref final # or this way -azk start azukiapp/azkdemo#final +azk start azukiapp/azkdemo#final /tmp/azkdemoDest ``` diff --git a/docs/content/links.md b/docs/content/links.md index 0bb2f381..7e84352f 100644 --- a/docs/content/links.md +++ b/docs/content/links.md @@ -1,17 +1,14 @@ +[virtualbox_dl]: https://www.virtualbox.org/wiki/Downloads +[homebrew_cask]: https://github.com/phinze/homebrew-cask + [docker]: http://docker.com [docker_remote_api]: https://docs.docker.com/reference/api/docker_remote_api/ [docker_remote_api_create]: https://docs.docker.com/reference/api/docker_remote_api_v1.20/#create-a-container -[virtualbox_dl]: https://www.virtualbox.org/wiki/Downloads -[homebrew_cask]: https://github.com/phinze/homebrew-cask -[libnss-resolver]: https://github.com/azukiapp/libnss-resolver [docker_install]: https://docs.docker.com/installation/#installation +[docker_ubuntu_installation]: http://docs.docker.com/engine/installation/ubuntulinux/ +[docker_fedora_installation]: http://docs.docker.com/engine/installation/fedora/ +[docker_daemon_attack_surface]: https://docs.docker.com/engine/articles/security/#docker-daemon-attack-surface -[docker_ubuntu_14_04_maintained-package-installation]: https://docs.docker.com/installation/ubuntulinux/#installation -[docker_ubuntu-trusty-1404-lts-64-bit]: https://docs.docker.com/installation/ubuntulinux/#installation -[docker_ubuntu_12_04]: https://docs.docker.com/installation/ubuntulinux/#installation - -[docker_ubuntu_dns]: https://docs.docker.com/installation/ubuntulinux/#configure-a-dns-server-for-use-by-docker -[docker_root_access]: https://docs.docker.com/installation/ubuntulinux/#create-a-docker-group [postgres]: http://www.postgresql.org/ [redis]: http://redis.io/ [google_public_dns]: https://developers.google.com/speed/public-dns/ @@ -19,5 +16,6 @@ [azk_images_postgres]: http://images.azk.io/#/postgres [azk_images_redis]: http://images.azk.io/#/redis +[libnss-resolver]: https://github.com/azukiapp/libnss-resolver -[digital_ocean]: http://digitalocean.com/ \ No newline at end of file +[digital_ocean]: http://digitalocean.com/ diff --git a/docs/content/pt-BR/SUMMARY.md b/docs/content/pt-BR/SUMMARY.md index 240d9a6d..f367ee44 100644 --- a/docs/content/pt-BR/SUMMARY.md +++ b/docs/content/pt-BR/SUMMARY.md @@ -14,8 +14,8 @@ * [Rodando a aplicação](getting-started/running-application.md) * [Bancos de dados](getting-started/database.md) * [Logs](getting-started/logs.md) - * [Mapeando arquivos](getting-started/mounts-files.md) - * [Persistindo informações](getting-started/persisting-data.md) + * [Mapeando arquivos e diretórios](getting-started/mounts-files.md) + * [Persistindo dados](getting-started/persisting-data.md) /*****************************************************/ * [Azkfile.js](azkfilejs/README.md) /*****************************************************/ diff --git a/docs/content/pt-BR/deploy/README.md b/docs/content/pt-BR/deploy/README.md index 999cc341..b4e7b54d 100644 --- a/docs/content/pt-BR/deploy/README.md +++ b/docs/content/pt-BR/deploy/README.md @@ -44,7 +44,7 @@ systems({ }); ``` -Obtenha uma chave de acesso (personal access token) da DigitalOcean (via [este link](https://cloud.digitalocean.com/settings/applications)) e coloque-o em um arquivo chamado `.env`: +Obtenha uma [chave de acesso](https://cloud.digitalocean.com/settings/applications) (personal access token - *precisa estar logado*) da DigitalOcean e coloque-o em um arquivo chamado `.env`: ```bash $ cd path/to/the/project @@ -90,7 +90,7 @@ $ azk deploy restart Você pode alterar as configurações do deploy adicionando opções no objeto `env`. As opções disponíveis são: -- **DEPLOY_API_TOKEN**: User's API token in [DigitalOcean](https://cloud.digitalocean.com/settings/applications); +- **DEPLOY_API_TOKEN**: User's API token in [DigitalOcean](https://cloud.digitalocean.com/settings/applications) *(precisa estar logado)*; - **BOX_NAME** (*opcional, padrão: `$AZK_MID || azk-deploy`*): Nome do droplet; - **BOX_REGION** (*opcional, padrão: nyc3*): Região onde o droplet será alocado. Veja todas as regiões disponíveis se seus nomes `slug` correspondentes [aqui](https://developers.digitalocean.com/documentation/v2/#list-all-regions); - **BOX_IMAGE** (*opcional, padrão: ubuntu-14-04-x64*): Nome da imagem usada no droplet. O padrão é Ubuntu 14.04 x86-64 e **nós recomendamos fortemente que você a use**. Veja todas as imagens disponíveis e seus nomes `slug` correspondentes [aqui](https://developers.digitalocean.com/documentation/v2/#list-all-distribution-images); diff --git a/docs/content/pt-BR/getting-started/mounts-files.md b/docs/content/pt-BR/getting-started/mounts-files.md index 9d59db26..e6a0202f 100644 --- a/docs/content/pt-BR/getting-started/mounts-files.md +++ b/docs/content/pt-BR/getting-started/mounts-files.md @@ -1,4 +1,4 @@ -# Mapeando arquivos +# Mapeando arquivos e diretórios Se observarmos o `Azkfile.js` gerado, é possível notar uma entrada no sistema `azkdemo` chamada `mounts`: diff --git a/docs/content/pt-BR/getting-started/persisting-data.md b/docs/content/pt-BR/getting-started/persisting-data.md index 26746228..9914bc9d 100644 --- a/docs/content/pt-BR/getting-started/persisting-data.md +++ b/docs/content/pt-BR/getting-started/persisting-data.md @@ -1,4 +1,4 @@ -# Persistindo informações +# Persistindo dados Se você [configurou um banco de dados](database.md), verá que vários _refresh_, na página [http://azkdemo.dev.azk.io](http://azkdemo.dev.azk.io), fazem com que nosso contador de acessos seja incrementado. Porém se você executar um `azk restart` no sistema, como demonstrado abaixo: diff --git a/docs/content/pt-BR/images/README.md b/docs/content/pt-BR/images/README.md index 7fc8d430..b5733b31 100644 --- a/docs/content/pt-BR/images/README.md +++ b/docs/content/pt-BR/images/README.md @@ -5,7 +5,7 @@ Para automatizar a preparação do ambiente de desenvolvimento, o `azk` utiliza ### O que são imagens? -As imagens são a base dos sistemas definidos no [Azkfile.js](../azkfilejs/README.md). A propriedade [image](../azkfilejs/image.md) é o ponto de partida para a montagem dos sistemas. As imagens podem ser do tipo [docker](../azkfilejs/image.html#docker) ou [dockerfile](../azkfilejs/image.html#dockerfile). Quando a imagem do sistema estiver configurada como [docker](../azkfilejs/image.html#docker) ela será baixada diretamente do **[Registro do Docker](https://registry.hub.docker.com/)**. Quando configurada como [dockerfile](../azkfilejs/image.html#dockerfile) será buscado um arquivo local. +As imagens são a base dos sistemas definidos no [Azkfile.js](../azkfilejs/README.md). A propriedade [image](../reference/azkfilejs/image.md) é o ponto de partida para a montagem dos sistemas. As imagens podem ser do tipo [docker](../reference/azkfilejs/image.html#docker) ou [dockerfile](../reference/azkfilejs/image.html#dockerfile). Quando a imagem do sistema estiver configurada como [docker](../reference/azkfilejs/image.html#docker) ela será baixada diretamente do **[Registro do Docker](https://registry.hub.docker.com/)**. Quando configurada como [dockerfile](../reference/azkfilejs/image.html#dockerfile) será buscado um arquivo local. ### Registro do Docker diff --git a/docs/content/pt-BR/installation/README.md b/docs/content/pt-BR/installation/README.md index 9fbfeb45..8f57d13c 100644 --- a/docs/content/pt-BR/installation/README.md +++ b/docs/content/pt-BR/installation/README.md @@ -11,25 +11,13 @@ A instalação vai adicionar o comando `azk` ao path do sistema. Isso torna o co ## Instalação expressa do azk -A forma mais fácil de instalar o `azk` é utilizar o script abaixo. Ele vai identificar o sistema operacional que está usando e, se for compatível, realizar todos os processos de instalação. - -#### via curl - -```sh -curl -Ls http://azk.io/install.sh | bash -``` - -#### via wget - -```sh -wget -qO- http://azk.io/install.sh | bash -``` +!INCLUDE "express.md" ## Requisitos mínimos de instalação * Uma máquina com arquitetura 64 bits * Mac OS X ou Linux (Windows: planned) * bash (ferramenta de linha de comando disponível em praticamente todos os sistemas unix) -* Conexão com a internet (apenas durante o processo de download das [imagens](../imagens/README.md)) +* Conexão com a internet (apenas durante o processo de download das [imagens](../images/README.md)) !INCLUDE "../getting-started/banner.md" diff --git a/docs/content/pt-BR/installation/express.md b/docs/content/pt-BR/installation/express.md new file mode 100644 index 00000000..2d6996cc --- /dev/null +++ b/docs/content/pt-BR/installation/express.md @@ -0,0 +1,11 @@ +A forma mais fácil de instalar o `azk` é utilizar o script abaixo. Ele vai identificar o sistema operacional que está usando e, se for compatível, realizar todos os processos de instalação. + +```bash +# Recomendado para usuários de Mac +$ curl -Ls http://azk.io/install.sh | bash + +# ou + +# Recomendado para usuários de Linux +$ wget -qO- http://azk.io/install.sh | bash +``` diff --git a/docs/content/pt-BR/installation/linux.md b/docs/content/pt-BR/installation/linux.md index 9545428b..2e1ef80b 100644 --- a/docs/content/pt-BR/installation/linux.md +++ b/docs/content/pt-BR/installation/linux.md @@ -1,96 +1,123 @@ # Linux -> A forma mais simples de instalar o azk é seguindo a sessão [Instalação expressa do azk](./README.html#instalao-expressa-do-azk) - !INCLUDE "warning.md" ## Requisitos -* Distribuições (testadas): Ubuntu 12.04/14.04 e Fedora 20 -* [Docker][docker] 1.3.0 +* **Distribuições (testadas)**: Ubuntu 12.04/14.04/15.04 e Fedora 20/21/22 +* **Arquitetura**: 64-bits +* [Docker][docker] 1.8.1 * Não estar rodando nenhum serviço nas portas `80` e `53` **Importante**: Se você estiver rodando algum serviço nas portas `80` e/ou `53` você deve customizar a configuração do `azk` definindo as seguintes variáveis `AZK_BALANCER_PORT` e `AZK_DNS_PORT` respectivamente, antes de executar o `azk agent start`. -## Ubuntu Trusty 14.04 (LTS) (64-bit) +## Instalando a versão mais recente do Docker + +Existem duas formas de instalação do Docker: + +1. Instalação expressa: + + ```bash + $ curl -sSL https://get.docker.com/ | sh + # ou + $ wget -qO- https://get.docker.com/ | sh + ``` + +2. Instalação manual: + + - [Ubuntu][docker_ubuntu_installation] + - [Fedora][docker_fedora_installation] -1. Instale o Docker: +## Dando acesso ao serviço do Docker para o seu usuário - >Observe que pelas instruções de instalação do Docker no [site][docker_ubuntu-trusty-1404-lts-64-bit] deles, a primeira instrução de instalação é para um pacote mantido pela Ubuntu (_docker.com_) e não para a versão correta, mantida pelo Docker (_docker-engine_). +O _daemon_ do Docker utiliza um _socket Unix_ ao invés de uma porta TCP. Por padrão, o _socket Unix_ pertence ao usuário root e outros usuários só podem acessá-lo com `sudo`. Por essa razão, o _daemon_ do Docker sempre é executado como usuário `root`. - - Instale a versão mais recente do Docker [**docker-engine**][docker_ubuntu_14_04_maintained-package-installation]. Observe que no final das instruções, eles dispõem um `script curl` para facilitar a instalação. - - Inclua seu usuário local no [grupo docker][docker_root_access]; Faça um _logoff_ para que as configurações de grupo de usuários sejam ativadas; - - [Desabilite o uso de dnsmasq][docker_ubuntu_dns]; - - Pare o serviço do dnsmasq e garanta que ele não será iniciado automaticamente após o login: +Para evitar de sempre ter que usar `sudo` para os comandos do Docker, crie um grupo Unix chamado `docker` e adicione seus usuários a ele. Quando o _daemon_ é iniciado, ele permite ao grupo `docker` a leitura e escrita do _socket_ utilizado. - ``` bash - $ sudo service dnsmasq stop - $ sudo update-rc.d -f dnsmasq remove - ``` +> **Aviso**: O grupo `docker` é equivalente ao usuário root; Para detalhes sobre como isso impacta a segurança do seu sistema, acesse [Docker Daemon Attack Surface][docker_daemon_attack_surface]. -2. Adicionando as chaves do Azuki ao seu keychain local: +Para criar o grupo `docker` e adicionar seu usuário: + +1. Faça login com um usuário com privilégio para rodar o sudo; + +2. Crie o grupo `docker` e adicione seu usuário ```bash - $ sudo apt-key adv --keyserver keys.gnupg.net \ - --recv-keys 022856F6D78159DF43B487D5C82CF0628592D2C9 + $ sudo usermod -aG docker $(id -un) ``` -3. Adicione o repositório do Azuki a lista de sources do apt: +3. Faça logout e, em seguida, login + + Isso assegura que o usuário estará com as permissões corretas + +4. Verifique se está funcionando rodando o Docker sem sudo ```bash - $ echo "deb [arch=amd64] http://repo.azukiapp.com trusty main" | \ - sudo tee /etc/apt/sources.list.d/azuki.list + $ docker run hello-world ``` -4. Atualize a lista de pacotes e instale o azk: + Se o comando anterior falhar, a mensagem deve ser similar a seguinte: ```bash - $ sudo apt-get update - $ sudo apt-get install azk + Cannot connect to the Docker daemon. Is 'docker daemon' running on this host? ``` -5. Você pode [iniciar o agent](../getting-started/starting-agent.md) agora, porém, **tenha certeza de que o serviço do Docker está rodando**; + Cheque se a variável de ambiente `DOCKER_HOST` está definida em seu ambiente. Se estiver, dê `unset` nela. + +## Desabilite o serviço de dnsmasq (apenas para Ubuntu) + +Em sistemas desktop executando Ubuntu ou algum dos seus derivados, há um serviço +de dns padrão (dnsmasq) que conflita com o serviço de dns que há embutido no azk. +Para resolver esse conflito é preciso parar o dnsmasq e garantir que ele não +será executado automaticamente no próximo login. Para isso execute os comandos: -## Ubuntu Precise 12.04 (LTS) (64-bit) + ```bash + $ sudo service dnsmasq stop + $ sudo update-rc.d -f dnsmasq remove + ``` -1. Instale o Docker: +## Instalando o azk - - [Instale ** a versão mais recente do Docker**][docker_ubuntu_12_04] - - Configure para que seu usuário [tenha acesso ao Docker][docker_root_access]; Faça logoff para que as alterações tenham efeito; - - [Desabilite o uso do dnsmasq pelo NetworkManager][docker_ubuntu_dns]; - - Pare o serviço do dnsmasq e garanta que ele não será iniciado automaticamente após o login: +### Instalação expressa - ``` bash - $ sudo service dnsmasq stop - $ sudo update-rc.d -f dnsmasq remove - ``` +!INCLUDE "express.md" -2. Adicionando as chaves do Azuki ao seu keychain local: +### Ubuntu + +1. Adicionando as chaves do Azuki ao seu keychain local: ```bash $ sudo apt-key adv --keyserver keys.gnupg.net \ --recv-keys 022856F6D78159DF43B487D5C82CF0628592D2C9 ``` -3. Adicione o repositório do Azuki a lista de sources do apt: +2. Adicione o repositório do Azuki a lista de sources do apt: ```bash + # Ubuntu Precise (12.04) $ echo "deb [arch=amd64] http://repo.azukiapp.com precise main" | \ sudo tee /etc/apt/sources.list.d/azuki.list + + # Ubuntu Trusty (14.04) + $ echo "deb [arch=amd64] http://repo.azukiapp.com trusty main" | \ + sudo tee /etc/apt/sources.list.d/azuki.list + + # Ubuntu Wily (15.10) + $ echo "deb [arch=amd64] http://repo.azukiapp.com wily main" | \ + sudo tee /etc/apt/sources.list.d/azuki.list ``` -4. Atualize a lista de pacotes e instale o azk: +3. Atualize a lista de pacotes e instale o azk: ```bash $ sudo apt-get update $ sudo apt-get install azk ``` -5. Você pode [iniciar o agent](../getting-started/starting-agent.md) agora, porém, **tenha certeza de que o serviço do Docker está rodando**; +4. Você pode [iniciar o agent](../getting-started/starting-agent.md) agora, porém, **tenha certeza de que o serviço do Docker está rodando**; - -## Fedora 20 +### Fedora 1. Adicione as chaves do Azuki ao seu keychain local: @@ -116,12 +143,9 @@ $ sudo yum install azk ``` -4. Inclua seu usuário local no [grupo docker][docker_root_access]; Faça um _logoff_ para que as configurações de grupo de usuários sejam ativadas; - -5. Você pode [iniciar o agent](../getting-started/starting-agent.md) agora, porém, **tenha certeza de que o serviço do Docker está rodando**; - +4. Você pode [iniciar o agent](../getting-started/starting-agent.md) agora, porém, **tenha certeza de que o serviço do Docker está rodando**; -## Outras distribuições +### Outras distribuições Em breve... diff --git a/docs/content/pt-BR/installation/warning.md b/docs/content/pt-BR/installation/warning.md index 675aa15d..c9ad38e5 100644 --- a/docs/content/pt-BR/installation/warning.md +++ b/docs/content/pt-BR/installation/warning.md @@ -1 +1 @@ -_Aviso sobre upgrade_: Se você já tem o `azk` nas versões anteriores a `0.6.0` instalado, siga [estes passos](upgrading.md#atualizando-a-partir-azk--051) antes de continuar. Se você não tem o `azk` instalado ignore este aviso e continue a instalação normalmente. +**Aviso sobre upgrade**: Se você já tem o `azk` nas versões anteriores a `0.6.0` instalado, siga [estes passos](upgrading.md#atualizando-a-partir-azk--051) antes de continuar. Se você não tem o `azk` instalado ignore este aviso e continue a instalação normalmente. diff --git a/docs/content/pt-BR/reference/cli/README.md b/docs/content/pt-BR/reference/cli/README.md index a462af9b..598293a5 100644 --- a/docs/content/pt-BR/reference/cli/README.md +++ b/docs/content/pt-BR/reference/cli/README.md @@ -11,6 +11,7 @@ A linha de comando é a principal forma de utilização do `azk`. É a partir do - [azk info](info.md) - [azk init](init.md) - [azk logs](logs.md) +- [azk open](open.md) - [azk restart](restart.md) - [azk scale](scale.md) - [azk shell](shell.md) diff --git a/docs/content/pt-BR/reference/cli/agent.md b/docs/content/pt-BR/reference/cli/agent.md index 36fe6fce..8ded8fec 100644 --- a/docs/content/pt-BR/reference/cli/agent.md +++ b/docs/content/pt-BR/reference/cli/agent.md @@ -1,6 +1,6 @@ ## azk agent -Controla o serviço `azk agent`. Para mais informações sobre o agent [acesse](../agent/README.md). +Controla o serviço `azk agent`. Acesse a [documentação do agent](../../agent/README.md) para maiores informações. #### Uso: diff --git a/docs/content/pt-BR/reference/cli/start.md b/docs/content/pt-BR/reference/cli/start.md index f55f15a1..ac98e72c 100644 --- a/docs/content/pt-BR/reference/cli/start.md +++ b/docs/content/pt-BR/reference/cli/start.md @@ -13,6 +13,7 @@ ``` system Nome do sistema que receberá a ação. git-repo Github URL para clonar and iniciar + dest-path Pasta destino que será clonado o repositório do Github ``` #### Opções: @@ -39,18 +40,18 @@ $ azk start azkdemo --open ##### inicia o azkdemo à partir do Github -Todos os exemplos abaixo fazem a mesma coisa: clonam o `azkdemo` diretamente do Github na branch `final` e já iniciam o sistema. +Todos os exemplos abaixo fazem a mesma coisa: clonam e iniciam o repositório `azkdemo` diretamente do Github na branch `final` para pasta `/tmp/azkdemoDest`. ```bash # assim -azk start git@github.com:azukiapp/azkdemo.git --git-ref final +azk start git@github.com:azukiapp/azkdemo.git /tmp/azkdemoDest --git-ref final # ou assim -azk start https://github.com/azukiapp/azkdemo.git --git-ref final +azk start https://github.com/azukiapp/azkdemo.git /tmp/azkdemoDest --git-ref final # ou assim -azk start azukiapp/azkdemo --git-ref final +azk start azukiapp/azkdemo /tmp/azkdemoDest --git-ref final # ou assim -azk start azukiapp/azkdemo#final +azk start azukiapp/azkdemo#final /tmp/azkdemoDest ``` diff --git a/gulpfile.js b/gulpfile.js index bb3aaedc..0660f19f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -82,6 +82,8 @@ gulp.task('publish', function() { 'package/brew/*.tar.gz', 'package/public/!(fedora20)/**/*', 'package/fedora20/**/*', + 'package/public/!(fedora23)/**/*', + 'package/fedora23/**/*', ]; var add_prefix = function(cond, prefix) { @@ -93,6 +95,7 @@ gulp.task('publish', function() { return gulp.src(src) // Set dest path .pipe(add_prefix(/package\/fedora20/, 'fedora20')) + .pipe(add_prefix(/package\/fedora23/, 'fedora23')) .pipe(add_prefix(/package\/brew/, 'mac')) // publisher will add Content-Length, Content-Type and headers specified above diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e1b9baa5..7e8511f1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "azk", - "version": "0.16.0", + "version": "0.16.1", "dependencies": { "archiver": { "version": "0.13.1", diff --git a/package.json b/package.json index f8f0f136..76ffa7c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azk", - "version": "0.16.0", + "version": "0.16.1", "description": "Orchestrate development environments with agility and automation", "main": "index.js", "scripts": { diff --git a/shared/Azkfile.js b/shared/Azkfile.js index 0cdad24a..2dd7a54b 100644 --- a/shared/Azkfile.js +++ b/shared/Azkfile.js @@ -27,7 +27,7 @@ systems({ 'balancer-redirect': { extends: 'azktcl-base', command: "env; socat TCP4-LISTEN:$HTTP_PORT,fork TCP:$BALANCER_IP:$BALANCER_PORT", - wait: { retry: 3 }, + wait: 10, ports: { http: "#{azk.balancer_port}:#{azk.balancer_port}/tcp", 53: disable, diff --git a/shared/locales/en-US.js b/shared/locales/en-US.js index f7d703a8..b621d3b4 100644 --- a/shared/locales/en-US.js +++ b/shared/locales/en-US.js @@ -171,12 +171,8 @@ module.exports = { mounted : "Shared folder has been successfully mounted.", }, - socat: { - progress: "Trying to connect to docker (timeout: %(timeout)ds)...", - }, - - 'balancer-redirect_connect': { - progress: "Check if balancer redirect service is up (%(uri)s) (timeout: %(timeout)ds)...", + 'balancer-redirect': { + wait: "Check if balancer redirect service is up (%(uri)s) (timeout: %(timeout)ds)...", }, balancer: { diff --git a/shared/locales/usage-en-US.txt b/shared/locales/usage-en-US.txt index 0b3cb8f9..c6aadb71 100644 --- a/shared/locales/usage-en-US.txt +++ b/shared/locales/usage-en-US.txt @@ -124,9 +124,10 @@ Examples: azk start https://github.com/azukiapp/azkdemo # clone and start (https) azk start https://github.com/azukiapp/azkdemo#master # clone master azk start azukiapp/azkdemo # clone and start (short) - azk start azukiapp/azkdemo --git-ref master # branch master - azk start azukiapp/azkdemo --git-ref 0.0.1 # tag 0.0.1 - azk start azukiapp/azkdemo --git-ref 880d01a # commit 880d01a + azk start azukiapp/azkdemo /tmp/azkdemoDest # clone and start (to /tmp/azkdemoDest folder) + azk start azukiapp/azkdemo --git-ref master # branch master (to ./azkdemo relative folder) + azk start azukiapp/azkdemo --git-ref 0.0.1 # tag 0.0.1 (to ./azkdemo relative folder) + azk start azukiapp/azkdemo --git-ref 880d01a # commit 880d01a (to ./azkdemo relative folder) azk deploy # run `deploy fast` azk deploy shell azk deploy full diff --git a/shared/scripts/install.sh b/shared/scripts/install.sh index 51388eaf..50b07a0f 100755 --- a/shared/scripts/install.sh +++ b/shared/scripts/install.sh @@ -84,6 +84,12 @@ err() { log err $@; } main(){ + if [[ "$1" == "stage" ]]; then + AZUKIAPP_REPO_URL="http://repo-stage.azukiapp.com" + else + AZUKIAPP_REPO_URL="http://repo.azukiapp.com" + fi + step "Checking platform" # Detecting PLATFORM and ARCH @@ -141,27 +147,46 @@ main(){ super echo "sudo enabled" > /dev/null fi - # Ubuntu 14.04 - if [[ $ID == "ubuntu" && $OS_VERSION == "14.04" ]]; then - echo "deb [arch=amd64] http://repo.azukiapp.com trusty main" | super tee /etc/apt/sources.list.d/azuki.list 1>/dev/null 2>&1 - install_azk_ubuntu - add_user_to_docker_group - disable_dnsmasq - success - fi - - # Ubuntu 12.04 - if [[ $ID == "ubuntu" && $OS_VERSION == "12.04" ]]; then - echo "deb [arch=amd64] http://repo.azukiapp.com precise main" | super tee /etc/apt/sources.list.d/azuki.list 1>/dev/null 2>&1 - install_azk_ubuntu - add_user_to_docker_group - disable_dnsmasq - success + if [[ $ID == "ubuntu" ]]; then + case $OS_VERSION in + "12.04" ) + UBUNTU_CODENAME="precise" + ;; + "14.04" ) + UBUNTU_CODENAME="trusty" + ;; + "15.10" ) + UBUNTU_CODENAME="wily" + ;; + esac + + if [[ -z ${UBUNTU_CODENAME} ]]; then + add_report " Unsupported Ubuntu version." + add_report " Feel free to ask support for it by opening an issue at:" + add_report " https://github.com/azukiapp/azk/issues" + fail + else + install_azk_ubuntu + add_user_to_docker_group + disable_dnsmasq + success + fi fi - # Fedora 20 - if [[ $ID == "fedora" && ( $OS_VERSION == "20" || $OS_VERSION == "21" ) ]]; then - install_azk_fedora + if [[ $ID == "fedora" ]]; then + case $OS_VERSION in + "20"|"21"|"22" ) + FEDORA_VERSION="20" + ;; + "23" ) + FEDORA_VERSION="23" + ;; + * ) + add_report " Unsupported Fedora version." + add_report " Feel free to ask support for it by opening an issue at:" + add_report " https://github.com/azukiapp/azk/issues" + fail + esac add_user_to_docker_group success fi @@ -175,13 +200,13 @@ check_docker_installation() { if hash docker 2>/dev/null; then step_done - debug ' Docker is instaled, skipping docker installation.' - debug ' To update docker, run command bellow:' + debug ' Docker is installed, skipping Docker installation.' + debug ' To update Docker, run the command bellow:' debug ' $ curl -sSL https://get.docker.com/ | sh' else step_fail add_report 'azk needs Docker to be installed.' - add_report ' to install docker run command bellow:' + add_report ' to install Docker run command bellow:' add_report ' $ curl -sSL https://get.docker.com/ | sh' fail fi @@ -194,6 +219,7 @@ install_azk_ubuntu() { echo "" 1>&2 super apt-key adv --keyserver keys.gnupg.net --recv-keys 022856F6D78159DF43B487D5C82CF0628592D2C9 1>/dev/null 2>&1 + echo "deb [arch=amd64] ${AZUKIAPP_REPO_URL} ${UBUNTU_CODENAME} main" | super tee /etc/apt/sources.list.d/azuki.list 1>/dev/null 2>&1 super apt-get update 1>/dev/null super apt-get install azk -y 1>/dev/null @@ -206,16 +232,22 @@ install_azk_fedora() { step "Installing azk" echo "" 1>&2 - super rpm --import 'http://repo.azukiapp.com/keys/azuki.asc' 1>/dev/null + super rpm --import "${AZUKIAPP_REPO_URL}/keys/azuki.asc" 1>/dev/null echo "[azuki] name=azk -baseurl=http://repo.azukiapp.com/fedora20 +baseurl=${AZUKIAPP_REPO_URL}/fedora${FEDORA_VERSION} enabled=1 gpgcheck=1 " | super tee /etc/yum.repos.d/azuki.repo 1>/dev/null 2>&1 - super yum install azk -y 1>/dev/null + if [[ "${FEDORA_VERSION}" == "20" ]]; then + FEDORA_PKG_MANAGER="yum" + else + FEDORA_PKG_MANAGER="dnf" + fi + + super ${FEDORA_PKG_MANAGER} install azk -y 1>/dev/null step_done } @@ -225,7 +257,7 @@ add_user_to_docker_group() { return 0; fi - step "Adding current user to docker user group" + step "Adding current user to Docker user group" echo "" 1>&2 super groupadd docker 1>/dev/null @@ -235,7 +267,7 @@ add_user_to_docker_group() { step_done add_report "Log out required." - add_report " non-sudo access to docker client has been configured," + add_report " non-sudo access to Docker client has been configured," add_report " but you should log out and then log in again for these changes to take effect." } @@ -303,4 +335,4 @@ success() { exit 0 } -main +main "${@}" diff --git a/src/agent/balancer.js b/src/agent/balancer.js index 4e78d8ea..bed02cf2 100644 --- a/src/agent/balancer.js +++ b/src/agent/balancer.js @@ -176,7 +176,11 @@ var Balancer = { _waitDocker(timeout_max = 20000) { var docker_host = config("docker:host"); - var promise = net.waitService(docker_host, { timeout: timeout_max, context: "balancer" }); + var promise = net.waitService(docker_host, { + timeout: timeout_max, + context: "balancer", + publish_retry: false, + }); return promise.then((success) => { if (!success) { throw new AgentStartError(t('errors.connect_docker_unavailable')); diff --git a/src/cli/helpers.js b/src/cli/helpers.js index cf0c7a73..091882a0 100644 --- a/src/cli/helpers.js +++ b/src/cli/helpers.js @@ -136,11 +136,18 @@ var Helpers = { } } break; - case "try_connect": - var tKey = [...keys].concat("progress"); + case "wait_port": + var tKey = ["status", event.system, "wait"]; log.info_t(tKey, event); cmd.ok(tKey, event); break; + case "try_connect": + if (context === "balancer") { + var tKey = [...keys].concat("progress"); + log.info_t(tKey, event); + cmd.ok(tKey, event); + } + break; case "ssh": if (context === "stderr") { break; diff --git a/src/libexec/make b/src/libexec/make new file mode 100755 index 00000000..190c5220 --- /dev/null +++ b/src/libexec/make @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/bin/make -e "${@}" diff --git a/src/libexec/package-tools/fedora/generate.sh b/src/libexec/package-tools/fedora/generate.sh index 81461734..1920404e 100755 --- a/src/libexec/package-tools/fedora/generate.sh +++ b/src/libexec/package-tools/fedora/generate.sh @@ -1,7 +1,7 @@ #! /bin/bash if [[ $# < 2 ]] || [[ $# > 3 ]]; then - echo "Usage: ${0##*/} {distro} {secret_key} [--clean-repo]" + echo "Usage: ${0##*/} {secret_key} {distro} [--clean-repo]" exit 1 fi @@ -9,8 +9,17 @@ if [[ $# == 3 ]] && [[ "$3" == "--clean_repo" ]]; then CLEAN_REPO=true fi -if [[ ! -e Azkfile.js ]]; then - echo "Run this script in the project root" +# Get azk root path +abs_dir() { + cd "${1%/*}"; link=`readlink ${1##*/}`; + if [ -z "$link" ]; then pwd; else abs_dir $link; fi +} + +export AZK_ROOT_PATH=`cd \`abs_dir ${BASH_SOURCE:-$0}\`/../../../..; pwd` +cd $AZK_ROOT_PATH + +if [[ ! -e ./bin/azk ]]; then + echo "$AZK_ROOT_PATH is not azk project root" exit 2 fi @@ -18,8 +27,8 @@ set -x set -e export PATH=`pwd`/bin:$PATH -export DISTRO=$1 -export SECRET_KEY=$2 +export SECRET_KEY=$1 +export DISTRO=$2 gpg --import $SECRET_KEY diff --git a/src/libexec/package-tools/pack.sh b/src/libexec/package-tools/pack.sh index 0ee439a8..7d8f7de2 100755 --- a/src/libexec/package-tools/pack.sh +++ b/src/libexec/package-tools/pack.sh @@ -225,6 +225,12 @@ setup_test() { git clone $TEST_PROJECT $TEST_DIR } +linux_generate() { + mount=${SECRET_KEY}:/root/key.asc + script="src/libexec/package-tools/${1}/generate.sh"; shift + azk shell package --mount=${mount} -- ${script} /root/key.asc "${@}" +} + # Go to azk path cd $AZK_ROOT_PATH source .dependencies @@ -256,7 +262,8 @@ if [[ $BUILD_DEB == true ]]; then step_run "Downloading libnss-resolver" \ mkdir -p package/deb \ && wget -q "${LIBNSS_RESOLVER_REPO}/ubuntu12-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" -O "package/deb/precise-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" \ - && wget -q "${LIBNSS_RESOLVER_REPO}/ubuntu14-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" -O "package/deb/trusty-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" + && wget -q "${LIBNSS_RESOLVER_REPO}/ubuntu14-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" -O "package/deb/trusty-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" \ + && wget -q "${LIBNSS_RESOLVER_REPO}/ubuntu15-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" -O "package/deb/wily-libnss-resolver_${LIBNSS_RESOLVER_VERSION}_amd64.deb" EXTRA_FLAGS="" if [[ $LINUX_BUILD_WAS_EXECUTED == true || $NO_CLEAN_LINUX == true ]]; then @@ -265,15 +272,21 @@ if [[ $BUILD_DEB == true ]]; then step_run "Creating deb packages" make package_deb ${EXTRA_FLAGS} - step_run "Generating Ubuntu 12.04 repository" azk shell --shell=/bin/sh package -c "src/libexec/package-tools/ubuntu/generate.sh ${LIBNSS_RESOLVER_VERSION} precise ${SECRET_KEY} ${CLEAN_REPO}" - if [[ $NO_TEST != true ]]; then - step_run "Testing Ubuntu 12.04 repository" ${AZK_BUILD_TOOLS_PATH}/test.sh ubuntu12 $TEST_ARGS - fi + UBUNTU_VERSIONS=( "ubuntu12:precise" "ubuntu14:trusty" "ubuntu15:wily" ) + for UBUNTU_VERSION in "${UBUNTU_VERSIONS[@]}"; do - step_run "Generating Ubuntu 14.04 repository" azk shell --shell=/bin/sh package -c "src/libexec/package-tools/ubuntu/generate.sh ${LIBNSS_RESOLVER_VERSION} trusty ${SECRET_KEY} ${CLEAN_REPO}" - if [[ $NO_TEST != true ]]; then - step_run "Testing Ubuntu 14.04 repository" ${AZK_BUILD_TOOLS_PATH}/test.sh ubuntu14 $TEST_ARGS - fi + UBUNTU_VERSION_NUMBER="${UBUNTU_VERSION%%:*}" + UBUNTU_VERSION_CODENAME="${UBUNTU_VERSION##*:}" + + step_run "Generating ${UBUNTU_VERSION_NUMBER} repository" \ + linux_generate ubuntu ${LIBNSS_RESOLVER_VERSION} ${UBUNTU_VERSION_CODENAME} ${CLEAN_REPO} + + if [[ $NO_TEST != true ]]; then + step_run "Testing ${UBUNTU_VERSION_NUMBER} repository" \ + ${AZK_BUILD_TOOLS_PATH}/test.sh ${UBUNTU_VERSION_NUMBER} $TEST_ARGS + fi + + done SUCCESS_STEP=true ) && LINUX_BUILD_WAS_EXECUTED=true @@ -291,11 +304,12 @@ if [[ $BUILD_RPM == true ]]; then ( set -e - [[ ! -z "${CLEAN_REPO}" ]] && step_run "Cleaning environment" rm -Rf package/rpm package/fedora20 + [[ ! -z "${CLEAN_REPO}" ]] && step_run "Cleaning environment" rm -Rf package/rpm package/fedora20 package/fedora23 step_run "Downloading libnss-resolver" \ mkdir -p package/rpm \ - && wget "${LIBNSS_RESOLVER_REPO}/fedora20-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" -O "package/rpm/fedora20-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" + && wget "${LIBNSS_RESOLVER_REPO}/fedora20-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" -O "package/rpm/fedora20-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" \ + && wget "${LIBNSS_RESOLVER_REPO}/fedora23-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" -O "package/rpm/fedora23-libnss-resolver-${LIBNSS_RESOLVER_VERSION}-1.x86_64.rpm" EXTRA_FLAGS="" if [[ $LINUX_BUILD_WAS_EXECUTED == true || $NO_CLEAN_LINUX == true ]]; then @@ -303,10 +317,15 @@ if [[ $BUILD_RPM == true ]]; then fi step_run "Creating rpm packages" make package_rpm ${EXTRA_FLAGS} - step_run "Generating Fedora 20 repository" azk shell --shell=/bin/sh package -c "src/libexec/package-tools/fedora/generate.sh fedora20 ${SECRET_KEY} ${CLEAN_REPO}" - if [[ $NO_TEST != true ]]; then - step_skip "Testing Fedora 20 repository" ${AZK_BUILD_TOOLS_PATH}/test.sh fedora20 $TEST_ARGS - fi + + FEDORA_VERSIONS=( "fedora20" "fedora23" ) + for FEDORA_VERSION in "${FEDORA_VERSIONS[@]}"; do + step_run "Generating ${FEDORA_VERSION} repository" \ + linux_generate fedora ${FEDORA_VERSION} ${CLEAN_REPO} + if [[ $NO_TEST != true ]]; then + step_skip "Testing ${FEDORA_VERSION} repository" ${AZK_BUILD_TOOLS_PATH}/test.sh ${FEDORA_VERSION} ${TEST_ARGS} + fi + done SUCCESS_STEP=true ) && LINUX_BUILD_WAS_EXECUTED=true diff --git a/src/libexec/package-tools/server b/src/libexec/package-tools/server index 4762f63d..e81f711e 100755 --- a/src/libexec/package-tools/server +++ b/src/libexec/package-tools/server @@ -11,9 +11,13 @@ var server = require('http').Server(app); // server as static var path = require('path'); -app.use("/fedora20", express.static( - path.resolve(__dirname, "..", "..", "..", "package", "fedora20") -)); + +var fedora_versions = [ "fedora20", "fedora23" ]; +for (var fedora_version of fedora_versions) { + app.use(path.join('/', fedora_version), express.static( + path.resolve(__dirname, "..", "..", "..", "package", path.join('/', fedora_version)) + )); +} app.use("/", express.static(path.join(apptly.rootDir, 'public'))); // run diff --git a/src/libexec/package-tools/test.sh b/src/libexec/package-tools/test.sh index cbf7c9ef..4b691153 100755 --- a/src/libexec/package-tools/test.sh +++ b/src/libexec/package-tools/test.sh @@ -5,7 +5,9 @@ if [[ $# < 1 ]] || [[ $# > 2 ]]; then echo " Supported SOs:" echo " - ubuntu12" echo " - ubuntu14" + echo " - ubuntu15" echo " - fedora20" + echo " - fedora23" exit 1 fi @@ -32,10 +34,18 @@ case "${SO}" in DISTRO='ubuntu' CODENAME='trusty' ;; - fedora ) + ubuntu15 ) + DISTRO='ubuntu' + CODENAME='wily' + ;; + fedora20 ) DISTRO='fedora' CODENAME='fedora20' ;; + fedora23 ) + DISTRO='fedora' + CODENAME='fedora23' + ;; * ) echo "${SO} is not a supported SO. Check it and try again." exit 3 diff --git a/src/libexec/package-tools/ubuntu/generate.sh b/src/libexec/package-tools/ubuntu/generate.sh index fa65c6c6..eff0069c 100755 --- a/src/libexec/package-tools/ubuntu/generate.sh +++ b/src/libexec/package-tools/ubuntu/generate.sh @@ -1,7 +1,7 @@ #! /bin/bash if [[ $# < 3 ]] || [[ $# > 4 ]]; then - echo "Usage: ${0##*/} {libnss_resolver_version} {distro} {secret_key} [--clean_repo]" + echo "Usage: ${0##*/} {secret_key} {libnss_resolver_version} {distro} [--clean_repo]" exit 1 fi @@ -9,9 +9,18 @@ if [[ $# == 4 ]] && [[ "$4" == "--clean_repo" ]]; then CLEAN_REPO=true fi -if [[ ! -e Azkfile.js ]]; then - echo "Run this script in the project root" - exit 2 +# Get azk root path +abs_dir() { + cd "${1%/*}"; link=`readlink ${1##*/}`; + if [ -z "$link" ]; then pwd; else abs_dir $link; fi +} + +export AZK_ROOT_PATH=`cd \`abs_dir ${BASH_SOURCE:-$0}\`/../../../..; pwd` +cd $AZK_ROOT_PATH + +if [[ ! -e ./bin/azk ]]; then + echo "$AZK_ROOT_PATH is not azk project root" + exit 2 fi set -e @@ -20,9 +29,9 @@ export PATH=`pwd`/bin:$PATH DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export VERSION=$( azk version | awk '{ print $2 }' ) -export LIBNSS_RESOLVER_VERSION=$1 -export DISTRO=$2 && export REPO=azk-${DISTRO} -export SECRET_KEY=$3 +export SECRET_KEY=$1 +export LIBNSS_RESOLVER_VERSION=$2 +export DISTRO=$3 && export REPO=azk-${DISTRO} RELEASE_CHANNEL=$( echo "${VERSION}" | sed s/[^\\-]*// | sed s/^\\-// | sed s/\\..*// ) if [[ -z "${RELEASE_CHANNEL}" ]]; then diff --git a/src/libexec/package.sh b/src/libexec/package.sh index 0d49c9ce..32b748f2 100755 --- a/src/libexec/package.sh +++ b/src/libexec/package.sh @@ -70,7 +70,6 @@ case $pkg_type in --depends \"docker-engine >= ${AZK_DOCKER_MIN_VERSION}\" \ --depends \"libnss-resolver >= ${LIBNSS_RESOLVER_VERSION}\" \ --depends \"rsync >= ${RSYNC_MIN_VERSION}\" \ - --depends \"git\" \ --rpm-use-file-permissions \ --rpm-user root --rpm-group root \ " @@ -80,7 +79,7 @@ case $pkg_type in --depends \"docker-engine (>= ${AZK_DOCKER_MIN_VERSION})\" \ --depends \"libnss-resolver (>= ${LIBNSS_RESOLVER_VERSION})\" \ --depends \"rsync (>= ${RSYNC_MIN_VERSION})\" \ - --depends \"git\" \ + --deb-suggests \"git-core\" \ --deb-user root --deb-group root \ " ;; diff --git a/src/sync/worker.js b/src/sync/worker.js index 94bbe68b..621beb9f 100644 --- a/src/sync/worker.js +++ b/src/sync/worker.js @@ -86,7 +86,7 @@ export class Worker { opts.except = _.flatten([opts.except || []]); var exists, file, file_content = ''; - var candidates = opts.except_from ? [opts.except_from] : []; + var candidates = opts.except_from ? [opts.except_from] : []; candidates = candidates.concat([ path.join(origin, ".syncignore"), path.join(origin, ".gitignore"), diff --git a/src/system/index.js b/src/system/index.js index 1afc7c4c..11233243 100644 --- a/src/system/index.js +++ b/src/system/index.js @@ -607,7 +607,7 @@ export class System { mount.options = mount.options || {}; mount.options.except = _.uniq(_.flatten([mount.options.except || []]) .concat(mounted_subpaths) - .concat(['.syncignore', '.gitignore', '.azk/', '.git/', 'Azkfile.js'])); + .concat(['.syncignore', '.gitignore', '.azk/', '.git/'])); syncs[host_sync_path] = { guest_folder: this._sync_path(mount.value), diff --git a/src/system/run.js b/src/system/run.js index 8dd936fc..8d3b428b 100644 --- a/src/system/run.js +++ b/src/system/run.js @@ -297,12 +297,14 @@ var Run = { }, }; + var address = `tcp://${host}:${port_data.port}`; publish("system.run._wait_available.status", _.merge(port_data, { + uri : address, + timeout: timeout, name: system.portName(port_data.name), type: "wait_port", system: system.name })); - var address = `tcp://${host}:${port_data.port}`; var running = yield net.waitService(address, wait_opts); if (!running) { diff --git a/src/utils/net.js b/src/utils/net.js index 0cec1ab4..e3c06095 100644 --- a/src/utils/net.js +++ b/src/utils/net.js @@ -217,7 +217,7 @@ var net = { return defer((resolve) => { var attempts = 1, max = opts.nodeRetry_opts.retries; var connect = () => { - if (opts.publish_retry) { + if (opts.publish_retry || attempts == 1) { publish("utils.net.waitService.status", _.merge({ uri : uri, type: 'try_connect', @@ -260,8 +260,6 @@ var net = { var client = null; var attempts = 1, max = retry; var connect = () => { - publish("utils.net.waitForwardingService.status", { type: 'try_connect', attempts: attempts, max: max }); - var timeout_func = function() { attempts += 1; connect(); @@ -289,6 +287,7 @@ var net = { }); }; + publish("utils.net.waitForwardingService.status", { type: 'try_connect', attempts: attempts, max: max }); connect(); }); },