Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeffrafter/5264 to your computer and use it in GitHub Desktop.
Save jeffrafter/5264 to your computer and use it in GitHub Desktop.
Install Zephyr

How I got Zephyr to work on Sapele and the Touchscreen

on your local, download the zephyr zip

unzip < zephyr zip > rsync --progress --partial --recursive zephyr deploy@sapele:/tmp ssh deploy@sapele

on sapele

cd /tmp sudo mv zephyr /var/www cd /var/www/zephyr sudo chmod +x bin/*.sh

if tomcat is running already, shutdown (you may want to adjust the /etc/init.d/tomcat6 script)

sudo /usr/share/tomcat6/bin/shutdown.sh

Survive reboot

sudo touch /etc/init.d/zephyr sudo nano /etc/init.d/zephyr

Make the zephyr file have this line (a full daemon controller would be nicer...)

cd /var/www/zephyr/bin && sudo startup.sh

Enable and setup the update.rc

sudo chmod +x /etc/init.d/zephyr sudo /usr/sbin/update-rc.d -f zephyr defaults

Reboot

sudo reboot

At this point you should be able to hit the tomcat instance from the localhost

lynx localhost:8088/zephyr/home.do --dump

Modify the nginx proxy configuration /etc/nginx/nginx.conf (to look like this:)

user www; worker_processes 3;

error_log /var/log/nginx/error.log; pid /var/run/nginx.pid;

events { worker_connections 1024; }

http { include /etc/nginx/mime.types; default_type application/octect-stream;

log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log;

server_names_hash_bucket_size 64; sendfile on; tcp_nopush on; tcp_nodelay on; # could be off? keepalive_timeout 65;

gzip on; gzip_http_version 1.0; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application.xml application/xml+rss text/javascript;

upstream bart { server 127.0.0.1:8000; server 127.0.0.1:8001; server 127.0.0.1:8002; }

upstream zephyr { server 127.0.0.1:8088; }

BART

server { listen 80; # 8080 if behind pound access_log /var/log/nginx/bart.access.log main;

root /var/www/bart/current/public;
index index.html;

client_max_body_size 10M;

location / {
  proxy_set_header X-Real-IP  $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_redirect off;
  proxy_max_temp_file_size 0;

  if (-f $request_filename) {
    break;
  }

  if (-f $request_filename/index.html) {
    rewrite (.*) $1/index.html break;
  }

  if (-f $request_filename.html) {
    rewrite (.*) $1.html break;
  }

  if (!-f $request_filename) {
    proxy_pass http://bart;
    break;
  }      
  
}

location /zephyr {
  proxy_set_header  X-Real-IP  $remote_addr;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_redirect off;
  proxy_pass http://zephyr;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
  root /var/www/bart/current/public;
}

} }

Notice that all requests going to /zephyr are proxied through to the tomcat instance, restart nginx

sudo /etc/init.d/nginx restart

At this point you should be able to access from a browser outside of sapele

http://sapele/zephyr

Now you need to make the touchscreen open the zephyr page by default instead

sudo su firefox cd ~/default.profile

Change the browser.startup.homepage in the prefs.js file

user_pref("browser.startup.homepage", "http://localhost/zephyr");

Restart the touchscreen and the login page should show

User: zepadmin Password: zepadmin11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment