Search This Blog

Thursday, March 22, 2018

Play an mp3 file on raspberry pi remotely, use it as an alarm or to call some one

Get the apache2 and php from here


Create an index.php and place it in root, create the mp3 file and sh file which
will be played by the php, you can use mp3 recorder online to create a custom message
or alarm sound.

Use this link to create php file and I used omxplayer isntead of mpg123 mentioned, i got pi3



Well i could open this local ip of my pi and it played my sound remotely through a webpage,
I saved a bookmark on my android phone on home screen to use it handy.

Tip* You could also test your script and mp3 locally by running in shell before inserting it in php page.

I cam going to use it frequently to call my wife, she doesn't check her phone often and I am
too lazy to move from my couch.

In case you get some weird vchiq error  
* failed to open vchiq instance fix this here 

Oh and yes, i did a mac/ip binding on my dlink router so that my pi always picks up same
address, if you want to use it from outside home(remotely) you can do a port forward also.

Wednesday, March 21, 2018

Send http post webhook to Iftt maker channel service using motion library on Raspberry pi

In case you are using motion on raspberry pi and want to make a notification on
your android phone whenever some motion is detected on camera, please read this.


Go to ifttt and login and create a new applet , in this part select webhook 
enter the event name , ilke the front_door_movement and select a notification in that
part, for simple android notification on the phone select the ifttt notification (simple one)

Now go to settings and know your api key for this webhook.

The trigger url for webhook will look something like this.

ifttt.py  // run apt-get update & apt-get install python-requests if you dont have requests module on pi
////////
import requests
////////////


Go to /etc/motion/motion.conf and locate on_event_start event 

on_event_start  python /home/pi/ifttt.py

uncomment and add this trigger, make sure python file is executable by running chmod +x

try running file first to see if ifttt hook is setup properly.

Now whenever the motion is detected on the camera, this will send an android notification from the ifttt app.

Tested and it works perfectly.




Monday, March 19, 2018

Openshift Basics

Openshift is a PAAS solution by Redhat, platform as a service.

Openshift uses kubernetes and docker technology to provision containers.

Openshift is a wrapper around docker and kubernetes 

Openshift can be installed locally using minishift.

To run an  application you will need the following :

Project: A project need to be created for any app to run, it has its own namespace where resources will reside.

Route: To expose the service to outside world.

Pod: The node where containers run , one pod can have multiple containers.

ImageStream: is a link to the image from local registry or dockerhub 

YAML: The meta information for the resources , configuration file for resources

Services: The app hosted on pod can be termed as service.

Once the image is deployed either from docker repo or external registry, it is available in local repo as well 
Internal docker repo will have an assigned repo ip from the cluster.


Db pods usually share the gluster/ceph storage as shared SAN, they also have replication provision to achieve HA

Services running on one node can reference other services on another node of the cluster with the spec names.





Run a docker image on Openshift training environment from dockerhub

Get the client VM and the shared environment access, we will use client VM only to connect to the Openshift environment.

Note. IF you dont use shared environment access, you won't see an option to create the project in the console.

Create a new project from the console and search the image from the deploy image option.
Create the image in the openshift environment.
Create the route and map the application port, check route YAML for more information.
Access the application , make sure you use it directly and don't specify the port.

E.g if you bound 8001-->8001 of container try the http://routeurl:contextroot only