From 7386272184d8e158c66febbd58ececc94887ef62 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 20 Apr 2021 17:57:48 +0200 Subject: [PATCH] add readme --- readme.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..21d40cb --- /dev/null +++ b/readme.md @@ -0,0 +1,89 @@ +# IML deployment client :: proof of concept :: WIP + +This client is a set of bash scripts to deploy a package that was built on ci server. + +## License + +GNU GPL 3.0 + +## Source + +URL: <https://git-repo.iml.unibe.ch/iml-open-source/imldeployment-client/> + +## Installation + +On a server the client must be deployed i.e. in `/opt/deployment-client/` + +Use git clone if you feel familiar with git. Otherwise download the archive and extract it. + +## Set up a software package + +### Set up access to software + +This setting is for all projects on the server. It has to be done once. + +* in ./bin directory copy getfile.sh.cfg.dist to getfile.sh.cfg +* edit getfile.sh.cfg and define software endpoint and set the phase: + +```txt +IMLCI_URL=https://software.example.com +IMLCI_PKG_SECRET=put-secret-here +IMLCI_PHASE=preview +``` + +### Set up rollout + +* Create a subdirectory in ./profiles/ for each rollout +* The example subdir gives an orientation and can be copied, i.e. `cp -r example myapp` +* create a config file named `./profiles/myapp/config.sh` + +```txt +# my install dir +installdir=/var/www/myapp + +# fileowner +# appowner="user:www-data" + +# ----- settings for CI server software package + +# override global value +# export IMLCI_PHASE=preview + +# see output of +export IMLCI_PROJECT=id-in-ci-server +``` + +Make a testrun: `./deploy_app.sh` in application root. +It should download the software package and extract it and install it into you `${installdir}`. + +### Add hooks + +If needed you can create hook scripts. The working directory is `${installdir}` that you can use relative pathes to point to your files in the the extracted sources. + +* profiles/myapp/tasks_preinstall.sh - do something before extracting the archive. +* profiles/myapp/tasks_config.sh - replace config files (see below) +* profiles/myapp/tasks_postinstall.sh - do postinstall actions before finishing + +```txt +# ---------------------------------------------------------------------- +# TASKS :: POST INSTALL ACTIONS +# ---------------------------------------------------------------------- +hooks/ondeploy +``` + +### Create configs + +The script `./bin/create_config.sh` can read config templates and create an output file. + +You need to reference the template, output file and a file for replacement data. + +```txt +# ---------------------------------------------------------------------- +# TASKS :: GENERATE CONFIGS +# ---------------------------------------------------------------------- + +# create_config.sh template_file target_file replacements (can be multiple files) +# | | | | +# v v v v +"${selfdir}/bin/create_config.sh" hooks/templates/mytemplate.erb config/target.php ${projectdir}/replace.txt +``` -- GitLab