Skip to content

Instantly share code, notes, and snippets.

@jedahan
Last active December 10, 2015 18:58
Show Gist options
  • Select an option

  • Save jedahan/4478062 to your computer and use it in GitHub Desktop.

Select an option

Save jedahan/4478062 to your computer and use it in GitHub Desktop.

device_dashboard

An app for controlling in-gallery kiosks

What it does

Shows which machines in the galleries are pingable and still running their intended applications. Also helps run remote commands for rebooting, updating, etc.

Architecture

config.php

which contains multiple types of arrays that handle

  1. Machine Information ($machines, $amWingLabelMachines, any $[a-Z]Machines) Each machine in the list contains name, ip, label, script name?, location of bat scripts to put in 'under construction', and production
  2. Machine Groups ($app_machines) This maps each machine array name to its array ("AmWingLabel" => $amWingLabelMachines) I don't really know why
  3. Command Information ($apps) This takes the machine array name labels from 2, mapping 'apps' to a command Apps are things like reboot,shutdown,remote_action_validation_dir,... So apps might not actually be apps, they might be directories If they are apps, they are the path to a batch script These apps have a bespoke template language, for example: "remote_action_dir" => 'D:\wamp\www\drupal_data_delivery\screenActions{app.scriptname}'
  4. Command Labels ($app_actions) This labels what each action does, for UI purposes. Similar to machine groups but 1:1 mapping?
  5. Permissions Control $departments array, which ties machine arrays together by department $user_roles array, listing what actions each user is allowed to see $user_machines array, listing what machines each user can see $user_apps array, listing what machines each user can see. this is not a typo.
Also the config file connects to our ldap directly. So it is not only included in other php files but must be executed for stuff to work.

generate_bat_files.php

This is a script that generates the bat files that are listed in config.php Though, it needs config.php to generate the bat files. Its a circular dependency, and most of the bats use that templating code.

cron.php

This is called via a windows scheduled task, to call the scripts generated by the batch file generator, as specified by the config file.

This is where each machine's heartbeat file is copied to a local directory.

Every new applicationtype requires adding another scheduled task calling `php cron.php -a="applicationTypeName" > applicationTypeName.txt`

heartbeat_servers/

In here are custom.php scripts that create heartbeat files that the entire system expects for machines (mostly iOS devices) that have no concept of a filesystem. They can http GET/POST/WHATEVER and it will create a local heartbeat file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment