config-check.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <?php
  2. /*
  3. * We only get here after setup, or if there's an error in the configuration.
  4. *
  5. * Display a table to the user showing the necessary dependencies
  6. * (both PHP and binary) and the status of any application services,
  7. * along with steps to fix them if they're not found or misconfigured.
  8. */
  9. $phpDependencies = checkPhpDependencies();
  10. $externalServices = checkExternalServices();
  11. $zend = $phpDependencies["zend"];
  12. $postgres = $phpDependencies["postgres"];
  13. $database = $externalServices["database"];
  14. $rabbitmq = $externalServices["rabbitmq"];
  15. $pypo = $externalServices["pypo"];
  16. $liquidsoap = $externalServices["liquidsoap"];
  17. $mediamonitor = $externalServices["media-monitor"];
  18. $r1 = array_reduce($phpDependencies, "booleanReduce", true);
  19. $r2 = array_reduce($externalServices, "booleanReduce", true);
  20. $result = $r1 && $r2;
  21. ?>
  22. <html>
  23. <head>
  24. <link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css">
  25. <link rel="stylesheet" type="text/css" href="css/setup/config-check.css">
  26. </head>
  27. <style>
  28. /*
  29. This is here because we're using the config-check css for
  30. both this page and the system status page
  31. */
  32. html {
  33. background-color: #f5f5f5;
  34. }
  35. body {
  36. padding: 2em;
  37. min-width: 600px;
  38. text-align: center;
  39. margin: 3em ;
  40. border: 1px solid lightgray;
  41. border-radius: 5px;
  42. }
  43. </style>
  44. <body>
  45. <h2>
  46. <img class="logo" src="css/images/airtime_logo_jp.png" /><br/>
  47. <strong>Configuration Checklist</strong>
  48. </h2>
  49. <?php
  50. if (!$result) {
  51. ?>
  52. <br/>
  53. <h3 class="error">Looks like something went wrong!</h3>
  54. <p>
  55. Take a look at the checklist below for possible solutions. If you're tried the suggestions and are
  56. still experiencing issues, come
  57. <a href="https://forum.sourcefabric.org/">visit our forums</a>
  58. or <a href="http://www.sourcefabric.org/en/airtime/manuals/">check out the manual</a>.
  59. </p>
  60. <?php
  61. } else {
  62. ?>
  63. <p>
  64. Your Airtime station is up and running! Get started by logging in with the default username and password: admin/admin
  65. </p>
  66. <button onclick="location = location.pathname;">Log in to Airtime!</button>
  67. <?php
  68. }
  69. ?>
  70. <table class="table">
  71. <thead>
  72. <tr>
  73. <th class="component">
  74. Component
  75. </th>
  76. <th class="description">
  77. <strong>Description</strong>
  78. </th>
  79. <th class="solution">
  80. <strong>Status or Solution</strong>
  81. </th>
  82. </tr>
  83. </thead>
  84. </table>
  85. <div class="checklist">
  86. <table class="table table-striped">
  87. <caption class="caption">
  88. PHP Dependencies
  89. </caption>
  90. <tbody>
  91. <tr class="<?=$zend ? 'success' : 'danger';?>">
  92. <td class="component">
  93. Zend
  94. </td>
  95. <td class="description">
  96. Zend MVC Framework
  97. </td>
  98. <td class="solution <?php if ($zend) {echo 'check';?>">
  99. <?php
  100. } else {
  101. ?>">
  102. <b>Ubuntu</b>: try running <code>sudo apt-get install libzend-framework-php</code>
  103. <br/><b>Debian</b>: try running <code>sudo apt-get install zendframework</code>
  104. <?php
  105. }
  106. ?>
  107. </td>
  108. </tr>
  109. <tr class="<?=$postgres ? 'success' : 'danger';?>">
  110. <td class="component">
  111. Postgres
  112. </td>
  113. <td class="description">
  114. PDO and PostgreSQL libraries
  115. </td>
  116. <td class="solution <?php if ($postgres) {echo 'check';?>">
  117. <?php
  118. } else {
  119. ?>">
  120. Try running <code>sudo apt-get install php5-pgsql</code>
  121. <?php
  122. }
  123. ?>
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. <table class="table table-striped">
  129. <caption class="caption">
  130. External Services
  131. </caption>
  132. <tbody>
  133. <tr class="<?=$database ? 'success' : 'danger';?>">
  134. <td class="component">
  135. Database
  136. </td>
  137. <td class="description">
  138. Database configuration for Airtime
  139. </td>
  140. <td class="solution <?php if ($database) {echo 'check';?>">
  141. <?php
  142. } else {
  143. ?>">
  144. Make sure you aren't missing any of the Postgres dependencies in the table above.
  145. If your dependencies check out, make sure your database configuration settings in
  146. <code>/etc/airtime.conf</code> are correct and the Airtime database was installed correctly.
  147. <?php
  148. }
  149. ?>
  150. </td>
  151. </tr>
  152. <tr class="<?=$rabbitmq ? 'success' : 'danger';?>">
  153. <td class="component">
  154. RabbitMQ
  155. </td>
  156. <td class="description">
  157. RabbitMQ configuration for Airtime
  158. </td>
  159. <td class="solution <?php if ($rabbitmq) {echo 'check';?>">
  160. <?php
  161. } else {
  162. ?>">
  163. Make sure RabbitMQ is installed correctly, and that your settings in /etc/airtime/airtime.conf
  164. are correct. Try using <code>sudo rabbitmqctl list_users</code> and <code>sudo rabbitmqctl list_vhosts</code>
  165. to see if the airtime user (or your custom RabbitMQ user) exists, then checking that
  166. <code>sudo rabbitmqctl list_exchanges</code> contains entries for airtime-media-monitor, airtime-pypo,
  167. and airtime-uploads.
  168. <?php
  169. }
  170. ?>
  171. </td>
  172. </tr>
  173. <tr class="<?=$mediamonitor ? 'success' : 'danger';?>">
  174. <td class="component">
  175. Media Monitor
  176. </td>
  177. <td class="description">
  178. Airtime media-monitor service
  179. </td>
  180. <td class="solution <?php if ($mediamonitor) {echo 'check';?>">
  181. <?php
  182. } else {
  183. ?>">
  184. Check that the airtime-media-monitor service is installed correctly in <code>/etc/init</code>,
  185. and ensure that it's running with
  186. <br/><code>initctl list | grep airtime-media-monitor</code><br/>
  187. If not, try running <code>sudo service airtime-media-monitor start</code>
  188. <?php
  189. }
  190. ?>
  191. </td>
  192. </tr>
  193. <tr class="<?=$pypo ? 'success' : 'danger';?>">
  194. <td class="component">
  195. Pypo
  196. </td>
  197. <td class="description">
  198. Airtime playout service
  199. </td>
  200. <td class="solution <?php if ($pypo) {echo 'check';?>">
  201. <?php
  202. } else {
  203. ?>">
  204. Check that the airtime-playout service is installed correctly in <code>/etc/init</code>,
  205. and ensure that it's running with
  206. <br/><code>initctl list | grep airtime-playout</code><br/>
  207. If not, try running <code>sudo service airtime-playout restart</code>
  208. <?php
  209. }
  210. ?>
  211. </td>
  212. </tr>
  213. <tr class="<?=$liquidsoap ? 'success' : 'danger';?>">
  214. <td class="component">
  215. Liquidsoap
  216. </td>
  217. <td class="description">
  218. Airtime liquidsoap service
  219. </td>
  220. <td class="solution <?php if ($liquidsoap) {echo 'check';?>">
  221. <?php
  222. } else {
  223. ?>">
  224. Check that the airtime-liquidsoap service is installed correctly in <code>/etc/init</code>,
  225. and ensure that it's running with
  226. <br/><code>initctl list | grep airtime-liquidsoap</code><br/>
  227. If not, try running <code>sudo service airtime-liquidsoap restart</code>
  228. <?php
  229. }
  230. ?>
  231. </td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. </div>
  236. <div class="footer">
  237. <h3>
  238. PHP Extension List
  239. </h3>
  240. <p>
  241. <?php
  242. global $extensions;
  243. $first = true;
  244. foreach ($extensions as $ext) {
  245. if (!$first) {
  246. echo " | ";
  247. } else {
  248. $first = false;
  249. }
  250. echo $ext;
  251. }
  252. ?>
  253. </p>
  254. </div>