mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-24 05:33:00 +00:00
Format, license, distribution script
This commit is contained in:
parent
96d4253fb3
commit
4407899fbb
3 changed files with 70 additions and 49 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Jörn-Michael Miehe
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
94
kiwi
94
kiwi
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# CONSTANTS #
|
# CONSTANTS #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
# base config filename
|
# base config filename
|
||||||
KIWI_CONF_NAME="kiwi.yml"
|
KIWI_CONF_NAME="kiwi.yml"
|
||||||
|
@ -11,7 +11,7 @@ KIWI_VERSION_TAG="etc/version_tag"
|
||||||
|
|
||||||
# dependencies to run kiwi-config
|
# dependencies to run kiwi-config
|
||||||
KIWI_DEPS=(python3 pipenv less docker docker-compose)
|
KIWI_DEPS=(python3 pipenv less docker docker-compose)
|
||||||
# base install dir
|
# base install dir
|
||||||
KIWI_BASEDIR="${HOME}/.cache/kiwi-config"
|
KIWI_BASEDIR="${HOME}/.cache/kiwi-config"
|
||||||
# per-user env setup script
|
# per-user env setup script
|
||||||
KIWI_ENVFILE="${HOME}/.kiwienv"
|
KIWI_ENVFILE="${HOME}/.kiwienv"
|
||||||
|
@ -49,8 +49,8 @@ WORKDIR="$(pwd)"
|
||||||
|
|
||||||
# add in environment setup
|
# add in environment setup
|
||||||
if [ -f "${KIWI_ENVFILE}" ]; then
|
if [ -f "${KIWI_ENVFILE}" ]; then
|
||||||
# shellcheck source=$HOME/.kiwienv
|
# shellcheck source=$HOME/.kiwienv
|
||||||
source "${KIWI_ENVFILE}"
|
source "${KIWI_ENVFILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
@ -58,7 +58,7 @@ fi
|
||||||
##########
|
##########
|
||||||
|
|
||||||
for dep in "${KIWI_DEPS[@]}"; do
|
for dep in "${KIWI_DEPS[@]}"; do
|
||||||
if ! command -v "${dep}" &> /dev/null; then
|
if ! command -v "${dep}" &>/dev/null; then
|
||||||
echo "Dependency '${dep}' not found, please install!"
|
echo "Dependency '${dep}' not found, please install!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -70,77 +70,77 @@ done
|
||||||
|
|
||||||
# check if pwd is a kiwi folder
|
# check if pwd is a kiwi folder
|
||||||
if [ -f "./${KIWI_CONF_NAME}" ]; then
|
if [ -f "./${KIWI_CONF_NAME}" ]; then
|
||||||
# determine needed kiwi-config version
|
# determine needed kiwi-config version
|
||||||
re_version_line='version\s*:\s*'
|
re_version_line='version\s*:\s*'
|
||||||
eval "$(grep -E "${re_version_line}" "./${KIWI_CONF_NAME}" | sed -r 's/'"${re_version_line}"'/KIWI_VERSION=/')"
|
eval "$(grep -E "${re_version_line}" "./${KIWI_CONF_NAME}" | sed -r 's/'"${re_version_line}"'/KIWI_VERSION=/')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install if kiwi-config not found
|
# install if kiwi-config not found
|
||||||
if [ ! -x "$(kiwi_executable)" ]; then
|
if [ ! -x "$(kiwi_executable)" ]; then
|
||||||
echo -n "Installing kiwi-config v${KIWI_VERSION} into ${KIWI_BASEDIR} ... "
|
echo -n "Installing kiwi-config v${KIWI_VERSION} into ${KIWI_BASEDIR} ... "
|
||||||
|
|
||||||
### TODO: post-release version ###
|
### TODO: post-release version ###
|
||||||
|
|
||||||
# # switch to temp dir
|
# # switch to temp dir
|
||||||
# workdir=$(pwd)
|
# tmpdir=$(mktemp -d)
|
||||||
# tmpdir=$(mktemp -d)
|
# cd "${tmpdir}" || :
|
||||||
# cd "${tmpdir}"
|
|
||||||
|
|
||||||
# # download archive
|
# # download archive
|
||||||
# wget "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
# wget "${KIWI_REPO}/archive/${KIWI_VERSION}.zip"
|
||||||
# unzip "${KIWI_VERSION}.zip"
|
# unzip "${KIWI_VERSION}.zip"
|
||||||
|
|
||||||
# # read archive version tag
|
# # read archive version tag
|
||||||
# cd "kiwi-config-${KIWI_VERSION}"
|
# cd "kiwi-config-${KIWI_VERSION}" || :
|
||||||
# export KIWI_VERSION=$(cat ./version-tag)
|
# KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
||||||
|
|
||||||
# # install archive
|
# # install archive
|
||||||
# mkdir -p "${KIWI_BASEDIR}"
|
# mkdir -p "$(kiwi_installdir)"
|
||||||
# mv ./src "${KIWI_BASEDIR}/${KIWI_VERSION}"
|
# mv "src" "Pipfile" "Pipfile.lock" "$(kiwi_installdir)/"
|
||||||
|
|
||||||
# # discard temp dir
|
# # discard temp dir
|
||||||
# cd "${workdir}"
|
# cd "${WORKDIR}" || :
|
||||||
# rm -rf "${tmpdir}"
|
# rm -rf "${tmpdir}"
|
||||||
|
|
||||||
# echo "OK"
|
# echo "OK"
|
||||||
|
|
||||||
### pre-release version ###
|
### pre-release version ###
|
||||||
|
|
||||||
# use this directory as archive
|
# use this directory as archive
|
||||||
cd "$(dirname "$(readlink -f "${0}")")" ||:
|
cd "$(dirname "$(readlink -f "${0}")")" || :
|
||||||
|
|
||||||
# read this version tag
|
# read this version tag
|
||||||
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
|
||||||
|
|
||||||
if [ -x "$(kiwi_executable)" ]; then
|
if [ -x "$(kiwi_executable)" ]; then
|
||||||
# after version update: no need to install
|
# after version update: no need to install
|
||||||
echo "kiwi-config v${KIWI_VERSION} found!"
|
echo "kiwi-config v${KIWI_VERSION} found!"
|
||||||
else
|
else
|
||||||
# install this
|
# install this
|
||||||
mkdir -p "${KIWI_BASEDIR}"
|
mkdir -p "${KIWI_BASEDIR}"
|
||||||
ln -s "$(readlink -f .)" "$(kiwi_installdir)"
|
ln -s "$(readlink -f .)" "$(kiwi_installdir)"
|
||||||
# cd
|
# cd
|
||||||
echo "OK"
|
echo "OK"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check virtualenv
|
# check virtualenv
|
||||||
cd "$(kiwi_installdir)" ||:
|
cd "$(kiwi_installdir)" || :
|
||||||
if ! pipenv --venv &> /dev/null; then
|
if ! pipenv --venv &>/dev/null; then
|
||||||
# install virtualenv
|
# install virtualenv
|
||||||
echo -n "Preparing virtualenv ... "
|
echo -n "Preparing virtualenv ... "
|
||||||
pipenv sync &> /dev/null
|
pipenv sync &>/dev/null
|
||||||
echo "OK"
|
echo "OK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# go back to the original work directory
|
# go back to the original work directory
|
||||||
cd "${WORKDIR}" ||:
|
cd "${WORKDIR}" || :
|
||||||
|
|
||||||
# setup main environment
|
# setup main environment
|
||||||
KIWI_ROOT="$(kiwi_root)"
|
KIWI_ROOT="$(kiwi_root)"
|
||||||
|
|
||||||
export KIWI_ROOT
|
export KIWI_ROOT
|
||||||
export KIWI_CONF_NAME
|
export KIWI_CONF_NAME
|
||||||
|
export PIPENV_VERBOSITY=-1
|
||||||
|
|
||||||
# run main script
|
# run main script
|
||||||
exec pipenv run "$(kiwi_executable)" "${@}"
|
exec pipenv run "$(kiwi_executable)" "${@}"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
kiwi-config is the tool for container server management.
|
kiwi-config is the tool for container server management.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
- Group your services into projects using their own docker-compose.yml
|
- Group services into projects using their own docker-compose.yml
|
||||||
- Bind to file system by using ${TARGETDIR} as volume in docker-compose.yml
|
- Bind to the local file system by using ${TARGETDIR} as volume in docker-compose.yml
|
||||||
- Add instance-global config files by using ${CONFDIR} as volume in docker-compose.yml
|
- Add instance-global config files by using ${CONFDIR} as volume in docker-compose.yml
|
||||||
- Add instance-global custom values inside docker-compose.yml using config:runtime:env
|
- Add instance-global custom values inside docker-compose.yml using config:runtime:env
|
||||||
- Build service-specific, private docker images from Dockerfiles
|
- Build service-specific, private docker images from Dockerfiles
|
||||||
|
|
Loading…
Reference in a new issue