RADIUSdesk

This is an old revision of the document!


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

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/rd_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

Changing the naming convention on the rights

  • RADIUSdesk makes use of the advanced rights management available with CakPHP.
  • Between CakePHP v2 and CakePHP v3 some conventions changed and we have to update some entries in the rights that was defined.
  • In the past an Access Controller method called by a web page could look like this index_ap.
  • The new convention is indexAp.
  • The following table will indicate which methods were updated with the migration.
  • Go to Other → Rights Managment → Access Controll Objects → Access Providers → Controllers and check that your system has the following changes:
Controller CakePHP v2 Value CakePHP v3 Value
Ssids index_ap indexAp
AccessProviders change_password changePassword
AccessProviders export_csv exportCsv
AccessProviders note_index noteIndex
AccessProviders note_add noteAdd
AccessProviders note_del noteDel
AccessProviders enable_disable enableDisable
Tags export_csv exportCsv
Tags index_for_filter indexForFilter
Tags note_index noteIndex
Tags note_add noteAdd
Tags note_del noteDel
Ssids index_ap indexAp
Realms export_csv exportCsv
Realms index_for_filter indexForFilter
Realms note_index noteIndex
Realms note_add noteAdd
Realms note_del noteDel
Realms index_ap indexAp
Realms update_na_realm updateNaRealm
DynamicDetails upload_logo uploadLogo
DynamicDetails index_photo indexPhoto
DynamicDetails upload_photo uploadPhoto
DynamicDetails delete_photo deletePhoto
DynamicDetails edit_photo editPhoto
DynamicDetails index_page indexPage
DynamicDetails add_page addPage
DynamicDetails edit_page editPage
DynamicDetails delete_page deletePage
DynamicDetails index_pair indexPair
DynamicDetails add_pair addPair
DynamicDetails edit_pair editPair
DynamicDetails delete_pair deletePair
DynamicDetails note_index noteIndex
DynamicDetails note_add noteAdd
DynamicDetails note_del noteDelr
DynamicDetails edit_settings editSettings
DynamicDetails view_social_login viewSocialLogin
DynamicDetails edit_social_login editSocialLogin
DynamicDetails NEW shufflePhoto
Profiles index_ap indexAp
Profiles manage_components manageComponents
Profiles note_index noteIndex
Profiles note_add noteAdd
Profiles note_del noteDel
Profiles index_for_filter DELETE
Profiles export_csv DELETE
  • Be sure to also allow new additions under Access Provider Rights

Be sure to check this table out upon each SVN update since it will grow as we migrate more and more controllers from CakePHP v2 to CakePHP v3.

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

Patching the database

  • Here we'll list the sql patches to run against the database.
#You can run this multiple times they are non-destructive
#Rename the key column to avoid clashing with SQL reserved words
sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd_rename_key_column.sql 
#Add feature to enable / disable photos
sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd_photo_add_active_column.sql
#Some more enhancements
sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd_photo_more_enhancements.sql
#Some DNS Enhancements
sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/captive_portal_dns.sql
#Adjust ACOs rights
sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/correct_realm_acos.sql
Please Take Note