A simple digital signage kit for Raspberry Pi 1 or 2 (with Raspbian).
[CI] mugifly's vm-signage/master:
This kit is composed with 2 components.
The signage-device script will be used by deployed on your Raspberry Pi. It makes the Raspberry Pi metamorphoses into an digital-signage device.
In the case of normally, the Raspberry Pi should be connecting with any HDMI display or VGA display.
The control-server script will be used by deployed on Heroku or your any server.
The control-server allows auto updating of signage when your any repository has pushed. However, whether to use of this function is optional; If you won't use it, you don't need to use the control-server.
- Procfile - File for control-server (for deploying to Heroku)
- control-server.pl - Control-server script
- cpanfile - Definition of dependent modules
- signage-device.pl - Signage-device script (for Raspberry Pi)
If you want to quickly make a digital-signage, that's enough only to run the Step.4 of Installation steps on your Raspberry Pi.
In addition, please attention to followings:
- About configuration-file (config/signage-device.conf):
- control_server_ws_url and git_cloned_dir_path parameter should be empty (undef).
- About repository URL:
- The YOURNAME part should be replace to "mugifly"; e.g., https://github.com/mugifly/vm-signage.git
Let turn on your Raspberry Pi!
If you will customize this kit, firstlly, You should fork the repository from upstream (https://github.com/mugifly/vm-signage). If you don't have GitHub account, please make the account OR use Quick Installation.
To easier customizing, You should make a new branch. It will be also easier merging from upstream repository.
Please run the following commands on your computer:
$ git clone https://github.com/YOURNAME/vm-signage.git
$ cd vm-signage/
$ git checkout -b my-signage
$ git push origin my-signage
When you customize this kit, you should make a customizing into this my-signage branch.
(TIPS: You can customize multiple signage devices by making branches for each. Please see Hints section for details.)
Firstly, signup on the Heroku. And install the Heroku Toolbelt on your computer.
Then please run the following commands on the cloned directory by Step.2:
$ heroku create --buildpack https://github.com/kazeburo/heroku-buildpack-perl-procfile.git
$ git push heroku master
$ heroku open
Firstly, run the following commands on your Raspberry Pi:
$ sudo apt-get install perl git chromium x11-xserver-utils libssl-dev
$ sudo cpan install Carton
$ cd ~
$ git clone https://github.com/YOURNAME/vm-signage.git
$ cd vm-signage/
$ carton install
(NOTE: If connected network needed a proxy to access WAN, you should run the command that like follows before above commands: $ export http_proxy="http://proxy.example.com:8080". Then when the run the sudo command, you might want to add -E option.)
Then, make a script file as follows: start.sh
#!/bin/bash
cd ~/vm-signage
carton exec -- perl signage-device.pl
Then, make a configuration-file as follows: config/signage-device.conf
{
# Startup (Optional)
startup_wait_sec => 5, # Or undef
# Signage browser
chromium_bin_path => 'chromium',
signage_page_url => 'http://example.com/',
# Proxy (Optional)
http_proxy => 'http://proxy.example.com:8080', # Or undef
# Control server (Optional; Websocket URL of deployed server)
control_server_ws_url => 'ws://example.herokuapp.com/', # Or undef
is_control_server_logging => 1, # 1 = True, 0 = False
# Auto updator with using Git (Optional)
git_cloned_dir_path => '/home/pi/vm-signage/', # Or undef
git_repo_name => 'origin',
git_branch_name => 'my-signage',
git_bin_path => '/usr/bin/git',
# Sleep of display (Optional)
sleep_begin_time => '21:59', # Or undef
sleep_end_time => '07:00', # Or undef
}
(NOTE: If you won't use control-server, these parameters should be set the undef: "control_server_ws_url", "git_cloned_dir_path".)
After that, add the following line into the LXDE autostart file: ~/.config/lxsession/LXDE-pi/autostart
@/bin/bash ~/vm-signage/start.sh
Finally, please try to test-running.
$ cd ~/vm-signage/
$ carton exec -- perl signage-device.pl --test
If you see "Test done", it means testing was successful; Please reboot the Raspberry Pi.
$ sudo shutdown -r now
Now, Your signage device is ready!
To auto updating signage when any your any repository was pushed, please register the following settings on the "Webhook" section of "Settings - Webhooks & Services" page of the forked repository on GitHub.
- Payload URL: https://example.herokuapp.com/github-webhook-receiver
- Content type: application/json
- Secret: (empty)
- Which events would you like to trigger this webhook?: Just the push event
- Active: (true)
You can operate your signage with using web-browser.
To enable this function, please make following variables to the environment variable on Heroku.
- VM_SIGNAGE_AUTH_USERNAME: Username for authentication
- VM_SIGNAGE_AUTH_PASSWORD: Password for authentication
Now you can access to web console: https://example.herokuapp.com/admin
You can use a general webhook to the control-server. This webhook receiver allows reload the signage when an any events was occurred.
To enable this function, Please set any keyword to the VM_SIGNAGE_WEBHOOK_KEY of the environment variable on Heroku.
Then, set to call an url which like follows in your any systems: https://example.com/herokuapp.com/webhook-receiver?key=abcdefg&cmd=restart
- key is the same as value of VM_SIGNAGE_WEBHOOK_KEY.
- cmd is command. In current version, available command is "restart" only.
Please edit following files.
In the line that begin from @xscreensaver should be commented out. And add some @xset lines.
/etc/xdg/lxsession/LXDE/autostart
#@xscreensaver -no-splash
/etc/xdg/lxsession/LXDE-pi/autostart
#@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
Firstly, please run the following command on Raspberry Pi:
$ sudo apt-get install unclutter
Then, add the following line to this file:
/etc/xdg/lxsession/LXDE/autostart
unclutter -idle 5
Under construction...
Copyright (C) 2015 Masanori Ohgita (http://ohgita.info/).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 (GPL v3).