Sign inSign up

eltonplima/convox

By eltonplima

Updated about 7 years ago

Convox CLI with other good stuffs like zsh.

Image
0

3.2K

eltonplima/convox repository overview

docker-convox

Convox image with convox and some other good stuffs

Functions

  • search_envvar - Search for a envvar on all convox applications. This search is case insensitive.
  • ping_apps - Make a http request on each app and print the headers. This function can be used to find problematic apps.
  • list_apps_resources - List the resources(CPU/MEM/# RUNNING) of each application.

Environment variables

  • CONVOX_PASSWORD - If set the container automatically run convox login;
  • CONVOX_RACK - If set the container automatically switch to declared rack.
Examples
$ search_envvar key
$ ping_apps
HTTP/2 200 
date: Fri, 18 Jan 2019 15:24:58 GMT
content-type: text/html; charset=utf-8
content-length: 21

200 https://foo.bar.com.br/
$ list_apps_resources
                            my-app-a
SERVICE  DESIRED  RUNNING  CPU  MEMORY
clock    1        1        256  512   
web      1        2        256  512   
worker   1        0        256  512   

                            my-app-b
SERVICE  DESIRED  RUNNING  CPU  MEMORY
web      2        2        1024  512   
aliases

Instead of trying to memorize a new long command, we will to simplify your life, here are some useful function and aliases to put on your .zshrc or .bashrc

# If the container is running then we use docker exec to get into it.
# Otherwise we create a new dischargeable container.
function run_convox_container() {
    declare container_name=${1}
    declare convox_password=${2}
    declare convox_apps_path=${3}
    # we use this variable to store the shell history outside of the container.
    declare convox_zsh_history="${HOME}/.zsh_history_${container_name}"
    [[ ! -f ${convox_zsh_history} ]] && touch ${convox_zsh_history}
    docker pull eltonplima/convox && \
        # If the container is running we use it, otherwise we create a new one.
        docker exec -it ${container_name} zsh || docker run --name ${container_name} -it --rm -e CONVOX_PASSWORD=${convox_password} -v ${convox_apps_path}:/home/convox/apps -v ${convox_zsh_history}:/home/convox/.zsh_history eltonplima/convox
}

# Convox staging rack
export CONVOX_STAGING_CONTAINER_NAME=convox_staging
export CONVOX_STAGING_PASSWORD=YOUR_CONVOX_STAGING_RACK_PASSWORD
export CONVOX_APPS_PATH="${HOME}/my_apps_repo/"

# Convox prod rack
export CONVOX_PROD_CONTAINER_NAME=convox_prod
export CONVOX_PROD_PASSWORD=YOUR_CONVOX_PROD_RACK_PASSSWORD

alias convox_prod="run_convox_container ${CONVOX_PROD_CONTAINER_NAME} ${CONVOX_PROD_PASSWORD} ${CONVOX_APPS_PATH}"
alias convox_stgn="run_convox_container ${CONVOX_STAGING_CONTAINER_NAME} ${CONVOX_STAGING_PASSWORD} ${CONVOX_APPS_PATH}"

Now we can use our new aliases:

convox_prod
# or
convox_stgn

Tag summary

Content type

Image

Digest

Size

122.9 MB

Last updated

about 7 years ago

docker pull eltonplima/convox