Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
{{AdvancedUsers}}To accommodate those users who need the manual web app feature currently not available in Amahi 7, the following guidance is provided. This has been tested and no issues were noted. This is only a work around until the feature is implemented. Choose a name for your app. It should be short, lowercase, and do not use spaces. For example, <b>head_phones</b> or <b>headphones</b> are acceptable names. (remember to replace all occurrences of <u>appname</u> below with your desired name). <b>NOTE:</b> There is no guarantee this will work for you or not cause problems with your Amahi 7 install. Please proceed with caution as carelessness could render your HDA inoperable.MessageBox| == Create Manual Web App =backgroundcolor =As [[Open_Terminal_as_root#faa|root user]], perform the following steps:* Build directory structure<pre>mkdir -p /var/hda/web-apps/appnamemkdir -p /var/hda/web-apps/appname/htmlmkdir -p /var/hda/web-apps/appname/logschown -R apache:users /var/hda/web-apps/appnamechown -R apache:users /var/hda/web-apps/appname/htmltouch /var/hda/web-apps/appname/logs/access_logtouch /var/hda/web-apps/appname/logs/error_logchown -R /var/hda/web-apps/appname/logs/access_logchown -R /var/hda/web-apps/appname/logs/error_log</pre>* Create Apache configuration file (9999 can be changed to any number, but recommend keep it above 2000 to be safe)<pre>vi /etc/httpd/conf.d/9999-appname.conf</pre>::Insert the text below (remember to change all occurrences of appname accordingly and the domain name amahi.net to match yours if needed)<pre><VirtualHost *:80>  ServerName appname ServerAlias appname.amahi.net  DocumentRoot /var/hda/web-apps/appname/html  <Directory "/var/hda/web-apps/appname/html"> Options Indexes FollowSymLinks MultiViews AllowOverride AuthConfig Require all granted  </Directory>  ErrorLog /var/hda/web-apps/appname/logs/error_log CustomLog /var/hda/web-apps/appname/logs/access_log combined envimage =!dontlog </VirtualHost></pre>::Change permissions and restart Apache<pre>chown apache:users /etc/httpd/conf.d/9999-appname.confservice httpd restart</pre>* Update Amahi 7 database settings<br /><br />::The id field is set to 99 for this example. It can be any number not currently used by Amahi. Recommend you keep it at 99 or greater to be safe.<br /> ::Ensure you replace appname accordingly and the date can be changed providing you follow the formatWarning. If you changed the .conf file name, ensure it matches as well.<br /> ::To do a quick check, you can do the following for each table:<pre>echo "select max(id) from dns_aliases" png| mysql -uroot -phda hda_production</pre><pre>echo "select max(id) from webapps" heading =WARNING| mysql -uroot -phda hda_production</pre>::Once you have chosen the id number, execute the following<pre>echo "INSERT INTO `dns_aliases` (`id`, `name`, `address`) VALUES(99, 'appname', '')" | mysql -uroot -phda hda_production</pre><pre>echo "INSERT INTO `webapps` (`id`, `name`, `path`, `kind`, `aliases`, `fname`, `deletable`, `login_required`, `dns_alias_id`, `custom_options`, `created_at`, `updated_at`) VALUES(99, 'appname', '/var/hda/web-apps/appname', '', '', '9999-appname.conf', 0, 0, 99, NULL, '2013-11-17 12:00:00', '2013-11-17 12:00:00')" | mysql -uroot -phda hda_production</pre>* Create a test file<pre>vi /var/hda/web-apps/appname/html/index.html</pre>::Insert the text below<pre><!DOCTYPE html><html><body> <h1>Web App TEST Page</h1> <p>It works!</p> </body></html></pre>::Set the correct permissions on the file<pre>chown apache:users /var/hda/web-apps/appname/html/index.html</pre>* Test your new web app by entering <b><nowiki>http://appname</nowiki></b> in your browser. If all goes well, you should see the test page.<br /><br />::If you have problems, retrace your steps. Ensure you replaced all occurrences of appname accordingly and the id field in both tables match. == Delete Manual Web App =message =The process to remove a web app created using the procedure above is a little shorter as you might expect. The steps below will remove it completely from your Amahi 7 instance. <b>NOTE:</b> Please ensure you remove the correct files or you may break an existing web greater application. As [[Open_Terminal_as_root|root user]], perform the following stepshttps:* Remove the Apache configuration file<pre>rm -rf /etc/httpd/confwww.d/9999-appnameamahi.conf<org/pre>* Delete the web app directory<pre>rm -rf /var/hdaapps/web-apps/appname</pre>* Restart Apache<pre>service httpd restart</pre>* Update Amahi 7 database settings<br /><pre>echo "DELETE FROM `dns_aliases` where id=99" | mysql -uroot -phda hda_production</pre><pre>echo "DELETE FROM `webapps` id=99" | mysql -uroot -phda hda_production</pre><br /> ::Once complete, the web app should now be completely removedWeb App] provides this capability.}}
12,424

edits