RADIUSdesk

Update a RADIUSdesk install on Ubuntu 16.04

  • We assume you have an existing install on Ubuntu 16.04 which you want to update.

Be carefull when updating production systems since the RADIUSdesk code is under constant development very new bits of code might still have bugs which can break things.

Install the CakePHP v3 application

This is a once-off action and only needs to be done once if you are still running a CakePHP v2 based system

  • Make sure the following packages are installed:
sudo apt-get install php-cli php-gd php-curl php-xml php-mbstring php-intl
  • Check out the cake3 branch from trunk to /usr/share/nginx/html.
cd /usr/share/nginx/html/
sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/cake3 ./cake3
  • Change the following directories to be writable by www-data:
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/logs

Check the Nginx config

This is a once-off action and only needs to be done once if you are still running a CakePHP v2 based system.

  • Since we are running both CakePHP v2 and CakePHP v3 simultaneously, you will need to update the Nginx config.
  • Edit the /etc/nginx/sites-available/default file:
sudo vi /etc/nginx/sites-available/default
  • Look for the following bit and be sure the location line matches this:
location ~ ^/cake2/.+\.(jpg|jpeg|gif|png|ico|js|css)$ {
    rewrite ^/cake2/rd_cake/webroot/(.*)$ /cake2/rd_cake/webroot/$1 break;
    rewrite ^/cake2/rd_cake/(.*)$ /cake2/rd_cake/webroot/$1 break;
    access_log off;
    expires max;
    add_header Cache-Control public;
}  
  • Add the next bit for the CakePHP v3 application
location /cake3/rd_cake {
   rewrite ^/cake3/rd_cake(.+)$ /cake3/rd_cake/webroot$1 break;
   try_files $uri $uri/ /cake3/rd_cake/index.php$is_args$args;
}
  • Reload the Nginx web server
sudo systemctl reload nginx.service

Install The Improved Dynamic Login Pages

This is a once-off action and only needs to be done once if you are still running the older login pages that has a seperate page for mobile devices and desktop devices.

  • Check out the latest login pages from the SVN repository.
cd /usr/share/nginx/html
sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/login ./login

Update the code

  • Run the following commands to fetch the latest code
#CakePHP v2 Application
cd /usr/share/nginx/html/cake2/rd_cake
sudo svn update
#CakePHP v3 Application
cd /usr/share/nginx/html/cake3
sudo svn update
#Viever
cd /usr/share/nginx/html/rd
sudo svn update
#Login Pages
cd /usr/share/nginx/html/login
sudo svn update
 
#Confirm the rights
 
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/Locale
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/flags
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/nas
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/files/imagecache
 
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/logs
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/access_providers
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/files/imagecache

Applying the Database Patches

  • As the code evolve we sometimes create patches to the database. Run the following instructions to apply the latest patches.
  • These patches are non-destructive which means you can run them multiple times without harm done.
cd /usr/share/nginx/html/cake3/rd_cake/setup/db
sudo mysql -u root rd < correct_realm_acos.sql
sudo mysql -u root rd < rd_rename_key_column.sql
sudo mysql -u root rd < rd_photo_add_active_column.sql
sudo mysql -u root rd < rd_photo_more_enhancements.sql
sudo mysql -u root rd < top_up_improvements.sql
sudo mysql -u root rd < add_language_selection_to_dynamic_details.sql
sudo mysql -u root rd < captive_portal_dns.sql
sudo mysql -u root rd < byod_improvements.sql
sudo mysql -u root rd < rd_rename_key_column_2.sql
sudo mysql -u root rd < correct_users_and_groups_aros.sql

Copy the existing images

  • We need to move the existing images to a new location
  • This is typically a once off but will include more as more parts is migrated.
#realms
sudo cp /usr/share/nginx/html/cake2/rd_cake/webroot/img/realms/* /usr/share/nginx/html/cake3/rd_cake/webroot/img/realms/
#Dynamic Details
sudo cp /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_details/* /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_details/
#Dynamic Photos
sudo cp /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_photos/* /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_photos/
#Change the ownership
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_photos

Updating the rights system on the database

  • Since we are migrating from CakePHP v2 to CakePHP v3 some conventions on the rights system changed.
  • We developed a script which you can run to fix these conventions for you.
  • Again this script is non-destructive which means you can run it multiple times, especially after new code has been added from the SVN repository.
cd /usr/share/nginx/html/cake3/rd_cake
sudo ./bin/cake migrate_radiusdesk
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/logs
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/access_providers
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/files/imagecache
Please Take Note