mugifly / vm-signage

Simple digital-signage kit for Raspberry Pi (Raspberry Piでデジタルサイネージ)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vm-signage

A simple digital signage kit for Raspberry Pi 1 or 2 (with Raspbian).

[CI] mugifly's vm-signage/master: Build Status

About Components

This kit is composed with 2 components.

Signage-device script

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.

Control-server script

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.

About Files

  • 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)

Quick Installation

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:

Let turn on your Raspberry Pi!

Installation

1. Forking the repository

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.

2. Git-clone and making a branch

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.)

3. Deployment of Control-server on Heroku

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

4. Installation of Signage-device on Raspberry Pi

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!

5. Add Webhook on GitHub

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.

About the web console for administrator

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

About the general webhook

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.

Hints

How to disable sleeping of the HDMI display

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

How to hide the mouse cursor

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

How to customize multiple signage devices

Under construction...

License

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).

About

Simple digital-signage kit for Raspberry Pi (Raspberry Piでデジタルサイネージ)


Languages

Language:Perl 89.3%Language:JavaScript 8.5%Language:Perl 6 2.1%