Table of Contents
Scripts
deploy_app.sh
This is the main deployment script.
./deploy_app.sh -h
_______________________________________________________________________________
IML - DEPLOYMENT CLIENT
DOCS: https://os-docs.iml.unibe.ch/imldeployment-client/ _____
_________________________________________________________________________/ v1.5
HELP:
Loads one or more profiles profile to deploy an application.
If the download file is not newer then it does not extract files and does not
Optionally it cleans up the target directory.
Runs pre and post hooks - it updates the config files only and sets the owner.
SYNTAX:
deploy_app.sh [OPTION] [PROFILE(S)]
OPTIONS:
-h | show this help and exit
-f | force full installation even if the download file is not newer
-l | list exiting profile names
PROFILE(S):
Set one or more valid profile names. By default it loops over all profiles.
This prameter limits the execution to the given profiles.
Use option -l to get a list of profiles.
If you start it without parameter it will loop over all existing profiles. You can add an existing profile name to limit the execution to that profile only.
To start a single profile start ./deploy_app.sh -l
to get a list of exisring configured profiles
and then ./deploy_app.sh [PROFILE]
.
Each execution on CLI or cronjob creates a log file per profile in /var/log/imldeployment-client/.
> ls -ltr /var/log/imldeployment-client/
total 60
-rw-r--r-- 1 root root 28613 Apr 25 15:09 profile_A__2022-04-25__150405.log
-rw-r--r-- 1 root root 30747 Apr 25 15:10 profile_B__2022-04-25__150959.log
Each logfile contens the profile name + 2 underscore + timestamp. There is an automatic cleanup: the script keeps the last 10 logs per profile.
./bin/create_config.sh
The script is used to read a template (*.erb) to replace simple placeholders
by regex <\%\=\ *\@replace\[\"$key\"\]\ *\%>
with a value coming from one or more
replacement data files. The output will be written to a target file.
===== IML DEPLOYMENT :: replace variables in erb syntax =====
template :
output :
replacements: replace*.txt
ERROR: missing params.
create_config.sh TEMPLATE-FILE OUTFILE [optional: REPLACE-DATA-FILE]
./bin/getfile.sh
With getfile.sh you can access the software archive.
- read phase names
- read ci project ids available in a given phase
- list files of a given projects of a phase
- download a single file to a custom target file
- download ALL files to current working directory
SYNTAX:
getfile.sh [OPTIONS]
OPTIONS:
-c CFGFILE load custom config file after defaults in getfile.sh.cfg
-d enable debug infos
-e PHASE phase; overrides env variable IMLCI_PHASE
-f FILE filename to get (without path); overrides env variable IMLCI_FILE
-l ITEM list
-o OUTFILE optional output file
-p PROJECT ci project id; overrides env variable IMLCI_PROJECT
-s SECRET override secret in IMLCI_PKG_SECRET
-u URL URL of iml ci server without trailing /; overrides env variable IMLCI_URL
VALUES:
CFGFILE custom config file. It is useful to handle files of different
projects on a server.
PHASE is a phase of the ci server; one of preview|stage|live
FILE is a filename without path that was created by ci server.
OUTFILE Output file. It can countain a path. If none is given the filename
will be taken from FILE and stored in current directory
PROJECT project id of the ci server
SECRET secret to access project data on package server. Your given secret
must match the secret on package server to get access to any url.
ITEM type what to list; one of phases|projects|files
To list projects a phase must be set.
To list files a phase and a project must be set.
DEFAULTS:
You don't need to set all values by command line. Use a config to set defaults
./getfile.sh.cfg
EXAMPLES:
If url, secret, project and phase are set in the config you can operate by
setting the filename to request.
getfile.sh -f FILE
downloads FILE to the current dir.
getfile.sh -f FILE -o my-own-filename.tgz
downloads FILE as my-own-filename.tgz
getfile.sh -f ALL
there is a special file ALL; it fetches all filenames by executing a directory
listing and then downloads all remote files with their original name
getfile.sh -e preview -l projects
list existing projects in phase preview
getfile.sh -l files
list existing files of current project
Remark: The directory listing can be turned off on the package server and
results in a 403 status.
check_deployment.sh
This is a script to show the current installation status of all apps. This script returns exit status > 0 if the rollout or a file generation failed.
The script doesn’t support parameters.
Example:
./check_deployment.sh
OK: Deployment ... Profiles: 2 ... Errors: 0
OK: userportal - /var/log/imldeployment-client/userportal__2024-05-10__154349.log
OK: intranet - /var/log/imldeployment-client/intranet__2024-05-10__154337.log