Translations of this page:
 

Moving SoSci Survey

This manual is intended for operators of a local instance (installation) of SoSci Survey. The manual describes how to move an installation of SoSci Survey with all survey projects from one server to another server.

Note: This is not about moving a single survey project, for this see Copying or Moving a Survey Project

An instance of SoSci Survey consists of the following components:

  • File system
    • Program files of SoSci Survey
    • Configuration
    • Survey projects (directories and uploads)
    • Collected files
    • Write cache
    • Read cache (shall not be copied)
  • Database

To move to another server, proceed as follows.

  1. Prepare the new server.
    1. The processes for the web server should work and the configuration for Apache, nginx, IIS, or the like should be completed.
    2. Create a file test.html with any content in the root directory for SoSci Survey, and test whether this file can be accessed in the browser via HTTPS using the new URL with the suffix /test.html (for example https://www.example-new-server.com/test.html)
    3. The database system should be set up, and a database for SoSci Survey incl. the corresponding database user should be prepared, but without tables yet.
    4. If SoSci Survey sends emails directly via the server (sendmail), this should be configured correctly as well. Sending via SMTP is usually easier to maintain.
  2. A separate user on the old server (transfer in the example) facilitates the transfer of the files.
  3. Lock the instance of SoSci Survey on the old server, so that questionnaires can neither be changed nor filled out during the move.
    1. Server Management → Server Maintenance → Locking Server
    2. The cache is cleared automatically when the server is locked.
  4. Copy the directory of SoSci Survey to the new server, preferably by means of rsync and scp, alternatively pack it as .tar.gz and copy this file via SFTP.
    1. Tip: To minimize the downtime, you can also run the synchronization before locking the server, and once again afterwards. On the second run, rsync only copies the changed data.
    2. Below you will find a code example with rsync for a specifically created Linux user transfer
  5. Transfer the database (for example code see below)
    1. Create a database dump
    2. Copy the database dump to the new server, for example by means of scp
    3. Load the dump into the new database
  6. Adjust the URL in the configuration
    1. From the installation package (ZIP file), copy the file admin/install.php into the new installation directory of SoSci Survey, into the subdirectory admin/ (this file was deleted automatically after the last update).
    2. In the web browser, open the URL under which SoSci Survey is accessible on the new server, followed by /admin/install.php (for example https://www.example-new-server.com/admin/install.php).
    3. Check the box that the license and the URL shall be reset, and log in with the administrator account.
    4. Alternatively, you can delete the line $GLOBALS['oFb']['licence data'] = … from the file system/config.php.
  7. Once the installation routine (admin/install.php) has completed successfully, the maintenance mode (Locking Server) is ended automatically.

Please note that the following code is only an example. For use on your own server, both the paths and the names of users and/or groups must be adjusted.

# Temporarily adjust the permissions for protected directories
# (on the old server)
sudo chmod -R 750 /var/www/soscisurvey/files/protected
sudo chmod -R 750 /var/www/soscisurvey/system/keyring
 
# Synchronize the file system without cache and sessions
# (on the new server)
sudo rsync -av -e ssh --delete --exclude=/system/session/ --exclude=/system/cache/ --exclude=/view transfer@192.0.2.123:/var/www/soscisurvey/ /var/www/soscisurvey/
sudo rsync -av -e ssh --delete transfer@192.0.2.123:/var/www/sosci-log/ /var/www/sosci-log/
 
# Create the database dump
# (on the old server)
sudo mysqldump -usosci -p --databases soscisurvey --quick --single-transaction | gzip -9 > /home/transfer/transfer-database.sql.gz
 
# Copy the dump to the new server and import it
# (on the new server)
scp -i ~/.ssh/id_ecdsa transfer@192.0.2.123:/home/transfer/transfer* /home/transfer
gunzip -c /home/transfer/transfer-database.sql.gz | mysql -u sosci -p soscisurvey
 
# The project directories must be owned by www-data, so that PHP can write there
# (on the new server)
sudo chown -R www-data:www-data /var/www/soscisurvey
 
# Some directories are assigned exclusively to www-data
# (on the new server)
sudo chown -R www-data:www-data /var/www/soscisurvey/system/keyring
sudo chown -R www-data:www-data /var/www/soscisurvey/files
sudo chown -R www-data:www-data /var/www/soscisurvey/system
 
# FTP is the owner of the libraries, but the entire www-data group has read access
# (on the new server)
sudo chown -R www-ftp:www-data /var/www/soscisurvey/admin
sudo chown -R www-ftp:www-data /var/www/soscisurvey/inc
sudo chown -R www-ftp:www-data /var/www/soscisurvey/lib
sudo chown -R www-ftp:www-data /var/www/soscisurvey/images
sudo chown -R www-ftp:www-data /var/www/soscisurvey/internal
sudo chown -R www-ftp:www-data /var/www/soscisurvey/layout
sudo chown -R www-ftp:www-data /var/www/soscisurvey/modules
sudo chown -R www-ftp:www-data /var/www/soscisurvey/plugins
sudo chown -R www-ftp:www-data /var/www/soscisurvey/script
sudo chown -R www-ftp:www-data /var/www/soscisurvey/templates
 
# Set the permissions again
# (on the new server)
sudo chmod -R u-x+rwX,g-xw+rX,o-rwx /var/www/soscisurvey
sudo chmod 770 /var/www/soscisurvey
sudo chmod -R u-x+rwX,go-rwx /var/www/soscisurvey/files/protected
sudo chmod -R u-x+rwX,go-rwx /var/www/soscisurvey/system/keyring
en/server/move.txt · Last modified: by 127.0.0.1
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki