Update a LimeSurvey instance using packages from the official website.
- Downloads application builds directly from the LimeSurvey website
- Follows the upgrade instructions in the LimeSurvey Manual, including differences between versions 3-6
- Supports all branches: Unstable (master), Development (previous master), and Stable (LTS)
- I am aware this is a bit weird, but it allows for the naming convention to remain unchanged from their previous one
- Performs backups of the database and application files
- Stops and starts the web server, with support for various init systems:
systemdinit.d/OpenRCrc.dUpstart/FinitEpoch- generic (
service)
- Load and verify
config.json, configure the logger - Parse the release page, download the selected version
- Stop the web server using the init system
- Dump the database and zip up the existing install as a backup
- Install the new application files, restore user data files, apply permissions
- Start the service for the web server back up using the init system
- LimeSurvey 3+ running on GNU/Linux (tested on Ubuntu 20.04)
- Web server software managed with one of the supported init systems, such as
systemdorinit.d - Standard single-node LimeSurvey installation without custom modifications to the core files
- Python 3.6+ with
bs4(BeautifulSoup),requests, andwgetpackages available mysqldumpavailable in thePATH, typically installed with themysql-clientormariadb-clientpackages- Root or sudo access to execute (note: the above Python packages and
mysqldumpneed to be available as root) - Database in MariaDB or MySQL with a
.my.cnffile prepared with credentials (seeconfig.jsondetails below) - Configured
config.jsonalongside the script
Take a look at default-config.json, which assumes systemd & nginx.
"branch": select the update branch. Supported values:"unstable"(version 6+, i.e.latest-master)"dev"(version 5+, i.e.latest-{d})"lts"(version 3, i.e.latest-3.x-LTS)
"db_cnf_path": path to a.my.cnffile with database credentials able to usemysqldump"db_name": name of the LimeSurvey database in MySQL/MariaDB"db_port": port of the database server"db_server": hostname or IP address of the database server"install_octal_permissions": 755-style permissions applied to the newly-installed application files"install_owner": Formatted like"username:group", the owner of the newly-installed application files"install_path": path to the application files on the disk"log_to_file": print the output of the script to logs/ls_updater.log"log_to_stdout": print the output of the script to the console"log_to_syslog": print the output of the script to local syslog"web_server_init_system": select the init system used to restart the web server service. Supported values:"generic""systemd""service""init.d""openrc""rc.d""upstart""finit""epoch"
"web_server_service": init/service name of the web server. Typically set to"apache2"or"nginx".
- Prepare system to ensure the dependencies are met. For example, on Ubuntu 20.04:
sudo apt install python3-pip mariadb-clientsudo python3 -m pip install -r requirements.txt
git pull https://github.com/xenago/ls_updatercd ls_updaternano .my.cnf(only required if you don't already have one elsewhere - if you do, add its path toconfig.json)- Copy default config and edit to include all necessary information (see above for
config.jsondetails)cp default-config.json config.jsonnano config.json
sudo python3 ls_updater.py- In the browser, login as admin to verify that no database upgrade is required. If one is needed, it may prompt one when logging into the web interface.
- It is also possible to check
<base url>/index.php?r=admin/databaseupdate/sa/db- if an error appears when loading that URL, then no upgrade is required
- It is also possible to check
