Add versions 7.x to an existing SIM server
This document explains how to add versions 7.x to an existing SIM server.
Install Tomcat version 11
Simplicité major version 7 uses Tomcat 11 (vs Tomcat 9 for previous major versions), a new branch is thus present on the Tomcat Git repository.
Update the post receive hook for the Tomcat repository:
vi tomcat.git/hooks/post-receive
With the following content:
#!/bin/bash
for branch in master tomcat11
do
[ $branch = master ] && dir=tomcat || dir=$branch
echo "Updating tomcat template..."
[ ! -d /var/simplicite/$dir ] && mkdir /var/simplicite/$dir
git --work-tree=/var/simplicite/$dir --git-dir=/var/simplicite/git/tomcat.git checkout -f $branch
rm -f /var/simplicite/$dir/.gitignore /var/simplicite/$dir/.project /var/simplicite/$dir/README.md
chmod +x /var/simplicite/$dir/bin/*.sh
echo "Done"
done
Execute it:
./tomcat.git/hooks/post-receive
Install versions 7.x
Login as user simplicite
.
Clone the version 7 template Git repository:
cd /var/simplicite/git
git clone --bare https://_your_Git_username_:_your_Git_password_@platform.git.simplicite.io/template-7.git
Warning: make sure to change
_your_Git_username_
and_your_Git_password_
by your own Git credentials
Create the version 7.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 ('7.0', '1970-01-01 00:00:00')"
And optionally their "light" variants:
sql "insert into versions values ('7.0l', '1970-01-01 00:00:00')"
Add the post receive hook for the template repository:
vi template-7.git/hooks/post-receive
With the following content:
#!/bin/bash
for branch in 7.0
# or for branch in 7.0 7.0-light
do
version=$branch
[ $branch = '7.0-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-7.git checkout -f $branch
if [ $? = 0 ]
then
chmod +x /var/simplicite/template-$version/tools/*.sh
date=`git --git-dir=/var/simplicite/git/template-7.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-7.git"
fi
done
Note: in the above steps you may not require all variants of version 7, adapt the commands/scripts accordingly
Make it executable:
chmod +x template-7.git/hooks/post-receive
Execute it:
./template-7.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 7.0
# or for v in 7.0 7.0-light
do
version=$branch
[ $branch = '7.0-light' ] && version=${version}l
cat /var/simplicite/apps/bin/version-7.sh | sed "s/template-7/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 Tomcat 11 available in the /var/simplicite/tomcat11
folder
and the version 7 templates in the /var/simplicite/template-7*
folders.
A call to sim versions
should display version 6 templates with their latest revision dates, e.g.:
> sim versions
(...)
7.0 2025-09-01 12:00:00
(...)
Create new version 7 instances
You should now be able to create version 7 instances, e.g.:
sim add <new instance name> 7.0
Upgrade existing version 6 instances
Optionally you can switch your existing 6 instances to version 7, e.g.:
sim setversion <instance name> 7.0
or for more selective/specific cases:
sql "update instances set version='7.0' 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 -v 6 | awk '{print $1}`; do echo sim up $i; done
Warning: note that :
- switching from version 6 to any version 7.x is irreversible
- switching from version 6 to any version 7.x is not possible if the version 6 is not up-to date on the latest version 6 revision
- switching from version 5 to any version 7.x is not allowed, switching first to version 6 is a prerequisite