droxy

command module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2018 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Go Report Card License Linux build Windows build Coverage Status

Droxy

create commands that proxy to docker

The idea

This tool should help you in creating variants of commands that proxy execution into docker containers.

Getting started

Downlooad
To get started you either download a precompiled binary from releases. If you would like to build the tool from source code, read the contribution part of this document.

Wiki
Take a look at the wiki examples to learn how to setup up custom commands
https://github.com/Oppodelldog/droxy/wiki

Configuration

In the config file, you define the commands you want to create. The config file must be named droxy.toml.

The following example contains all possible configuration options, you can leave out the most of them.

droxy.toml

    Version="1"

    [[command]]
      name = "basic command"  # name of the command
      isTemplate = true       # this command can be used as a template, no command will be created
      addGroups = true        # add current systems groups  (linux only)
      impersonate = true      # use executing user and group for execution in the container (linux only)
      workDir = "/app"        # define working directory
      removeContainer=true    # remove container after command has finished
      isInteractive=true      # enable interaction with the called command
      isDaemon=false          # starts the container in background
      RequireEnvVars=false    # if true, not defined env vars that are configured will lead to an error

      # volume mappings
      volumes = [
          "${HOME}:${HOME}",
          "${SSH_AUTH_SOCK}:/run/ssh.sock",
          "/etc/passwd:/etc/passwd:ro",
          "/etc/group:/etc/group:ro",
          "/run/docker.sock:/run/docker.sock"
      ]

      # environment variable mappings
      envvars = [
          "HOME:${HOME}",
          "SSH_AUTH_SOCK:/run/ssh.sock",
          "DOCKER_HOST=unix:///run/docker.sock"
      ]

      links = [
        "containerXY:aliasXY"
      ]

    [[command]]
        template = "basic command"  # apply settings from template 'basic command' to this command
    	name = "php"                # name of the command which is created by calling 'docker-proxy symlinks'
    	entryPoint = "php"          # basic binary to execute inside the container
    	image = "php:7.1.13"        # docker image the container is run on

    [[command]]
        template = "basic command"
    	name = "phpstorm-php-unittest-integration"
    	entryPoint = "php"
    	image = "php:7.1.13"

    	# replace  127.0.0.1 with docker ip of host
        replaceArgs = [
            [
              "-dxdebug.remote_host=127.0.0.1",
              "-dxdebug.remote_host=172.17.0.1"
            ]
        ]

        # ensure xdebug will startup and communicate
        additionalArgs = ["-dxdebug.remote_autostart=1"]

create commands

So the idea is to create "real" commands in form of binaries. Why? Well for a bash user also bash files would apply, but when you are trying to trick an IDE to use such a bash file as a real executable some may fail. So in general it should be a good idea to create real binaries.

What are the options?
There are three options to create custom docker-proxy commands into a directory:

  • symlinks
    this sub-command creates a symlink for every command defined in the config into the current directory
  • clones
    this sub-command creates copies of docker-proxy in the config into the current directory, renaming to the appropriate command name.
  • hardlinks
    this sub-command creates a hardlink for every command defined in the config into the current directory
docker-proxy symlinks
docker-proxy hardlinks
docker-proxy clones

use -f to force file creation. This will delete files with command names before creation.

Contribute

Feature requests and pull requests are welcome.

How to

Clone the repository into your go folder. The path should look like this .../go/src/github.com/Oppodelldog/droxy.

There are some make targets that help you with several tasks, first: setup:

make setup

This installs necessary go tools to get further jobs done and installs vendors.

Now you are ready to go. make install builds and installs the droxy command in .../go/bin so you can directly use or test it.

If you have no make installed, execute the commands of the setup task manually.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
mocks
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
builder/mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL