GithubHelp home page GithubHelp logo

devdock-node's Introduction

DevDock

Docs and an example are coming soon!

This project is a prototype that builds on top of Docker App (yet another experimental tool) to make it easy to spin up local dev environments. The use case lies in applications that are composed of many services (backend, multiple frontends, etc.) and developing in one service needs the other components running.

Long term, it's likely this will be moved from Node to something like Go to prevent the need of having a Node runtime. But, since I'm more familiar with Node, decided to start there to flush out the idea.

Installation

npm install -g devdock

Docker App Configuration

In order to work, the Docker App you wish to use must have additional service metadata to indicate the service can be disabled and the name to be used in the interactive menus.

  • x-enabled - used by Docker App to actually disable and remove the service when being rendered
  • x-devdock-description - a human friendly name to be used in the interactive menus
  • x-devdock-setting-name - the name of the setting that must be false in order to disable the service

Example Docker App Compose File (truncated)

version: "3.7"
services:
  api:
    image: sample-api-image
    x-enabled: ${enable-api}
    x-devdock-description: API/Backend
    x-devdock-setting-name: enable-api
    ...
  frontend:
    image: sample-frontend-image
    x-enabled: ${enable-frontend}
    x-devdock-description: Browser Frontend
    x-devdock-setting-name: enable-frontend
    ...

Usage

To use the terminal menu to disable/enable services, simply run (notice no additional arguments):

devdock [PROJECT-NAME] [APP-IMAGE]
devdock voting-app mikesir87/votingapp.dockerapp:0.1.0

In addition, all Docker Compose commands are specified when added to the end. For example:

devdock [PROJECT-NAME] [APP-IMAGE] ps
devdock voting-app mikesir87/votingapp.dockerapp:0.1.0 ps

Image Variable Support

On our team, we make use of feature branches. Each feature branch has its own deployed Docker App. If the image contains {BRANCH}, the value will be replaced with the name of the current checked out branch. If no branch is detected, it falls back to master.

Example

# Imagine in a git repo on branch 3-test-something
devdock sample mikesir87/votingapp.dockerapp:{BRANCH} config
# This will end up pulling mikesir87/votingapp.dockerapp:3-test-something

Using Aliases

To make things simple, you can make aliases to wrap the command and provide a simple project-specific "cli tool". For example, if I were working on the Docker Voting App, I could simply add this to my ~/.bash_profile:

alias voting-app="devdock voting-app mikesir87/votingapp.dockerapp:0.1.0 $@"

Then, I can use any docker-compose command, but scoped to the project! So much easier for new developers on the team!

voting-app up -d
voting-app ps
voting-app down

Example

The mikesir87/devdock-demo repo contains a wrapped version of the Docker Voting App Example. The compose file has the additional metadata and can be used to test things out. So... give it a try!

Roadmap

There are a few things I'd like to see, as we already have use cases for them. Here are a few items...

  • When Docker App PR #418 is merged, we can drop the need for x-devdock-setting-name
  • Clean up code so it's not in one mega-file (still just a prototype right now)

License

This project is licensed using the MIT license. See LICENSE

devdock-node's People

Contributors

mikesir87 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

devdock-node's Issues

Ability to add override compose files

Iโ€™d like to have the ability to override or overlay settings for services from the app-in-a-box.

Suggested ideas...

  • devdock project image -f overrides.yml

Would be nice if it supports multiple flags.

Upgrade to use new Docker App

Instead of using the standalone binary, upgrade to utilize the new Docker App CLI plugin. This is a breaking change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.