upgrade.rst 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. **********
  2. Upgrade
  3. **********
  4. If you are looking to upgrade your current `version of FusionPBX to the next release version click here <http://docs.fusionpbx.com/en/latest/advanced/version_upgrade.html>`_.
  5. The FusionPBX code is constantly evolving.
  6. * Bug fixes being submitted
  7. * Additions to improve security
  8. * Making FusionPBX look nicer
  9. * More flexible
  10. * More scalable
  11. * New features
  12. A complete summary of the changes can be found on the github code page https://github.com/fusionpbx/fusionpbx/commits/master.
  13. Go to the menu then click on Advanced and then Upgrade. This tool allows you to update the source code, update the database structure, restore the default menu and permissions. `Click here for the Youtube video <https://youtu.be/QUB3u9pZ7ks>`_.
  14. .. raw:: html
  15. <div style="text-align: center; margin-bottom: 2em;">
  16. <iframe width="100%" height="350" src="https://www.youtube.com/embed/QUB3u9pZ7ks?rel=0" frameborder="0" ; encrypted-media" allowfullscreen></iframe>
  17. </div>
  18. .. image:: ../_static/images/fusionpbx_upgrade.jpg
  19. :scale: 85%
  20. |
  21. | **Update the source from command line**
  22. ::
  23. cd /var/www/fusionpbx
  24. git pull
  25. chown -R www-data:www-data
  26. | **Back to the GUI**
  27. ::
  28. *Upgrade Database with advanced -> upgrade schema
  29. *Update permissions
  30. *Update the menu
  31. *Logout and back in
  32. How to Upgrade
  33. ##############
  34. .. image:: ../_static/images/fusionpbx_upgrade_green.jpg
  35. :scale: 100%
  36. |
  37. | To upgrade you will need to get the latest source code. Depending on how extreme the changes have been or the version you currently are on since your last update, you may need to follow version specific upgrade instructions to bring your install up to date.
  38. **Step 1: Update FusionPBX Source**
  39. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  40. | 1. GUI -> Advanced -> Upgrade (doesn't update all files)
  41. Used to update FusionPBX to the latest release.
  42. **Upgrade the code via Github/GIT**
  43. | Login into the web interface with a user account assigned to the superadmin group.
  44. | Login to the console with either the ssh, the locally.
  45. | Backup It's a good idea to make a backup. If using sqlite, your backup will easily include the SQL database.
  46. ::
  47. mkdir /etc/fusionpbx
  48. mv /var/www/fusionpbx/resources/config.php /etc/fusionpbx
  49. mv /usr/local/freeswitch/scripts/resources/config.lua /etc/fusionpbx
  50. cd /var/www
  51. cp -R fusionpbx fusionpbx_backup
  52. # Change the directory to the FusionPBX directory
  53. cd /var/www/fusionpbx
  54. **Update the source code** (example assumes fusionpbx is in /var/www/fusionpbx)
  55. ::
  56. cd /var/www/fusionpbx
  57. git pull
  58. | **Permissions**
  59. | Reset the permissions on the fusionpbx directory tree. When you do **git pull** it sets the permissions on any updated files to match the account that you are running **git pull** with. If that account is different to the web server account it will result in some files no longer being accessible and a red bar error at the top of the upgrade screen on the GUI. To fix this you should reapply the permissions in fusionpbx and recursively in all directories inside it.
  60. |
  61. | The example assumes the web server runs as user 'www-data' and fusionpbx is installed to /var/www/fusionpbx. (chown -Rv Ownername:GroupName /var/www/fusionpbx)
  62. ::
  63. cd /var/www/fusionpbx
  64. chown -R www-data:www-data *
  65. **Step 2: Update Freeswitch Scripts**
  66. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  67. | NOTE: As of FusionPBX 3.8.3 (Stable Branch), the scripts should be automatically updated when updating the Source Code, using the **Advanced > Upgrade** page. Any customized scripts, having the same name as the default scripts, **will be overwritten.** (An option to disable this default behavior is available using **Default Setting: switch > scripts_update > false**) Missing scripts will be restored, and any additional files within the scripts folder will remain untouched.
  68. | FusionPBX is a fast moving project where features are constantly being added and bugs are being fixed on a daily basis so I would also suggest upgrading the Freeswitch scripts directory as part of any normal upgrade process.
  69. **Update Freeswitch**
  70. | Use github to get the updated files. **You have to do this from an empty directory**.
  71. **Note:** Older versions of FusionPBX may use the `/usr/local` path instead of `/usr/share`
  72. ::
  73. cp -R /usr/share/freeswitch/scripts /usr/share/freeswitch/scripts-bak
  74. rm -Rf /usr/share/freeswitch/scripts/
  75. cd /usr/src
  76. git clone https://github.com/fusionpbx/fusionpbx.git
  77. cp -R /usr/src/fusionpbx/app/switch/resources/scripts/ /usr/share/freeswitch
  78. chown -R www-data:www-data /usr/share/freeswitch/scripts
  79. # (The last step above is not required if your config.lua file is being stored in a different location, such as the /etc/fusionpbx folder.)
  80. cp -R /usr/share/freeswitch/scripts-bak/resources/functions/config.lua /usr/share/freeswitch/scripts/resources/functions/config.lua
  81. | **Clean out this scripts directory**
  82. | An alternative is to remove the Lua scripts. **Only do this if you haven't customized any LUA scripts**
  83. ::
  84. cp -R /usr/share/freeswitch/scripts /usr/local/freeswitch/scripts-bak
  85. rm -rf /usr/share/freeswitch/scripts/*
  86. | **Pull the most recent scripts down**
  87. | Here you need to go directly to step 3 and make sure you run upgrade schema from the GUI immediately otherwise your calls will not complete.
  88. | **Restore the config.lua file (IMPORTANT!!)**
  89. | If your config.lua file was located in scripts/resources/, then you'll need to restore it (from the backup previously performed) to scripts/resources/config.lua.
  90. **Step 3: Upgrade Schema**
  91. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  92. | Many updates have changes to the database and to the Freeswitch scripts. The upgrade_schema script
  93. | **Upgrade from the GUI**
  94. | From the GUI, run **Advanced -> Upgrade Schema** which will add any needed newer tables or columns.
  95. | Then run **App Defaults**. *If you removed the scripts on Step 2 then run this* **twice**.
  96. .. image:: ../_static/images/fusionpbx_upgrade_schema_data_types.jpg
  97. :scale: 85%
  98. |
  99. | **Upgrade from the Command Line**
  100. | An alternative to running upgrade_schema.php from the GUI is to run the upgrade.php from the command line. It was designed to make the upgrade easier. If you did not login when updating the FusionPBX source code then you will need to run the upgrade.php file from the command line. Make sure to use the full path to the PHP file.
  101. | As root run the following
  102. ::
  103. cd /var/www/fusionpbx
  104. /usr/bin/php /var/www/fusionpbx/core/upgrade/upgrade.php
  105. | If your screen was nicely formatted with a fusionpbx theme, and suddenly now goes to a black and white screen with familiar text but no theme, it is because you were using a theme which no longer exists in the latest version of the code. If this happens to you navigate to:
  106. ::
  107. http://domain_or_ip/mod/users/usersupdate.php
  108. | Then scroll down to where it says **"Template"** and select one of the valid templates from the drop down list. Then press Save. It will be fixed now and you can continue with the remaining steps below.
  109. | (Note that any users who have invalid templates selected will also have the same problem you did. You can fix them from the user manager option in the accounts menu)
  110. **Step 4: Apply permissions and Restart Freeswitch**
  111. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  112. | **Make sure that the freeswitch directory has the correct permissions**
  113. ::
  114. chown -Rv www-data:www-data /usr/local/freeswitch/
  115. | **Restart Freeswitch**
  116. ::
  117. systemctl restart freeswitch
  118. **Step 5: Menu**
  119. ^^^^^^^^^^^^^^^^^
  120. | Needed if your menu disappeared.
  121. | **v1 and v2**
  122. | Now update the menu to the latest version.
  123. ::
  124. http://domain_or_ip/core/menu/menu_restore_default.php
  125. | Press 'Restore Default' on the top right.
  126. | **v3**
  127. | https://your.ip/core/menu/menu.php
  128. | click 'e' next to the default menu
  129. | click the restore default button.
  130. | https://your.ip/logout.php
  131. | https://your.ip/login.php
  132. **Step 6: Re-generate Settings**
  133. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  134. | Sometimes variable names changes. In rev 1877 **v_config_cli.php** variable names changed which caused no fax to email emails or voicemail emails to be sent. Problem was the SMTP details did not exist.
  135. | Go to **Advanced -> Settings** and then **click save**. This will re-generate v_config_cli.php and any other needs config files.
  136. Move to a different Branch
  137. ###########################
  138. FusionPBX has a stable and a master(development) branch. You can switch from stable to master but **not recomended to downgrade.**
  139. **Move to the Stable Branch**
  140. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  141. ::
  142. mv /var/www/fusionpbx /var/www/fusionpbx-old
  143. cd /var/www && git clone -b 4.4 https://github.com/fusionpbx/fusionpbx.git
  144. chown -R www-data:www-data /var/www/fusionpbx
  145. Make sure config.php exists in /etc/fusionpbx If missing then move it into this directory.
  146. ::
  147. cp /var/www/fusionpbx-master/resources/config.php /etc/fusionpbx
  148. **Move to the Master Branch**
  149. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  150. ::
  151. mv /var/www/fusionpbx /var/www/fusionpbx-old
  152. cd /var/www && git clone https://github.com/fusionpbx/fusionpbx.git
  153. chown -R www-data:www-data /var/www/fusionpbx
  154. * Complete the normal upgrade process at Advanced -> Upgrade
  155. * If the menu disappears you have to upgrade schema then restore the default menu to get it back.