Add versions 6.x to an existing SIM server
This document explains how to add versions 6.x to an existing SIM server.
Install versions 6.x
Login as user simplicite
.
Clone the version 6 template Git repository:
cd /var/simplicite/git
git clone --bare https://_your_Git_username_:_your_Git_password_@platform.git.simplicite.io/template-6.git
Warning: make sure to change
_your_Git_username_
and_your_Git_password_
by your own Git credentials
Create the version 6.x (current and maintained) minor versions in the SIM database (note: version 6.0 is now outdated, thus not mentioned here any longer):
sql "insert into versions values ('6.1', '1970-01-01 00:00:00')"
sql "insert into versions values ('6.2', '1970-01-01 00:00:00')"
And optionally their "light" variants:
sql "insert into versions values ('6.1l', '1970-01-01 00:00:00')"
sql "insert into versions values ('6.2l', '1970-01-01 00:00:00')"
Add the post receive hook for the template:
vi template-6.git/hooks/post-receive
With the following content:
#!/bin/bash
for branch in 6.1 6.2
# or for branch in 6.1 6.1-light 6.2 6.2-light
do
version=$branch
[ $branch = '6.1-light' -o $branch = '6.2-light' ] && version=${version}l
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-6.git checkout -f $branch
if [ $? = 0 ]
then
chmod +x /var/simplicite/template-$version/tools/*.sh
date=`git --git-dir=/var/simplicite/git/template-6.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"
else
echo "${branch} not (yet) available in /var/simplicite/git/template-6.git"
fi
done
Note: in the above steps you may not require all variants of version 6, adapt the commands/scripts accordingly
Make it executable:
chmod +x template-6.git/hooks/post-receive
Execute it:
./template-6.git/hooks/post-receive
Edit the post receive hook for the instance manager:
vi apps.git/hooks/post-receive
with the following content (keep the previous versions' parts if needed):
#!/bin/bash
echo "Updating instances manager..."
sudo su simplicite -c "git --work-tree=/var/simplicite/apps --git-dir=/var/simplicite/git/apps.git checkout -f master"
for branch in 6.1 6.2
# or for v in 6.1 6.1-light 6.2 6.2-light
do
version=$branch
[ $branch = '6.1-light' -o $branch = '6.2-light' ] && version=${version}l
cat /var/simplicite/apps/bin/version-6.sh | sed "s/template-6/template-$version/g" > /var/simplicite/apps/bin/version-$version.sh
done
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"
Make it executable:
chmod +x apps.git/hooks/post-receive
Execute it:
./apps.git/hooks/post-receive
Verify installation
At that stage you should have the version 6 templates available in the /var/simplicite/template-6*
folders.
And a call to sim versions
should display version 6 templates with their latest revision dates, e.g.:
> sim versions
(...)
6.1 2025-03-28 15:54:10
6.2 2025-03-28 16:15:22
(...)
Create new version 6 instances
You should now be able to create version 6 instances, e.g.:
sim add <new instance name> 6.2
Upgrade existing version 5 instances
Optionally you can switch your existing 5 instances to version 6, e.g.:
sim setversion <instance name> 6.2
or for more selective/specific cases:
sql "update instances set version='6.2' where <condition>"
where <condition>
can be, for instance, name like 'myoldinstance%'
, etc.
Then force an upgrade on all switched instances:
for i in `sim ls 5 | awk '{print $1}`; do echo sim up $i; done
Warning: note that :
- switching from version 5 to any version 6.x is irreversible
- switching from version 5 to any version 6.x is impossible if the version 5 is not up-to date on the latest version 5 revision