Kickstart is a bash script to evaluate .kick.yml and start development environment inside the container.
See https://nfra.infracamp.org for detailed documentation.
On your local workstation, kickstart.sh
will:
DEV_MODE=1
and giving you an interactive shell as user user
inside the container./opt
inside the container so every user has the same absolute path.http://localhost
(configured by project in .kickstartconfig
or global in $HOME/.kickstartconfig
)user
inside the container according to your actual uid so there will no permission problems$HOME/.kickcstartonfig
file for additional mounts/ports/settings$HOME/.kickstart/secrets/<project>/<secret_name>
to the container.env
-fileDOCKER_HOST_IP
.kick-stack.yml
in composer format.kick.yml
-file in the project folder (if using kickstart-flavor-containers)kickstart.sh
and provide auto-download updates by calling ./kickstart.sh --upgrade
On testing stage kickstart.sh
will:
On CI/CD pipeline kickstart.sh
will:
gitlab-ci
, github-actions
, jenkins
build environment and determine TAG
and BRANCH
docker build
and tagging with the correct tagsOn Deploy-stage:
A bash script to start and manage your develompment containers.
Change into your project directory.
Run the container defined in .kick.yml
:
kickstart
Run a command defined in .kick.yml
-command:
section:
kickstart :[command]
List available skeletons:
kickstart skel list
Install skeleton:
kickstart skel install <name>
Upgrade to newest kickstart version:
kickstart upgrade
Run a ci-build (build and push using gitlab-ci-runner):
kickstart ci-build
Copy’n’Paste installer script: (execute as user in your project-directory)
sudo curl -o /usr/bin/kickstart "https://raw.githubusercontent.com/nfra-project/nfra-kickstart/master/dist/kickstart.sh" && sudo chmod +x /usr/bin/kickstart
The script will save kickstart.sh to systems /usr/bin directory and set the executalbe bit.
Run kickstart:
kickstart
Kickstart will create an empty .kick.yml
file in the current directory. You might want to edit
at least the from:
-Line.
version: 1
from: "infracamp/kickstart-flavor-ubuntu"
..more options..
Run kickstart
- the container should start.
To select a special flavor select
version: 1
from: "infracamp/kickstart-flavor-gaia"
See infracamp.org/container/ for full list and links to their documentation.
.kick.yml:
config_file:
template: "config.php.dist"
target: "config.php"
Will read config.dist.php
file, which will be parsed copied into config.php.
config.php.dist
<?php
define("CONF_MYSQL_HOST", "%CONF_MYSQL_HOST%");
define("VERSION_STRING", "%VERSION_STRING%");
The configuration will be loaded from environment variables.
kick
You can define commands and run it inside the container.
version: 1
from: "infracamp/kickstart-flavor-gaia"
command:
build:
- "echo 'Build called'"
run:
- "echo 'Run called'"
do_something:
- "echo 'doing something'"
kick do_something
Kickstart will search for a file .kick-stack.yml
in the project main
directory. If this file exists, it will be deployed as docker stack.
Make sure, all services you want to access from within your container
are attached to the external network project_name
Assume our project_name is my_proj_1
and we want to provide a mysql service
version: "3"
services:
mysqld:
image: mysql
networks:
- my_proj_1
networks:
my_proj_1:
external: true
The mysql service will be availabe as my_proj_1_mysqld
.
Kickstart will read the user-config from:
~/.kickstartconfig
Available Options:
KICKSTART_DOCKER_RUN_OPTS="" # Optional parameters passed to the docker run command
KICKSTART_PORTS="80:4200;25:25" # Change the Port-Mappings
KICKSTART_WIN_PATH= # If running on windows - map bash
Secrets can be added either via the command kickstart secrets add <secretname>
or
via Environment variables (used for ci-builds). All variables names KICKSECRET_name
will
be mounted to /run/secrets/name
.
./kickstartconfig
By default, kickstart will configure debuggers to send data to 10.10.10.10
. So
this ip should be added to your pc’s networks.
Start one or more containers. If you are not using kickstart, make sure
you specify a name with the parameter --name
.
Create, if not already exisitng a project-wide .kickstartconfig
file.
Add a Line:
KICKSTART_DOCKER_RUN_OPTS="--link otherContainerName"
You can build ready-to-deploy containers with kickstart. Just add a Dockerfile
to your Project-Folder
FROM nfra/kickstart-flavor-php:8.0
ENV DEV_CONTAINER_NAME="some_name"
ENV HTTP_PORT=80
ADD / /opt
RUN ["bash", "-c", "chown -R user /opt"]
RUN ["/kickstart/container/start.sh", "build"]
ENTRYPOINT ["/kickstart/container/start.sh", "standalone"]
Interval: A kick interval
will be triggered every second (synchronous).
To save cpu-time you could add this to your .kick.yml
command:
interval:
- "sleep 300"
Add a tag to the master branch and add the gitlab-ci config
latest:
stage: build
script:
- ./kickstart.sh ci-build
only:
- master
- /^v.*$/
This will create a latest
tag on every push and a latest and vx.x.x
tagged
docker image on tagged builds.
Kickstart maintains a VERSION
file in the projects root directory. To prevent
merge issues, the file is filled with fixed mock data during development and only
written if the parameter --write-version
is present. (This is always the case
in ci-build mode).
The VERSION
file is made for fast reading with static lines:
# This is an autogenerated Version file (from kickstart):
4
Fri, 19 Feb 2021 12:33:13 +0100
Sun, 14 Feb 2021 13:08:41 +0100
315bc50
developer name
Feel free to build your own flavors.
Some rules:
latest
(stable release) and testing
(current master branch build)Flavor names derive from greek mystical names click