Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/0.16.1' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxlli committed Nov 8, 2015
2 parents 9e48912 + d05b966 commit 4a74ca2
Show file tree
Hide file tree
Showing 50 changed files with 491 additions and 355 deletions.
2 changes: 1 addition & 1 deletion .dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -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
160 changes: 62 additions & 98 deletions Azkfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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');
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
41 changes: 27 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -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)

Expand All @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down Expand Up @@ -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: $@"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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))
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
[run_project_gallery]: https://github.com/run-project/gallery
2 changes: 1 addition & 1 deletion docs/content/en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/getting-started/mounts-files.md
Original file line number Diff line number Diff line change
@@ -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`:

Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/getting-started/persisting-data.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
Loading

0 comments on commit 4a74ca2

Please sign in to comment.