├── docker-args-deploy ├── docker-args-run ├── docker-args-build ├── .stickler.yml ├── circle.yml ├── plugin.toml ├── .editorconfig ├── docker-args ├── Makefile ├── LICENSE.txt └── README.md /docker-args-deploy: -------------------------------------------------------------------------------- 1 | docker-args -------------------------------------------------------------------------------- /docker-args-run: -------------------------------------------------------------------------------- 1 | docker-args-deploy -------------------------------------------------------------------------------- /docker-args-build: -------------------------------------------------------------------------------- 1 | docker-args-deploy -------------------------------------------------------------------------------- /.stickler.yml: -------------------------------------------------------------------------------- 1 | linters: 2 | shellcheck: 3 | shell: bash 4 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | services: 3 | - docker 4 | dependencies: 5 | override: 6 | - make -e ci-dependencies 7 | test: 8 | override: 9 | - make -e lint 10 | -------------------------------------------------------------------------------- /plugin.toml: -------------------------------------------------------------------------------- 1 | [plugin] 2 | name = "dokku-hostname" 3 | description = "Sets the docker hostname option for dokku" 4 | version = "0.2.0" 5 | website_url = "https://github.com/michaelshobbs/dokku-hostname" 6 | [plugin.config] 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | indent_style = space 6 | indent_size = 2 7 | 8 | [Makefile] 9 | insert_final_newline = true 10 | indent_style = tab 11 | indent_size = 4 12 | 13 | [*.mk] 14 | insert_final_newline = true 15 | indent_style = tab 16 | indent_size = 4 17 | -------------------------------------------------------------------------------- /docker-args: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x 3 | APP="$1"; IMAGE_SOURCE_TYPE="$2" 4 | STDIN=$(cat) 5 | 6 | if [[ "$IMAGE_SOURCE_TYPE" == "dockerfile" ]] && [[ "$0" == *build ]]; then 7 | echo -n "$STDIN" 8 | else 9 | STDIN=$(cat) 10 | OPSWORKS_STACK_NAME=$(grep "OpsWorks Stack:" /etc/motd 2>/dev/null || true) 11 | if [[ -n "$OPSWORKS_STACK_NAME" ]]; then 12 | HOSTNAME=$(echo "$OPSWORKS_STACK_NAME" "$(hostname)" | awk -F: '{ print $2 }' | xargs | tr '[:upper:]' '[:lower:]' | sed -e 's: :-:g') 13 | else 14 | HOSTNAME=$(hostname) 15 | fi 16 | echo -n "$STDIN --hostname=${HOSTNAME}" 17 | fi 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | shellcheck: 2 | ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127) 3 | ifeq ($(shell uname),Darwin) 4 | brew install shellcheck 5 | else 6 | sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse' 7 | sudo apt-get update -qq && sudo apt-get install -qq -y shellcheck 8 | endif 9 | endif 10 | 11 | bats: 12 | ifeq ($(shell bats > /dev/null 2>&1 ; echo $$?),127) 13 | ifeq ($(shell uname),Darwin) 14 | brew install shellcheck 15 | else 16 | sudo add-apt-repository ppa:duggan/bats --yes 17 | sudo apt-get update -qq && sudo apt-get install -qq -y bats 18 | endif 19 | endif 20 | 21 | ci-dependencies: shellcheck bats 22 | 23 | lint: 24 | @echo linting... 25 | @$(QUIET) find . -not -path '*/\.*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034 26 | 27 | setup: 28 | $(MAKE) ci-dependencies 29 | 30 | test: setup lint 31 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Michael Hobbs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dokku-hostname [![Build Status](https://img.shields.io/circleci/project/michaelshobbs/dokku-hostname.svg?branch=master "Build Status")](https://circleci.com/gh/michaelshobbs/dokku-hostname/tree/master) 2 | 3 | Sets the docker hostname option for dokku (https://github.com/dokku/dokku) 4 | 5 | Currently just sets --hostname=`hostname`. 6 | 7 | ## requirements 8 | 9 | - dokku 0.4.0+ 10 | - docker 1.8.x 11 | 12 | 13 | ## installation 14 | 15 | ```shell 16 | # on 0.3.x 17 | cd /var/lib/dokku/plugins 18 | git clone https://github.com/michaelshobbs/dokku-hostname.git dokku-hostname 19 | dokku plugins-install 20 | 21 | # on 0.4.x 22 | dokku plugin:install https://github.com/michaelshobbs/dokku-hostname.git dokku-hostname 23 | ``` 24 | 25 | ## hooks 26 | 27 | This plugin provides the following triggers: 28 | 29 | * `docker-args-build`: adds the `--hostname` env var to the host's `hostname` or (if available) the AWS OpsWorks stack name + - + `hostname` 30 | * `docker-args-deploy`: adds the `--hostname` env var to the host's `hostname` or (if available) the AWS OpsWorks stack name + - + `hostname` 31 | * `docker-args-run`: adds the `--hostname` env var to the host's `hostname` or (if available) the AWS OpsWorks stack name + - + `hostname` 32 | --------------------------------------------------------------------------------