Permalink
Browse files

feat(binc): devlab -> binc, see issue #73

  • Loading branch information...
Fluidbyte committed Jun 4, 2017
1 parent 1769cb7 commit 97aa3325373998a4bebe02a827bee92bd7b29d0a
View
@@ -15,13 +15,13 @@ notifications:
before_install:
- sudo apt-get update > /dev/null
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-engine=17.04.0~ce-0~ubuntu-trusty > /dev/null
- yarn add global devlab
- yarn add global binci
install:
- devlab install
- binci install
script:
- devlab test
- binci test
after_success:
- sudo chmod -R 777 node_modules/ && sudo chmod -R 777 ~/.npm
@@ -44,7 +44,7 @@ deploy:
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: devlab.taplatform.net
bucket: binci.taplatform.net
local-dir: bin
acl: public_read
on:
View

This file was deleted.

Oops, something went wrong.
View
108 README.md
@@ -1,11 +1,11 @@
[![Travis branch](https://img.shields.io/travis/TechnologyAdvice/DevLab/master.svg)](https://travis-ci.org/TechnologyAdvice/DevLab)
[![codecov](https://codecov.io/gh/TechnologyAdvice/DevLab/branch/master/graph/badge.svg)](https://codecov.io/gh/TechnologyAdvice/DevLab)
[![Travis branch](https://img.shields.io/travis/Binci/binci/master.svg)](https://travis-ci.org/Binci/binci)
[![codecov](https://codecov.io/gh/Binci/binci/branch/master/graph/badge.svg)](https://codecov.io/gh/Binci/binci)
<img src="./devlab.png" align="right">
<img src="./binci.png" align="right">
# DevLab
# Binci
DevLab is a utility that allows you to easily containerize your development
Binci is a utility that allows you to easily containerize your development
workflow using Docker. Simply put; it's like having a cleanroom for all of your
development processes which contains services (like databases) without needing
to setup and maintain these environments manually.
@@ -14,64 +14,64 @@ to setup and maintain these environments manually.
<img width="100%" src="http://i.imgur.com/Xezn8jj.gif">
**FAQ: [Why Devlab over Docker-Compose?](#why-devlab-over-docker-compose)**
**FAQ: [Why Binci over Docker-Compose?](#why-binci-over-docker-compose)**
## Installation
### YARN/NPM
`yarn global add devlab` or `npm install devlab -g`
`yarn global add binci` or `npm install binci -g`
**Note: DevLab requires Node v.6+ to run.**
**Note: Binci requires Node v.6+ to run.**
### Binaries
**Linux [(download)](http://devlab.taplatform.net/linux/devlab)**
**Linux [(download)](http://binci.technologyadvice.com/linux/binci)**
```
curl -o /usr/local/bin/devlab http://devlab.taplatform.net/linux/devlab && \
chmod +x /usr/local/bin/devlab
curl -o /usr/local/bin/binci http://binci.technologyadvice.com/linux/binci && \
chmod +x /usr/local/bin/binci
```
**Mac OSX [(download)](http://devlab.taplatform.net/mac/devlab)**
**Mac OSX [(download)](http://binci.technologyadvice.com/mac/binci)**
```
sudo mkdir -p /usr/local/bin && \
sudo curl -o /usr/local/bin/devlab http://devlab.taplatform.net/mac/devlab && \
sudo chmod +x /usr/local/bin/devlab
sudo curl -o /usr/local/bin/binci http://binci.technologyadvice.com/mac/binci && \
sudo chmod +x /usr/local/bin/binci
```
**Windows [(download)](http://devlab.taplatform.net/windows/devlab.exe)**
**Windows [(download)](http://binci.technologyadvice.com/windows/binci.exe)**
Download the above file and run from the path where it is saved or add to a directory in your `PATH`.
---
*Obvious Note: You need to have [Docker](https://www.docker.com/) installed as well.*
**Important Note**: In order to run the tasks, Devlab creates a temp file (`devlab.sh`). The tool will do its best to determine the best location (usually `/tmp`), but this can be explicitly set by specifying the environment variable `DEVLAB_TMP`.
**Important Note**: In order to run the tasks, Binci creates a temp file (`binci.sh`). The tool will do its best to determine the best location (usually `/tmp`), but this can be explicitly set by specifying the environment variable `BINCI_TMP`.
## Quick Start
After you have Devlab installed you can initialize a project by moving to the project directory and running the following:
After you have Binci installed you can initialize a project by moving to the project directory and running the following:
```
devlab init
binci init
```
The above will prompt you to enter a base image; this should be a valid Docker image.
Once the configuration is generated you can run tasks. The default template includes several, for example:
```
devlab env
binci env
```
The above will load your project via Devlab & Docker, then echo the environment variables available.
The above will load your project via Binci & Docker, then echo the environment variables available.
## Usage
Devlab is controlled by a `devlab.yml` file in the root of your project. A basic example is shown below:
Binci is controlled by a `binci.yml` file in the root of your project. A basic example is shown below:
```yaml
from: node:6
@@ -96,7 +96,7 @@ tasks:
run: node index.js
```
The above can then be executed via the `devlab run` command from within the same directory as your project and `devlab.yml`. Execution would do the following:
The above can then be executed via the `binci run` command from within the same directory as your project and `binci.yml`. Execution would do the following:
- Pull and start `mongo` with `DB_ROOT_PASSWORD` environment variable and port `27017` exposed
- Sets the following on the container:
@@ -110,7 +110,7 @@ The above can then be executed via the `devlab run` command from within the same
### Multiple Tasks
The example shows a single-command execution configuration, however, Devlab supports named tasks as well. Replace the `task` entry with configuration object `tasks`:
The example shows a single-command execution configuration, however, Binci supports named tasks as well. Replace the `task` entry with configuration object `tasks`:
```yaml
tasks:
@@ -120,14 +120,14 @@ tasks:
test: npm test
```
The above would allow you to run `devlab <task>` to execute any of the tasks defined.
The above would allow you to run `binci <task>` to execute any of the tasks defined.
### Custom Execution
Devlab also allows for executing tasks not predefined in the configuration file using the `-e` flag. For example:
Binci also allows for executing tasks not predefined in the configuration file using the `-e` flag. For example:
```
devlab -e "/bin/sh"
binci -e "/bin/sh"
```
The above would start the container using the configuration, call the `before` task, then start the `sh` shell. The container will then remain in the shell until an `exit` command is sent by the user.
@@ -146,14 +146,14 @@ Services add links into the primary container, exposing the services for utilitz
During execution, service containers are named in 2 ways:
1. Ephemeral (non-persisted): `dl_<NAME>_<INSTANCE-ID>`
1. Ephemeral (non-persisted): `bc_<NAME>_<INSTANCE-ID>`
2. Persisted: `<NAME>`
The above naming convention allows for persisted services to be shared with other Devlab instances, or manually run docker containers, via the `--link` argument.
The above naming convention allows for persisted services to be shared with other Binci instances, or manually run docker containers, via the `--link` argument.
At startup Devlab will ensure any persisted or already running containers are not started again.
At startup Binci will ensure any persisted or already running containers are not started again.
After completion, Devlab will run a detached process which will execute `docker stop` and `docker rm` on any non-persisted, ephemeral services.
After completion, Binci will run a detached process which will execute `docker stop` and `docker rm` on any non-persisted, ephemeral services.
### Persisting Services
@@ -186,33 +186,33 @@ tasks:
For one-off cases, individual services can also be disabled via the command line:
```
devlab lint -d mongo
binci lint -d mongo
```
or all services:
```
devlab lint --disable-all
binci lint --disable-all
```
## Container Management
Devlab will automatically `stop` services after any run (success or fail). However, if this fails or some other fringe-case causes this process to stop responding the system can leave orphaned containers running.
Binci will automatically `stop` services after any run (success or fail). However, if this fails or some other fringe-case causes this process to stop responding the system can leave orphaned containers running.
In order to mitigate this issue Devlab will run a check for any `dl_` prefixed containers on each run. If orphaned services are identified a warning message will appear at the beginning of the process to indicate the orphaned service(s) and commands to remedy/exit these containers.
In order to mitigate this issue Binci will run a check for any `bc_` prefixed containers on each run. If orphaned services are identified a warning message will appear at the beginning of the process to indicate the orphaned service(s) and commands to remedy/exit these containers.
The following commands can be run to cleanup any running containers:
**Stop and Remove Devlab Containers:**
**Stop and Remove Binci Containers:**
```
devlab --cleanup
binci --cleanup
```
**Stop and Remove ALL Containers:**
```
devlab --cleanup-all
binci --cleanup-all
```
## Environment Variables (`env <array>`)
@@ -248,23 +248,23 @@ The `stopTimeSecs` above would forcibly stop the container after 3 seconds using
**Global Setting:**
In addition to setting the `stopTimeSecs` per service, this property can be set in the root of the `devlab.yml` configuration and will be applied to any services that don't have an explicit `stopTimeSecs` property.
In addition to setting the `stopTimeSecs` per service, this property can be set in the root of the `binci.yml` configuration and will be applied to any services that don't have an explicit `stopTimeSecs` property.
## Service Removal
In earlier versions of Docker, the `-d` (detached) and `--rm` (remove) flags conflict, however, Devlab uses these together which may cause issue on older systems.
In earlier versions of Docker, the `-d` (detached) and `--rm` (remove) flags conflict, however, Binci uses these together which may cause issue on older systems.
If running `docker run -d --rm <container>` causes this error the `--rm` flag can be circumvented by setting the `DEVLAB_NO_RM` environment variable to `true`.
If running `docker run -d --rm <container>` causes this error the `--rm` flag can be circumvented by setting the `BINCI_NO_RM` environment variable to `true`.
## Development
### Tests
Devlab can be run via `yarn`/`npm` scripts, but is also setup to run development tasks using Devlab.
Binci can be run via `yarn`/`npm` scripts, but is also setup to run development tasks using Binci.
Ensure you have the latest version installed then run:
`devlab install test` or `yarn install && yarn test`.
`binci install test` or `yarn install && yarn test`.
### End-to-End Tests
@@ -286,32 +286,32 @@ yarn run build:linux
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/app -w /app ubuntu sh -c "apt-get update && apt-get install docker.io -y && bash"
```
**3. Create Devlab Alias:**
**3. Create Binci Alias:**
```
alias devlab=$PWD/bin/linux/devlab
alias binci=$PWD/bin/linux/binci
```
Once the above steps are completed the `devlab` executable will be avilable.
Once the above steps are completed the `binci` executable will be avilable.
## Why Devlab Over Docker Compose?
## Why Binci Over Docker Compose?
First off, we like [Docker Compose](https://docs.docker.com/compose/), and definitely think it's a powerful tool. However, Devlab was built because Compose is more about long-running, containerized environment and what we set out to build was a way to run ephemeral, limited-lifespan tasks without having to manage cleanup between each run.
First off, we like [Docker Compose](https://docs.docker.com/compose/), and definitely think it's a powerful tool. However, Binci was built because Compose is more about long-running, containerized environment and what we set out to build was a way to run ephemeral, limited-lifespan tasks without having to manage cleanup between each run.
Compose takes the approach of spinning up containers that run, almost like a virtual machine, while you need them. Devlab looks at things from a point of view of abstracting `docker run` command chains to create a single-run instance only for that task, then shutting down and doing cleanup so each run is clean and running off a consistent base.
Compose takes the approach of spinning up containers that run, almost like a virtual machine, while you need them. Binci looks at things from a point of view of abstracting `docker run` command chains to create a single-run instance only for that task, then shutting down and doing cleanup so each run is clean and running off a consistent base.
Some more comparisons:
* With Devlab you don't need a Dockerfile for local development, thus you can use it whether or not your project will be deployed in Docker or to bare metal.
* Devlab doesn't build docker images, ever. It uses the images you specify for both the primary container and any services.
* With Binci you don't need a Dockerfile for local development, thus you can use it whether or not your project will be deployed in Docker or to bare metal.
* Binci doesn't build docker images, ever. It uses the images you specify for both the primary container and any services.
* When you install local dependencies in your project folder, run a build, execute your coverage tool, or write any local files, that just happens on your hard disk, not locked away in some container. They'll be available to every other task you run.
* With Devlab you don't need to run tasks in a containerized shell, you simply define the tasks and run them. You can kick tasks off with any local script, build tool, or IDE run configuration without building a container first.
* Tasks don't need to be defined at runtime via arguments or flags, you just tell Devlab which predefined task to run.
* With Binci you don't need to run tasks in a containerized shell, you simply define the tasks and run them. You can kick tasks off with any local script, build tool, or IDE run configuration without building a container first.
* Tasks don't need to be defined at runtime via arguments or flags, you just tell Binci which predefined task to run.
## License
DevLab is licensed under the MIT license. Please see [`LICENSE.txt`](/LICENSE.txt) for full details.
Binci is licensed under the MIT license. Please see [`LICENSE.txt`](/LICENSE.txt) for full details.
## Credits
DevLab was created and is maintained by [TechnologyAdvice](http://www.technologyadvice.com).
Binci was created and is maintained by [TechnologyAdvice](http://www.technologyadvice.com).
View
BIN +6.39 KB binci.png
Binary file not shown.
View
@@ -1,4 +1,4 @@
from: technologyadvice/devlab
from: binci/dind-node:latest
env:
- TMP=/tmp
volumes:
View
BIN -12.5 KB devlab.png
Binary file not shown.
View
@@ -1,6 +1,6 @@
#!/usr/bin/env node
const devlab = require('./src/index')
devlab.start().then(() => {
const binci = require('./src/index')
binci.start().then(() => {
process.exit(0)
}).catch(() => {
process.exit(1)
View
@@ -1,7 +1,7 @@
{
"name": "devlab",
"name": "binci",
"version": "3.12.3",
"description": "Node utility for running containerized tasks",
"description": "Utility for running containerized development workflows",
"keywords": [
"docker",
"container",
@@ -21,8 +21,7 @@
"index.js"
],
"bin": {
"lab": "index.js",
"devlab": "index.js"
"binci": "index.js"
},
"preferGlobal": true,
"scripts": {
@@ -39,15 +38,15 @@
"release:minor": "npm test && npm version minor && git push origin master && git push --tags && npm publish",
"release:major": "npm test && npm version major && git push origin master && git push --tags && npm publish"
},
"homepage": "https://github.com/TechnologyAdvice/DevLab",
"homepage": "https://github.com/Binci/binci",
"repository": {
"type": "git",
"url": "https://github.com/TechnologyAdvice/DevLab"
"url": "https://github.com/Binci/binci"
},
"bugs": {
"url": "https://github.com/TechnologyAdvice/DevLab/issues"
"url": "https://github.com/Binci/binci/issues"
},
"author": "Kent Safranski <devteam+devlab@technologyadvice.com>",
"author": "Kent Safranski <devteam+binci@technologyadvice.com>",
"license": "MIT",
"devDependencies": {
"chai": "^3.3.0",
View
@@ -30,14 +30,14 @@ const args = {
'f': { prop: 'from', help: 'Run with specified docker image' },
'c': { prop: 'configPath', help: 'Run with custom config file path' },
'd': { action: 'disable', help: 'Disable specified service' },
'init': { action: 'init', help: 'Initialize new devlab project config' },
'init': { action: 'init', help: 'Initialize new Binci project config' },
'disable-all': { action: 'disableAll', help: 'Disable all configured services' },
'tasks': { action: 'tasks', help: 'List all available tasks' },
'cleanup': { action: 'cleanupDL', help: 'Stops and removes any non-persisted Devlab containers' },
'cleanup': { action: 'cleanupBN', help: 'Stops and removes any non-persisted Binci containers' },
'cleanup-all': { action: 'cleanupAll', help: 'Stops and removes ALL docker containers' }
},
/**
* Runs initialization script to create template devlab.yml file
* Runs initialization script to create template binci.yml file
*/
init: () => {
return init()
@@ -88,9 +88,9 @@ const args = {
process.exit(0)
},
/**
* Calls the cleanup process for Devlab containers and exits
* Calls the cleanup process for Binci containers and exits
*/
cleanupDL: () => {
cleanupBN: () => {
return utils.cleanup()
.then(() => process.exit(0))
.catch(() => process.exit(1))
@@ -140,7 +140,7 @@ const args = {
if (args.raw._ && args.raw._[0] === 'init') {
try {
// If config already exists, just move on...
fs.statSync(`${process.cwd()}/devlab.yml`)
fs.statSync(`${process.cwd()}/binci.yml`)
} catch (e) {
return args.init()
}
Oops, something went wrong.

0 comments on commit 97aa332

Please sign in to comment.