Simplicité Software

Add version 5 to an existing SIM server

Login as user simplicite.

Install version 5

Clone the version 5 template Git repository:

cd /var/simplicite/git
git clone --bare

Warning: make sure to change _your_Git_username_ and _your_Git_password_ by your own Git credentials

Create the version 5 variants (dev/prerelease/release) in the SIM database:

sql "insert into versions values ('5', '1970-01-01 00:00:00')"
sql "insert into versions values ('5p', '1970-01-01 00:00:00')"
sql "insert into versions values ('5r', '1970-01-01 00:00:00')"

And optionnaly their "light" variants:

sql "insert into versions values ('5l', '1970-01-01 00:00:00')"
sql "insert into versions values ('5pl', '1970-01-01 00:00:00')"
sql "insert into versions values ('5rl', '1970-01-01 00:00:00')"

Add the post receive hook for the template:

vi template-5.git/hooks/post-receive

With following content:


for branch in master prerelease release
# or for branch in master master-light prerelease prerelease-light release release-light
    [ $branch = 'master-light' ] && version=${version}l
    [ $branch = 'prerelease' ] && version=${version}p
    [ $branch = 'prerelease-light' ] && version=${version}pl
    [ $branch = 'release' ] && version=${version}r
    [ $branch = 'release-light' ] && version=${version}rl
    echo "Updating version $version template (branch $branch)..."
    rm -fr /var/simplicite/template-$version
    mkdir /var/simplicite/template-$version
    git --work-tree=/var/simplicite/template-$version --git-dir=/var/simplicite/git/template-$gitversion.git checkout -f $branch
    if [ $? = 0 ]
        chmod +x /var/simplicite/template-$version/tools/*.sh
        date=`git --git-dir=/var/simplicite/git/template-$gitversion.git log -1 --date=iso | awk '/^Date:/ { print $2" "$3 }'`
        echo "Last commit date: $date"
        sqlite3 /var/simplicite/data/apps.db "update versions set date = '$date' where version = '$version'"
        echo "Done"
        echo "${branch} not (yet) available in /var/simplicite/git/template-$gitversion.git"

Note in the above steps you may not require all variants of version 5, adapt the commands/scripts accordingly

Make it executable:

chmod +x template-5.git/hooks/post-receive

Execute it:


Edit the post receive hook for the instance manager:

vi apps.git/hooks/post-receive

with following content:


echo "Updating instances manager..."
sudo su simplicite -c "git --work-tree=/var/simplicite/apps --git-dir=/var/simplicite/git/apps.git checkout -f master"
# 4.0 and 5 specific = duplicate version settings for all branches
for v in l m ml p pl r rl
    cat /var/simplicite/apps/bin/ | sed "s/template-4.0/template-4.0$v/g" > /var/simplicite/apps/bin/version-4.0$
    cat /var/simplicite/apps/bin/ | sed "s/template-5/template-5$v/g" > /var/simplicite/apps/bin/version-5$
sudo chmod +x /var/simplicite/apps/bin/*.sh
sudo su simplicite -c "touch /var/simplicite/logs/apps.log"
sudo chmod 660 /var/simplicite/logs/apps.log
echo "Done"

Execute it:


Verify installation

At that stage you should have the version 5 templates availables in the /var/simplicite/template-5* folders.

And a call to sim versions should display version 5 templates with their latest revision dates, e.g.:

> sim version
5     2020-09-25 19:20:00
5p    2020-09-25 19:21:00
5r    2020-09-25 19:22:00
5l    2020-09-25 19:23:00
5pl   2020-09-25 19:24:00
5rl   2020-09-25 19:25:00

Create/migrate version 5 instances

You should now be able to create version 5 instances:

sim add mynewinstance 5

Optionally you can switch your existing 4.0 instances to version 5 with:

sql "update instances set version='5' where <condition>"
sql "update instances set version='5l' where <condition>"
sql "update instances set version='5p' where <condition>"
sql "update instances set version='5pl' where <condition>"
sql "update instances set version='5r' where <condition>"
sql "update instances set version='5rl' where <condition>"

Where <condition> can be version='4.0[prl] or name in ('myoldinstance1', 'myoldinstance1', ...), etc.

Then force an upgrade on all switched instances:

for i in `sim ls 5 | awk '{print $1}`; do echo sim up $i; done

Note that switching from version 4.0 to version 5 is irreversible.

Version 5 versioning pattern

Version 5 introduces a new versioning pattern: 5.x.y