How to upload image from raspberry pi to wamp server (web server) automatically? - raspberry-pi

I have a camera attached to raspberry pi which captures the image and image saved in raspberry pi memory. I want that image to upload to wamp web server automatically, so I can get it to my android phone.
Thanks

Well, in principle you would need an API on the server which you call from the Pi where you send the image to. That should receive the image and handle the storing at the server.
At the Pi you will have to run some kind of script calling that API. You can trigger that by the a newly captured image available, or e.g. a cron job, just what fits better.
But depending on what you actually want to achieve - just transferring the image(s) to a webdrive - perhaps using e.g. a "network drive approach" perhaps is easier.

You can do it in few steps:
1>>Setup Apache web server
2>>Setup [vsftpd] or similar FTP deamon on same machine. Please be sure that FTP server upload folder is Apache server root folder. For example [/var/www/html]
3>>Make small script [/home/myname/transfer_files.sh], based on [curl] which will transfer created files to Apache web server via ftp.
curl ftp://myftpsite.com --user myname:mypassword
4>>Add line in contab [/etc/crontab] which will be executed every single minute
*/1 * * * * root /home/myname/transfer_files.sh
This is not perfect solution, but it will work and you do not need to do any codding.

Related

Installing Ravendb on the Raspberry Pi

I'm currently trying to install Ravendb 4.1.5-patch-41012 for the Raspberry Pi on my Raspberry Pi 3 Model B running Raspbian Stretch Lite. When I run the run.sh script it will give an error about not being able to open a browser even if I set the Setup.Mode in the settings to none. After that I'm able to run server commands but I'm not able to access Ravendb studio and the Ravendb server locally or using my local network. Are there extra steps I have to take and or thing I have to keep in mind when installing Ravendb on the Raspberry Pi?
Raspbian Stretch Lite doesn't equipped with local web browser, therefor you may need to give outside access before using web setup. In the following link you can find description on the Server's configuration: https://ravendb.net/docs/article-page/4.1/csharp/server/configuration/configuration-options
Modify Server/settings.json in a way it fits your security needs, as follows (Replace 10.0.0.90 with your Pie's IP)
Totally unsecured access from anywhere (ATTENTION: This will give access to the database to any one with access to this docker instance):
{
"ServerUrl": "http://0.0.0.0:8080",
"PublicServerUrl": "http://10.0.0.90:8080",
"Setup.Mode": "None",
"Security.UnsecuredAccessAllowed": "PublicNetwork",
}
Access from docker's host machine or other machines on you local LAN:
{
"ServerUrl": "http://10.0.0.90:8080",
"Setup.Mode": "None",
"PublicServerUrl": "http://10.0.0.90:8080",
"Security.UnsecuredAccessAllowed": "PrivateNetwork",
"License.Eula.Accepted": true
}
Browsing to http://10.0.0.90:8080 should work at this point.
You can use cli, read : https://ravendb.net/docs/article-page/4.1/Csharp/server/configuration/command-line-arguments
Example:
cd ~/RavenDB/Server
./Raven.Server --Security.UnsecuredAccessAllowed=PublicNetwork --ServerUrl=http://0.0.0.0:8080 --PublicServerUrl=http://10.0.0.90:8080 --Setup.Mode="None" --DataDir=/mnt/ExternalDisk/RavenDB
As a side note: I do recommend to set "DataDir" to external mounted USB disk, rather then using the default SD card data path, if this is your case.
And later on you may want to use scripts for adding RavenDB as service on your Pie (see install-daemon.sh here : https://github.com/ravendb/ravendb/tree/v4.2/scripts/linux)
The run.sh is trying to start a browser the first time you start RavenDB to give you access to it. Given that you are running the Lite version, there is no such browser, obviously.
See Adi's comment on how to access RavenDB from outside the Pi machine.
You can just call server/Raven.Server instead of the run.sh instead to start RavenDB

Trying to Get a Raspberry Pi 3 to write and modify Data in a PostgreSQL database on a seperate Server

As a side project I have been interested in energy consumption. I have written and executed a program on a raspberry pi 3; this uses external hardware to gather data over Ethernet using ModbusTCP.
Within my program that is a data logging feature that creates and saves a CSV file with the values collected for that day. Every day at midnight a new CSV file is created and marked with the new day's date. This CSV file is saved locally on the raspberry pi and as it runs headless I’ve had to set up a cronjob to move the files onto a Thumb drive to allow me to view and assess the CSV file.
The modification I am trying to attempt is: I currently have a PostgreSQL database on a separate server; I am trying to get the Raspberry Pi to connect to the database and populate it with data as soon as the Pi has recorded it.
I have searched the internet, both this site and many others, but most of what I have found is tutorials and guides on how to set the Raspberry Pi up as a PostgreSQL server, which is not what I want to achieve.
Any advice and help is greatly appreciated.
Carl
Update : the programming language i am using is python 3
I would investigate using ssh. You can transfer the csv, and then invoke a script on the target machine, wait for a cron or just call pgctl at the remote command line. That will avoid the necessity of setting up a client on the PI, and opening the firewall at port 5432, configuring pg_hba.conf, etc.

Start of a Script from one server to another server

I've got a server (raspberry PI 3) which functions as a webserver.
Additionally, I've got a client (raspberry PI 3) with a camera connected.
I've created a script on the client, which creates an image of the camera and then sends it automatically to a volume share of the server(webserver).
With a simple <img> HTML tag I want to show the image on the website.
Now I have to manually start the script, which triggers the camera.
So my question is:
How can I start a script from the server(webserver) which triggers the script from the client automatically?
My idea was with sshpass. Unfortunately that did not work.
How would it work via SSH PASS or what else is a useful way?

Launching Xendesktop ICA session programmatically

I want to programmatically launch xendesktop and see whether it is launched or not for monitoring purposes.I understand that if somehow I can get the ica file then passing that ica file to ica client can solve my problem.
I read that citrix has ICO API but I am not able to use it to launch my desktop.
Can someone pls throw some light on this?
Thanks in advance
ICO API in real-world scenarios is not enough.
You need to get your VDI address from StoreFront API https://github.com/citrix/storefront-sdk. Here you can download the whole ICA file and just launch it. I'm downloading it, modifying to run windowed and then just run ICA. Windows do the rest. The other possibility is to download ICA using StoreFront API, get Address from there and connect to the machine using this Address. It's actually IP and port for your VDI desktop.

How to send a video stream to a cloud?

I want to send a live video stream to a server and I want to perform facial recognition on that video and I would like to get the result back to the client program. Where do I get a server? Can I use Windows Azure here? If yes, can I also make a Python/C++ Server program listen on a particular port?
You haven't talked about the client-side piece. Assuming you're in control of a client app, you could push the video to a Blob, then drop a notification in an Azure queue for a background task to process the uploaded video fragment.
Instead of directly pushing to blobs, you could host a web service that lets you push uploads, and the web service could store the video fragment and then trigger a background processing task.
Running python should be very straightforward - just upload the python exe and any related modules, either with your Windows Azure deployment or in blob storage (then pull them down from blob storage and install them when the VM starts up). As far as port-listening, you can define up to 25 ports that are external-facing. You'd then have your python app listen on the port you defined (either tcp, http, or https).
More info on block and page blobs here. Steve Marx posted this example for installing python in your Web or Worker role.