Browse Source

new: [install.sh] allow a unique ``DEPLOY_REF`` env var to select version to install

This concerns the charm-store, the compose binary and the compose docker image.
By default, ``DEPLOY_REF`` will be ``lokavaluto/dev/master``.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
pull/1/head
Valentin Lab 5 years ago
parent
commit
82aeefc0ac
  1. 63
      src/install.sh

63
src/install.sh

@ -150,13 +150,15 @@ install_file() {
get_charm_store() { get_charm_store() {
local branch="${1:master}"
if ! [ -d "$CHARM_PATH" ]; then if ! [ -d "$CHARM_PATH" ]; then
echo "Creating charm-store in '$CHARM_PATH'." echo "Creating charm-store in '$CHARM_PATH'."
git clone https://git.0k.io/0k-charms.git "$CHARM_PATH" || exit 1
git clone https://git.0k.io/0k-charms.git -b "$branch" "$CHARM_PATH" || exit 1
else else
echo "Updating existing charm-store in '$CHARM_PATH'." echo "Updating existing charm-store in '$CHARM_PATH'."
cd "$CHARM_PATH" || exit 1 cd "$CHARM_PATH" || exit 1
git checkout master &&
git fetch &&
git checkout "$branch" &&
git pull -r || { git pull -r || {
warn "Could not update charm-store, do you have devs ingoing ?" warn "Could not update charm-store, do you have devs ingoing ?"
} }
@ -210,7 +212,7 @@ install.linux() {
COMPOSE_OPTION_FILE=/etc/compose/local.conf COMPOSE_OPTION_FILE=/etc/compose/local.conf
fi fi
fetch_binary https://git.0k.io/0k-compose.git/plain/bin/compose compose
fetch_binary https://git.0k.io/0k-compose.git/plain/bin/compose?h="${DEPLOY_REF}" compose
get_docker_ip get_docker_ip
if [[ ":$PATH:" != *":$BIN_PATH:"* ]]; then if [[ ":$PATH:" != *":$BIN_PATH:"* ]]; then
@ -218,54 +220,22 @@ install.linux() {
"the simple usage of 'compose' command." "the simple usage of 'compose' command."
fi fi
## CHARMS
get_charm_store || exit 1
get_charm_store "${DEPLOY_REF}" || exit 1
##
## YYYvlab: following needs to be discussed further with njeudy
##
cat <<EOF | install_file "$COMPOSE_OPTION_FILE"
#CHARM_STORE=$CHARM_STORE
COMPOSE_DOCKER_IMAGE=docker.0k.io/compose:${DEPLOY_REF//\//-}
#if [ "${docker_run_opts+x}" ]; then
# docker_run_opts+=("-v" "/home/vaab/dev/sh/0k-compose/bin/compose-core:/usr/local/bin/compose-core")
#fi
## DEFAULT COMPOSE
# cat <<EOF | install_file "$DEFAULT_COMPOSE_YML"
# odoo:
# charm: odoo-tecnativa
# # docker-compose:
# # ## Important to keep as a list: otherwise it'll overwrite charm's arguments.
# # command:
# # - "--log-level=debug"
# # environment:
# # TOTO: TATA
# # image: mynewimage
# # options:
# # workers: 1
# # modules: ## 'base' is automatically added
# # - l10n_fr
# # - mymodule
# # database: mybase ## defaults to database in relation
# frontend:
# charm: apache
# EOF
# cat <<EOF | install_file "$COMPOSE_OPTION_FILE"
# #CHARM_STORE=$CHARM_STORE
# #COMPOSE_DOCKER_IMAGE=docker.0k.io/compose:1.3.0-rc5
# #if [ "${docker_run_opts+x}" ]; then
# # docker_run_opts+=("-v" "/home/vaab/dev/sh/0k-compose/bin/compose-core:/usr/local/bin/compose-core")
# #fi
# #DEFAULT_COMPOSE_YML=$DEFAULT_COMPOSE_YML
# EOF
#DEFAULT_COMPOSE_YML=$DEFAULT_COMPOSE_YML
EOF
} }
install.docker-toolbox-for-mac() { install.docker-toolbox-for-mac() {
install.linux install.linux
} }
@ -273,7 +243,7 @@ install.docker-toolbox-for-mac() {
install.wsl() { install.wsl() {
CHARM_PATH=~/.charm-store CHARM_PATH=~/.charm-store
get_charm_store || return 1
get_charm_store "${DEPLOY_REF}" || return 1
get_docker_ip get_docker_ip
} }
@ -299,4 +269,7 @@ run() {
ansi_color tty ansi_color tty
DEPLOY_REF="${DEPLOY_REF:-lokavaluto/dev/master}"
run run
Loading…
Cancel
Save