diff --git a/README.md b/README.md index 5c8a08e..f6a54b7 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ However, due to the flexability of Gearbox, it can be used outside of this frame There are three methods: -## Method 1: Using gb-launch -`gb-launch` is a tool specifically designed to interact with a Gearbox Docker container. +## Method 1: Using launch +`launch` is a tool specifically designed to interact with a Gearbox Docker container. It provides three important functional areas, without any Docker container learning curve: - Allows control over Gearbox Docker containers: stop, start, create, remove. @@ -41,60 +41,63 @@ It provides three important functional areas, without any Docker container learn It also provides a functional SSH daemon for connecting remotely as well as a standard set of common tools and utilities. +Further `launch` documentation can be [found here](https://github.com/gearboxworks/docker-template/blob/master/LAUNCH.md). -### Setup from GitHub repo -`gb-launch` is currently in beta testing and is included along with all Gearbox Docker repos. +### Download launch +`launch` is currently in beta testing and is included along with all Gearbox Docker repos. Once out of beta, it will be included within the Gearbox installation package. -For now, simply clone this repository to your local machine. +For now, simply download the standalone `launch` binary for your O/S. +- [Mac OSX 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Darwin/launch) +- [Linux 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Linux/launch) +- [Windows 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Windows/launch) -`git clone https://github.com/gearboxworks/docker-mailhog.git` -### Running gb-launch -There are many ways to call gb-launch, either directly or indirectly. +### Running launch +There are many ways to call launch, either directly or indirectly. Additionally, all host environment variables will be imported into the container seamlessly. This allows a devloper to try multiple versions of software as though they were installed locally. If a container is missing, it will be downloaded and created. Multiple versions can co-exist. -Create, and start the mailhog Gearbox container. +Install, create, and start the mailhog Gearbox container. -`./bin/gb-launch -gb-name mailhog` +`./launch install mailhog` Create, and start the mailhog Gearbox container. Run a shell. -`./bin/gb-launch -gb-name mailhog -gb-shell` +`./launch shell mailhog` Create, and start the mailhog Gearbox container with version 1.0.0 and run a shell. -`./bin/gb-launch -gb-name mailhog -gb-version 1.0.0 -gb-shell` - -If mailhog is symlinked to `gb-launch`, then you can drop the `-gb-name` flag. +`./launch shell mailhog:1.0.0` -`./bin/mailhog` +`./launch shell mailhog:1.0.0 ls -l` -Running mailhog Gearbox container default command. If a container has a default interactive command, arguments can be supplied without specifying that command. - -`./bin/mailhog -flag1 -flag2 variable` +`./launch shell mailhog:1.0.0 ps -eaf` -`./bin/gb-launch -gb-name mailhog -gb-version 1.0.0 -flag1 -flag2 variable` +### Available commands +If mailhog is symlinked to `launch`, then the Gearbox container will be determined automatically and the default command will be run. +All available commands for a Gearbox container will be automatically symlinked upon installation. -Running alternate commands within the mailhog Gearbox container. +`./mailhog` -`./bin/mailhog -gb-shell -- ls -l` +Running mailhog Gearbox container default command. If a container has a default interactive command, arguments can be supplied without specifying that command. -`./bin/gb-launch -gb-name mailhog -gb-version 1.0.0 -gb-shell -- ls -l` +`./mailhog -flag1 -flag2 variable` -`./bin/mailhog -gb-shell -- ps -eaf` +`./launch mailhog:1.0.0 -flag1 -flag2 variable` -`./bin/gb-launch -gb-name mailhog -gb-version 1.0.0 -gb-shell -- ps -eaf` +Gearbox containers may have multiple executables that can be run. The mailhog Gearbox container has the following available commands: +- The default command will execute `` within the container. +### Remote connection ssh - All [Gearbox](https://github.com/gearboxworks/) containers have a running SSH daemon. So you can connect remotely. -To show what ports are exported to the host. +To show what ports are exported to the host, use the following command. -`./bin/gb-launch -gb-name mailhog -gb-list` +`./launch list mailhog` ## Method 2: GitHub repo @@ -162,7 +165,7 @@ shell - Run a shell, (/bin/bash), within a Docker container. ### SSH ssh - All [Gearbox](https://github.com/gearboxworks/) containers have a running SSH daemon. So you can connect remotely. -Either use `gb-launch` above or discover the port and SSH directly. +Either use `launch` above or discover the port and SSH directly. ``` diff --git a/TEMPLATE/README.md.tmpl b/TEMPLATE/README.md.tmpl index fd12458..0befa7f 100644 --- a/TEMPLATE/README.md.tmpl +++ b/TEMPLATE/README.md.tmpl @@ -30,6 +30,8 @@ GitHub release(latest): ![last-release-date](https://img.shields.io/github/relea {{- end }} {{- end }} +{{- $vk := keys .Json.versions }}{{- $pv := index $vk 0 }} + ## About this container. A driving force behind [Gearbox](https://github.com/gearboxworks/) is to improve the user experience using software, and especially for software developers. @@ -45,8 +47,8 @@ However, due to the flexability of Gearbox, it can be used outside of this frame There are three methods: -## Method 1: Using gb-launch -`gb-launch` is a tool specifically designed to interact with a Gearbox Docker container. +## Method 1: Using launch +`launch` is a tool specifically designed to interact with a Gearbox Docker container. It provides three important functional areas, without any Docker container learning curve: - Allows control over Gearbox Docker containers: stop, start, create, remove. @@ -55,62 +57,70 @@ It provides three important functional areas, without any Docker container learn It also provides a functional SSH daemon for connecting remotely as well as a standard set of common tools and utilities. +Further `launch` documentation can be [found here](https://github.com/gearboxworks/docker-template/blob/master/LAUNCH.md). -### Setup from GitHub repo -`gb-launch` is currently in beta testing and is included along with all Gearbox Docker repos. +### Download launch +`launch` is currently in beta testing and is included along with all Gearbox Docker repos. Once out of beta, it will be included within the Gearbox installation package. -For now, simply clone this repository to your local machine. +For now, simply download the standalone `launch` binary for your O/S. +- [Mac OSX 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Darwin/launch) +- [Linux 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Linux/launch) +- [Windows 64bit](https://github.com/gearboxworks/docker-template/raw/master/bin/Windows/launch) -`git clone https://github.com/{{ $.Json.meta.organization }}/docker-{{ .Json.meta.name }}.git` -### Running gb-launch -There are many ways to call gb-launch, either directly or indirectly. +### Running launch +There are many ways to call launch, either directly or indirectly. Additionally, all host environment variables will be imported into the container seamlessly. This allows a devloper to try multiple versions of software as though they were installed locally. If a container is missing, it will be downloaded and created. Multiple versions can co-exist. -Create, and start the {{ .Json.meta.name }} Gearbox container. +Install, create, and start the {{ .Json.meta.name }} Gearbox container. -`./bin/gb-launch -gb-name {{ .Json.meta.name }}` +`./launch install {{ .Json.meta.name }}` Create, and start the {{ .Json.meta.name }} Gearbox container. Run a shell. -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-shell` - -{{- $vk := keys .Json.versions }}{{- $pv := index $vk 0 }} +`./launch shell {{ .Json.meta.name }}` Create, and start the {{ .Json.meta.name }} Gearbox container with version {{ $pv }} and run a shell. -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-version {{ $pv }} -gb-shell` +`./launch shell {{ .Json.meta.name }}:{{ $pv }}` -If {{ .Json.meta.name }} is symlinked to `gb-launch`, then you can drop the `-gb-name` flag. +`./launch shell {{ .Json.meta.name }}:{{ $pv }} ls -l` -`./bin/{{ .Json.meta.name }}` +`./launch shell {{ .Json.meta.name }}:{{ $pv }} ps -eaf` -Running {{ .Json.meta.name }} Gearbox container default command. If a container has a default interactive command, arguments can be supplied without specifying that command. - -`./bin/{{ .Json.meta.name }} -flag1 -flag2 variable` -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-version {{ $pv }} -flag1 -flag2 variable` +### Available commands +If {{ .Json.meta.name }} is symlinked to `launch`, then the Gearbox container will be determined automatically and the default command will be run. +All available commands for a Gearbox container will be automatically symlinked upon installation. +`./{{ .Json.meta.name }}` -Running alternate commands within the {{ .Json.meta.name }} Gearbox container. +Running {{ .Json.meta.name }} Gearbox container default command. If a container has a default interactive command, arguments can be supplied without specifying that command. -`./bin/{{ .Json.meta.name }} -gb-shell -- ls -l` +`./{{ .Json.meta.name }} -flag1 -flag2 variable` -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-version {{ $pv }} -gb-shell -- ls -l` +`./launch {{ .Json.meta.name }}:{{ $pv }} -flag1 -flag2 variable` -`./bin/{{ .Json.meta.name }} -gb-shell -- ps -eaf` +Gearbox containers may have multiple executables that can be run. The {{ .Json.meta.name }} Gearbox container has the following available commands: -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-version {{ $pv }} -gb-shell -- ps -eaf` +{{- range $key, $value := .Json.run.commands }} +{{- if eq $key "default" }} +- The default command will execute `{{ $value }}` within the container. +{{- else }} +- `{{ $key }}` - will execute `{{ $value }}` within the container. +{{- end }} +{{- end }} +### Remote connection ssh - All [Gearbox](https://github.com/gearboxworks/) containers have a running SSH daemon. So you can connect remotely. -To show what ports are exported to the host. +To show what ports are exported to the host, use the following command. -`./bin/gb-launch -gb-name {{ .Json.meta.name }} -gb-list` +`./launch list {{ .Json.meta.name }}` ## Method 2: GitHub repo @@ -178,7 +188,7 @@ shell - Run a shell, (/bin/bash), within a Docker container. ### SSH ssh - All [Gearbox](https://github.com/gearboxworks/) containers have a running SSH daemon. So you can connect remotely. -Either use `gb-launch` above or discover the port and SSH directly. +Either use `launch` above or discover the port and SSH directly. ``` diff --git a/bin/Darwin/.-1.0.0 b/bin/Darwin/.-1.0.0 new file mode 120000 index 0000000..a5bc098 --- /dev/null +++ b/bin/Darwin/.-1.0.0 @@ -0,0 +1 @@ +launch \ No newline at end of file diff --git a/bin/Darwin/launch b/bin/Darwin/launch index 0a9f759..d903e5a 100755 Binary files a/bin/Darwin/launch and b/bin/Darwin/launch differ diff --git a/bin/Linux/launch b/bin/Linux/launch index 8c12a2f..76f4227 100755 Binary files a/bin/Linux/launch and b/bin/Linux/launch differ diff --git a/bin/TemplateUpdate.sh b/bin/TemplateUpdate.sh index 3d1aa83..7d7aa4f 100755 --- a/bin/TemplateUpdate.sh +++ b/bin/TemplateUpdate.sh @@ -69,3 +69,4 @@ else echo "# Gearbox[docker-template]: Cannot find docker-template repository." fi +make init diff --git a/bin/Windows/launch.exe b/bin/Windows/launch.exe new file mode 100755 index 0000000..11b3d5c Binary files /dev/null and b/bin/Windows/launch.exe differ diff --git a/bin/_Functions.sh b/bin/_Functions.sh index f07dfaf..44a78e3 100755 --- a/bin/_Functions.sh +++ b/bin/_Functions.sh @@ -102,11 +102,6 @@ gb_getenv() { GB_VERDIR="${GB_BASEDIR}/versions/$1" export GB_VERDIR - #if [ ! -d "${GB_VERDIR}" ] - #then - # mkdir -p "${GB_VERDIR}" - #fi - if [ -f "TEMPLATE/version/.env.tmpl" ] then ${GB_BINFILE} -json "${GB_JSONFILE}" -template "TEMPLATE/version/.env.tmpl" -out "${GB_VERDIR}/.env" @@ -235,7 +230,7 @@ gb_create-version() { for GB_VERSION in ${GB_VERSIONS} do - if [ -d ${GB_VERDIR} ] + if [ -d "${GB_BASEDIR}/versions/${GB_VERSION}" ] then gb_getenv ${GB_VERSION} p_info "${FUNCNAME[0]}" "Updating version directory \"${GB_VERSION}\"." diff --git a/build/gearbox-mailhog.json b/build/gearbox-mailhog.json index c03eb08..631cd3b 100644 --- a/build/gearbox-mailhog.json +++ b/build/gearbox-mailhog.json @@ -29,6 +29,9 @@ "restart": "--restart always" }, "run": { + "commands": { + "default": "" + } }, "project": { }, diff --git a/gearbox.json b/gearbox.json index c03eb08..eb1df91 100644 --- a/gearbox.json +++ b/gearbox.json @@ -29,6 +29,10 @@ "restart": "--restart always" }, "run": { + "commands": { + "default": "/usr/local/bin/mhsendmail", + "mhsendmail": "/usr/local/bin/mhsendmail" + } }, "project": { }, @@ -40,7 +44,6 @@ "latest": true, "ref": "", "base": "gearboxworks/gearbox-base:alpine-3.10" - }, - "": {} + } } } diff --git a/gearbox.json-OLD b/gearbox.json-OLD deleted file mode 100644 index 35fd83f..0000000 --- a/gearbox.json-OLD +++ /dev/null @@ -1,32 +0,0 @@ -{ - "state": "production", - "organization": "gearboxworks", - "name": "mailhog", - "maintainer": "Gearbox Team ", - "class": "system", - "network": "--network gearboxnet", - "ports": [ - "80", - "25" - ], - "volumes": "", - "restart": "--restart always", - "run": "/usr/local/bin/MailHog", - "args": "", - "env": { - "MH_HOSTNAME": "mailhog.gearboxworks.io", - "MH_API_BIND_ADDR": "0.0.0.0:80", - "MH_UI_BIND_ADDR": "0.0.0.0:80", - "MH_SMTP_BIND_ADDR": "0.0.0.0:25" - }, - "refurl": "https://github.com/mailhog/MailHog", - "versions": { - "1.0.0": { - "majorversion": "1.0", - "latest": true, - "ref": "", - "base": "gearboxworks/gearbox-base:alpine-3.10" - } - } -} - diff --git a/versions/1.0.0/.env b/versions/1.0.0/.env index 8c1ef19..63795f0 100644 --- a/versions/1.0.0/.env +++ b/versions/1.0.0/.env @@ -21,7 +21,7 @@ GB_REF=''; export GB_REF GB_DOCKERFILE='versions/1.0.0/DockerfileRuntime'; export GB_DOCKERFILE # GB_JSONFILE='1.0.0/gearbox.json'; export GB_JSONFILE -GB_JSON='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "mailhog","label": "Mailhog","maintainer": "Gearbox Team ","class": "system","refurl": "https://github.com/mailhog/MailHog"},"build": {"ports": {"http": "80","smtp": "25"},"run": "/usr/local/bin/MailHog","args": "","env": {"MH_API_BIND_ADDR": "0.0.0.0:80","MH_HOSTNAME": "mailhog.gearboxworks.io","MH_SMTP_BIND_ADDR": "0.0.0.0:25","MH_UI_BIND_ADDR": "0.0.0.0:80"},"network": "--network gearboxnet","volumes": "","restart": "--restart always"},"run": {},"project": {},"extensions": {},"versions": {"1.0.0": {"majorversion": "1.0","latest": true,"ref": "","base": "gearboxworks/gearbox-base:alpine-3.10"},"": {}}}'; export GB_JSON +GB_JSON='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "mailhog","label": "Mailhog","maintainer": "Gearbox Team ","class": "system","refurl": "https://github.com/mailhog/MailHog"},"build": {"ports": {"http": "80","smtp": "25"},"run": "/usr/local/bin/MailHog","args": "","env": {"MH_API_BIND_ADDR": "0.0.0.0:80","MH_HOSTNAME": "mailhog.gearboxworks.io","MH_SMTP_BIND_ADDR": "0.0.0.0:25","MH_UI_BIND_ADDR": "0.0.0.0:80"},"network": "--network gearboxnet","volumes": "","restart": "--restart always"},"run": {"commands": {"default": "/usr/local/bin/mhsendmail","mhsendmail": "/usr/local/bin/mhsendmail"}},"project": {},"extensions": {},"versions": {"1.0.0": {"majorversion": "1.0","latest": true,"ref": "","base": "gearboxworks/gearbox-base:alpine-3.10"}}}'; export GB_JSON GB_IMAGENAME='gearboxworks/mailhog'; export GB_IMAGENAME GB_IMAGEVERSION='gearboxworks/mailhog:1.0.0'; export GB_IMAGEVERSION diff --git a/versions/1.0.0/DockerfileRuntime b/versions/1.0.0/DockerfileRuntime index 1b76217..995a394 100644 --- a/versions/1.0.0/DockerfileRuntime +++ b/versions/1.0.0/DockerfileRuntime @@ -1,7 +1,7 @@ ################################################################################ # WARNING: This file has been auto-generated. DO NOT EDIT: WARNING -# Created on 2020-04-03T18:46:05+1100, using template:DockerfileRuntime.tmpl and json:gearbox.json +# Created on 2020-05-06T19:09:04+1000, using template:DockerfileRuntime.tmpl and json:gearbox.json # Plain Docker container for docker-mailhog based off gearboxworks/gearbox-base:alpine-3.10 ARG VERSION=1.0.0 @@ -18,7 +18,7 @@ ENV GEARBOX_CONTAINER_NAME "docker-mailhog" ENV GEARBOX_CONTAINER_VERSION ${VERSION} ENV GEARBOX_ENTRYPOINT ${GEARBOX_ENTRYPOINT} ENV GEARBOX_ENTRYPOINT_ARGS ${GEARBOX_ENTRYPOINT_ARGS} -LABEL gearbox.json='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "mailhog","label": "Mailhog","maintainer": "Gearbox Team ","class": "system","refurl": "https://github.com/mailhog/MailHog"},"build": {"ports": {"http": "80","smtp": "25"},"run": "/usr/local/bin/MailHog","args": "","env": {"MH_API_BIND_ADDR": "0.0.0.0:80","MH_HOSTNAME": "mailhog.gearboxworks.io","MH_SMTP_BIND_ADDR": "0.0.0.0:25","MH_UI_BIND_ADDR": "0.0.0.0:80"},"network": "--network gearboxnet","volumes": "","restart": "--restart always"},"run": {},"project": {},"extensions": {},"versions": {"1.0.0": {"majorversion": "1.0","latest": true,"ref": "","base": "gearboxworks/gearbox-base:alpine-3.10"},"": {}}}' +LABEL gearbox.json='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "mailhog","label": "Mailhog","maintainer": "Gearbox Team ","class": "system","refurl": "https://github.com/mailhog/MailHog"},"build": {"ports": {"http": "80","smtp": "25"},"run": "/usr/local/bin/MailHog","args": "","env": {"MH_API_BIND_ADDR": "0.0.0.0:80","MH_HOSTNAME": "mailhog.gearboxworks.io","MH_SMTP_BIND_ADDR": "0.0.0.0:25","MH_UI_BIND_ADDR": "0.0.0.0:80"},"network": "--network gearboxnet","volumes": "","restart": "--restart always"},"run": {"commands": {"default": ""}},"project": {},"extensions": {},"versions": {"1.0.0": {"majorversion": "1.0","latest": true,"ref": "","base": "gearboxworks/gearbox-base:alpine-3.10"}}}' LABEL gearbox.version='1.0.0' ENV GEARBOX_VERSION "1.0.0" LABEL container.class="system"