OpenSprinkler › Forums › OpenSprinkler Mobile and Web App › UI Assets on MicroSD › Reply To: UI Assets on MicroSD
Peter
So mission accomplished and everything up-and-running as I had hoped. A few things tripped me up along the way – namely moving to Debian Jessie and the latest version of apache at the same time – so a few notes below in case others run into similar.
I chose to have the OSPi itself as the local UI server and installing apache was very simple using standard “$ sudo apt-get install apache2” via the command line. This did bring down a newer version of apache 2.4 that was a bit different to what I was familiar with.
After installing, I needed to enable mod_headers – an apache module that OpenSprinkler needs to support secure resource sharing between websites – as this appeared to be disabled by default. The command “$ a2enmod headers” will do this.
Another change in 2.4 is that .htaccess files are now ignored by default. I used these in the past to store website specific config and had placed the OpenSprinkler specific configuration in /var/www/.htaccess file. The preferred approach – thanks Dave for the steer – is to add the lines to the end of /etc/apache2/apache2.conf:
# Added following lines to support OpenSprinkler
Header set Access-Control-Allow-Origin "*"
AddEncoding x-gzip .cgz .jgz
AddType text/css cgz
AddType text/javascript jgz
Another small change with apache is that the web files now need to go into /var/www/html rather than just /var/www.
Initially, I thought I would use the latest web files from the OpenSprinkler App github. But it seems the github version doesn’t included app.cgz and app.jgz – at least I couldn’t find them – so I humbly went back and used the version of UI.zip referenced in the instructions provided by Ray and Samer!
For the final step, I think the instructions may have a typo, as I needed to browse to http://os_addr:8080/su rather than http://os_addr/su in order to replace the cloud UI address (https://ui.opensprinkler.com/js ) with the local UI server address (http://os_addr/js).
Now that the local website is running on port 80 and the firmware on port 8080, you need to be a bit careful as to which page you pull up as you have the choice of
– http://os_addr will take you to port 80 and directly to apache serving the OS App – useful if you want to manage multiple OS sites for example.
– http://os_addr:8080 will take you directly to the OS Firmware but now with a locally served UI.
All good.