project renamed

This commit is contained in:
Jörn-Michael Miehe 2020-08-26 13:56:51 +02:00
parent 3faa629a13
commit fd8a2f201e
16 changed files with 48 additions and 48 deletions

View file

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kiwi-config.iml" filepath="$PROJECT_DIR$/.idea/kiwi-config.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/kiwi-scp.iml" filepath="$PROJECT_DIR$/.idea/kiwi-scp.iml" />
</modules> </modules>
</component> </component>
</project> </project>

View file

@ -1,4 +1,4 @@
# kiwi-config # kiwi: simple, consistent, powerful
The simple tool for managing container servers The simple tool for managing container servers
@ -6,7 +6,7 @@ The simple tool for managing container servers
## Quick start ## Quick start
- Learn to use `docker` with `docker-compose` - Learn to use `docker` with `docker-compose`
- Install kiwi-config - Install kiwi-scp
- Look at [the example instance](./example) - Look at [the example instance](./example)
- Look at the output of `kiwi --help` - Look at the output of `kiwi --help`
- Start building your own instances - Start building your own instances
@ -18,7 +18,7 @@ A convenience installer is available as [install.sh](./install.sh) in this direc
You can `curl | sh` it using the following one-liner. You can `curl | sh` it using the following one-liner.
```shell script ```shell script
curl --proto '=https' --tlsv1.2 -sSf 'https://raw.githubusercontent.com/ldericher/kiwi-config/master/install.sh' | sh curl --proto '=https' --tlsv1.2 -sSf 'https://raw.githubusercontent.com/ldericher/kiwi-scp/master/install.sh' | sh
``` ```
The installer downloads the `kiwi` launcher script and installs it to a location of your choice. The installer downloads the `kiwi` launcher script and installs it to a location of your choice.
@ -26,12 +26,12 @@ Please consider installing into a directory inside your `$PATH`.
Run in a root shell or use `sudo sh` instead for system-wide installation. Run in a root shell or use `sudo sh` instead for system-wide installation.
You should now be able to run `kiwi init --show` and see the default configuration file. You should now be able to run `kiwi init --show` and see the default configuration file.
This downloads the latest version of the main kiwi-config executable and sets it up for you. This downloads the latest version of the main kiwi-scp executable and sets it up for you.
### Adjusting environment for `kiwi` ### Adjusting environment for `kiwi`
`kiwi-config` depends on Python 3.6 (or later), [pipenv](https://pipenv.pypa.io/), and `kiwi-scp` depends on Python 3.6 (or later), [pipenv](https://pipenv.pypa.io/), and
[less](http://www.greenwoodsoftware.com/less/) being in your `$PATH`. [less](http://www.greenwoodsoftware.com/less/) being in your `$PATH`.
In some cases, notably when using a multi-version system such as In some cases, notably when using a multi-version system such as
@ -52,29 +52,29 @@ contain:
## Get started ## Get started
### Create a kiwi-config instance ### Create a kiwi-scp instance
Any directory is implicitly a valid `kiwi-config` instance using the default configuration. Any directory is implicitly a valid `kiwi-scp` instance using the default configuration.
To prevent surprises however, you should run `kiwi init` in an empty directory and follow its directions before To prevent surprises however, you should run `kiwi init` in an empty directory and follow its directions before
actually using `kiwi` more. actually using `kiwi` more.
### Concept ### Concept
A `kiwi-config` instance is a directory containing a bunch of static configuration files. A `kiwi-scp` instance is a directory containing a bunch of static configuration files.
"Static" there as in "those don't change during normal service operation". "Static" there as in "those don't change during normal service operation".
These files could be anything from actual `.conf` files to entire html-web-roots. These files could be anything from actual `.conf` files to entire html-web-roots.
Non-static, but persistent files are to be kept in a "service data directory", by default `/var/kiwi`. Non-static, but persistent files are to be kept in a "service data directory", by default `/var/kiwi`.
In your `docker-compose.yml` files, you can refer to that directory as **${TARGETROOT}**. In your `docker-compose.yml` files, you can refer to that directory as **${TARGETROOT}**.
Start the current directory as a `kiwi-config` instance using `kiwi up`, or stop it using `kiwi down`. Start the current directory as a `kiwi-scp` instance using `kiwi up`, or stop it using `kiwi down`.
This also creates kiwi's internal hub network, which you can use as **kiwi_hub** in your `docker-compose.yml` files. This also creates kiwi's internal hub network, which you can use as **kiwi_hub** in your `docker-compose.yml` files.
### Projects ### Projects
A `kiwi-config` instance usually contains several projects. A `kiwi-scp` instance usually contains several projects.
A project is a collection of dependent or at least logically connected services, described by a `docker-compose.yml`. A project is a collection of dependent or at least logically connected services, described by a `docker-compose.yml`.
A well-known example would be webserver + php + database. A well-known example would be webserver + php + database.
@ -89,14 +89,14 @@ Each project will have its own place in the service data directory, which you ca
Finally, start a project using `kiwi up <project-name>`. Finally, start a project using `kiwi up <project-name>`.
### Advanced kiwi-config ### Advanced kiwi-scp
`kiwi-config` extends the logical bounds of `docker-compose` to handling multiple projects. `kiwi-scp` extends the logical bounds of `docker-compose` to handling multiple projects.
#### The `kiwi_hub` #### The `kiwi_hub`
With kiwi-config, you get the internal kiwi_hub network for free. With kiwi-scp, you get the internal kiwi_hub network for free.
It allows for network communication between services in different projects. It allows for network communication between services in different projects.
Be aware, services only connected to the kiwi_hub can't use a port mapping! Be aware, services only connected to the kiwi_hub can't use a port mapping!
In most cases, you will want to use this: In most cases, you will want to use this:

View file

@ -16,7 +16,7 @@
<body> <body>
<h1>Another Hello World!</h1> <h1>Another Hello World!</h1>
<p>This service uses an off-the-shelf image and the conf-directory feature of kiwi-config.</p> <p>This service uses an off-the-shelf image and the conf-directory feature of kiwi-scp.</p>
<p><em>Greetings, nginx.</em></p> <p><em>Greetings, nginx.</em></p>
</body> </body>

View file

@ -15,9 +15,9 @@
<body> <body>
<h1>Hello World!</h1> <h1>Hello World!</h1>
<h2>kiwi-config works.</h2> <h2>kiwi-scp works.</h2>
<p>This is an example service on a custom image assembled by kiwi-config.<br /> But wait, there's more!</p> <p>This is an example service on a custom image assembled by kiwi-scp.<br /> But wait, there's more!</p>
<a href="//localhost:8081"><h3>Adminer</h3></a> <a href="//localhost:8081"><h3>Adminer</h3></a>
<p>There's a mySQL database included in this project. Login with user <q>root</q> and password <q>changeme</q>.</p> <p>There's a mySQL database included in this project. Login with user <q>root</q> and password <q>changeme</q>.</p>

View file

@ -1,6 +1,6 @@
###################################### ###################################
# kiwi-config instance configuration # # kiwi-scp instance configuration #
###################################### ###################################
version: '0.1.1' version: '0.1.1'

View file

@ -7,7 +7,7 @@
# default installation directory # default installation directory
INSTALL_DIR_DEFAULT="/usr/local/bin" INSTALL_DIR_DEFAULT="/usr/local/bin"
# URI of "kiwi" launcher script # URI of "kiwi" launcher script
KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-config/master/kiwi" KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/kiwi"
############# #############
# FUNCTIONS # # FUNCTIONS #
@ -47,7 +47,7 @@ if [ -x "${install_kiwi}" ]; then
# kiwi is installed: Choose that directory # kiwi is installed: Choose that directory
install_dir="$(dirname "${install_kiwi}")" install_dir="$(dirname "${install_kiwi}")"
if ! yes_no "kiwi-config found in '${install_dir}'. Overwrite?"; then if ! yes_no "kiwi executable found in '${install_dir}'. Overwrite?"; then
die "Uninstall existing '${install_kiwi}' first" die "Uninstall existing '${install_kiwi}' first"
fi fi

26
kiwi
View file

@ -9,23 +9,23 @@ KIWI_CONF_NAME="kiwi.yml"
# version tag filename # version tag filename
KIWI_VERSION_TAG="etc/version_tag" KIWI_VERSION_TAG="etc/version_tag"
# dependencies to run kiwi-config # dependencies to run kiwi-scp
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}/.local/lib/kiwi-config" KIWI_BASEDIR="${HOME}/.local/lib/kiwi-scp"
# per-user env setup script # per-user env setup script
KIWI_ENVFILE="${HOME}/.kiwienv" KIWI_ENVFILE="${HOME}/.kiwienv"
# repository uri # repository uri
KIWI_REPO="https://github.com/ldericher/kiwi-config" KIWI_REPO="https://github.com/ldericher/kiwi-scp"
# use latest version by default # use latest version by default
KIWI_VERSION="master" KIWI_VERSION="master"
# URI of "kiwi" launcher script # URI of "kiwi" launcher script
KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-config/master/kiwi" KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/kiwi"
INSTALLER_URI="https://raw.githubusercontent.com/ldericher/kiwi-config/master/install.sh" INSTALLER_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/install.sh"
# canary file: limit curl requests # canary file: limit curl requests
CANARY_FILENAME="/var/lock/kiwi-config.canary" CANARY_FILENAME="/var/lock/kiwi-scp.canary"
CANARY_MAXAGE=600 CANARY_MAXAGE=600
@ -33,7 +33,7 @@ CANARY_MAXAGE=600
# DYNAMIC STRINGS # # DYNAMIC STRINGS #
################### ###################
# uri of correct kiwi-config archive # uri of correct kiwi-scp archive
kiwi_archive_uri() { kiwi_archive_uri() {
echo "${KIWI_REPO}/archive/${KIWI_VERSION}.tar.gz" echo "${KIWI_REPO}/archive/${KIWI_VERSION}.tar.gz"
} }
@ -50,7 +50,7 @@ kiwi_root() {
# main script in installed version # main script in installed version
kiwi_executable() { kiwi_executable() {
echo "$(kiwi_root)/kiwi-config.py" echo "$(kiwi_root)/kiwi-scp.py"
} }
# cache current work directory # cache current work directory
@ -150,7 +150,7 @@ if [ "${run_kiwi_check}" = "yes" ]; then
echo "" >/dev/stderr echo "" >/dev/stderr
echo "####################" >/dev/stderr echo "####################" >/dev/stderr
echo "Please manually update your kiwi launcher by re-running the installation process:" >/dev/stderr echo "Please manually update your kiwi launcher by re-running the installation process:" >/dev/stderr
echo "https://github.com/ldericher/kiwi-config/#installation" >/dev/stderr echo "https://github.com/ldericher/kiwi-scp/#installation" >/dev/stderr
echo "####################" >/dev/stderr echo "####################" >/dev/stderr
echo "" >/dev/stderr echo "" >/dev/stderr
@ -163,14 +163,14 @@ fi
# 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-scp 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-scp not found
if [ ! -x "$(kiwi_executable)" ]; then if [ ! -x "$(kiwi_executable)" ]; then
printf "Installing kiwi-config v%s into %s ... " "${KIWI_VERSION}" "${KIWI_BASEDIR}" printf "Installing kiwi-scp v%s into %s ... " "${KIWI_VERSION}" "${KIWI_BASEDIR}"
# switch to temp dir # switch to temp dir
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
@ -180,7 +180,7 @@ if [ ! -x "$(kiwi_executable)" ]; then
curl --proto '=https' --tlsv1.2 -sSfL "$(kiwi_archive_uri)" | tar xz curl --proto '=https' --tlsv1.2 -sSfL "$(kiwi_archive_uri)" | tar xz
# read archive version tag # read archive version tag
cd "kiwi-config-${KIWI_VERSION}" || : cd "kiwi-scp-${KIWI_VERSION}" || :
KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}") KIWI_VERSION=$(cat "./src/${KIWI_VERSION_TAG}")
if [ -x "$(kiwi_executable)" ]; then if [ -x "$(kiwi_executable)" ]; then

View file

@ -5,7 +5,7 @@ Commands for Operation:
restart Restart the whole instance, a project or service(s) inside a project restart Restart the whole instance, a project or service(s) inside a project
Commands for Instance Management: Commands for Instance Management:
init Initialize or reconfigure kiwi-config instance init Initialize or reconfigure kiwi-scp instance
show Show projects in this instance, services inside a project or service(s) inside a project show Show projects in this instance, services inside a project or service(s) inside a project
cmd Run raw docker-compose command in a project cmd Run raw docker-compose command in a project

View file

@ -1,3 +1,3 @@
###################################### ###################################
# kiwi-config instance configuration # # kiwi-scp instance configuration #
###################################### ###################################

View file

@ -1,4 +1,4 @@
kiwi-config is the simple tool for managing container servers. kiwi is the simple tool for managing container servers.
Features: Features:
- Group services into projects using their own docker-compose.yml - Group services into projects using their own docker-compose.yml

View file

@ -7,14 +7,14 @@ import os
# location of "src" directory to use # location of "src" directory to use
KIWI_ROOT = os.getenv('KIWI_ROOT', ".") KIWI_ROOT = os.getenv('KIWI_ROOT', ".")
# default name of kiwi-config file # default name of kiwi-scp file
KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml") KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml")
############ ############
# FILE NAMES # FILE NAMES
# text files inside kiwi-config "src" directory # text files inside kiwi-scp "src" directory
HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_header.yml" HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_header.yml"
DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_default.yml" DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/etc/kiwi_default.yml"
VERSION_TAG_NAME = f"{KIWI_ROOT}/etc/version_tag" VERSION_TAG_NAME = f"{KIWI_ROOT}/etc/version_tag"
@ -32,5 +32,5 @@ IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/images"
# DOCKER IMAGE NAMES # DOCKER IMAGE NAMES
# name for auxiliary docker images # name for auxiliary docker images
LOCAL_IMAGES_NAME = 'localhost/kiwi-config/auxiliary' LOCAL_IMAGES_NAME = 'localhost/kiwi-scp/auxiliary'
DEFAULT_IMAGE_NAME = 'alpine:latest' DEFAULT_IMAGE_NAME = 'alpine:latest'

View file

@ -14,7 +14,7 @@ class Config:
__yml_content = {} __yml_content = {}
__keys = { __keys = {
'version': "kiwi-config version to use in this instance", 'version': "kiwi-scp version to use in this instance",
'runtime:storage': "local directory for service data", 'runtime:storage': "local directory for service data",
'runtime:shells': "shell preference for working in service containers", 'runtime:shells': "shell preference for working in service containers",

View file

@ -37,7 +37,7 @@ class SubCommand:
"""actually run command with parsed CLI args""" """actually run command with parsed CLI args"""
# run for entire instance # run for entire instance
logging.info(f"{self._action} kiwi-config instance at '{os.getcwd()}'") logging.info(f"{self._action} kiwi-scp instance at '{os.getcwd()}'")
return self._run_instance(runner, args) return self._run_instance(runner, args)

View file

@ -15,7 +15,7 @@ class InitCommand(SubCommand):
super().__init__( super().__init__(
'init', 'init',
action=f"Initializing '{KIWI_CONF_NAME}' in", action=f"Initializing '{KIWI_CONF_NAME}' in",
description="Initialize or reconfigure kiwi-config instance" description="Initialize or reconfigure kiwi-scp instance"
) )
# -f switch: Initialize with default config # -f switch: Initialize with default config

View file

@ -35,7 +35,7 @@ class ShowCommand(ServiceCommand):
) )
def _run_instance(self, runner, args): def _run_instance(self, runner, args):
print(f"kiwi-config instance at '{os.getcwd()}'") print(f"kiwi-scp instance at '{os.getcwd()}'")
print("#########") print("#########")
projects = Projects.from_dir() projects = Projects.from_dir()