User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Raspi is also good for boring server work

Thu Jun 14, 2012 10:43 pm

Hi,
this is not really something special at all, but anyway I just thought I might share with you my kinda standard and boring way of using the Raspi. I consider myself still a Linux beginner, so it's kind of cool that its working fine.

I simply use the Raspi as a private server for
- an apache Webserver for a private wiki (dokuwiki) and a database for my electronic bits and pieces
- a svn server
- sharing an external drive over the lan (so far is use ssh and scp but i want to switch to ftp or smb)

I use the Debian Squeeze. Thanks to apt-get most of the installation was straight-forward.
So far, as I can tell, it works pretty good. The Raspi has been running for 9 days now.
Backing up and compressing the SVN kind of takes forever (4-5 hours for 6GB) but anyway it seems to have worked. (I did not validate the backup)

For me the fun part of all this is to play around with "server automation". For example I use cron-jobs to backup my svn to an external drive automatically and I created a webpage which plots the CPU-Time and disk usage. It's cool to see that it "simply works" to do something in some way and use the output.

Here you can peek at my efforts in creating fancy plots of "live" data: (Remember: It alwas has to be fancy. Otherwise noone will be impressed. It's like not having a blinking LED on your super-high-end microcontroller-board. No blinky, no impressed people).

http://s31108.dyndns.org/

(and i also want to see what happens if more that one guy - me - bugs the raspi with web-requests).


So anyay: The Raspi is a cool, working server for private use. Maybe in a few month I will get me another one to play around with the power of the GPIOs. (to create more fancy plots)
Not everything is great

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Raspi is also good for boring server work

Thu Jun 14, 2012 11:28 pm

agreed - its is great as a little server - I am about 24 hours in front of you with R2 (my second Farnell Pi) which is 10 days or more into web server life but has taken nearly 5,000 hits on http://www.bryxx.com
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Re: Raspi is also good for boring server work

Fri Jun 15, 2012 8:34 am

SN wrote:10 days or more into web server life but has taken nearly 5,000 hits on http://www.bryxx.com
I'm close to that ... 30* Hits in the past two days ... ;-) (* I wrote the counter script myself. Actually I logged 58 hits, but I check for plausibility and try not to count hits from the same ip within the last 5 minutes ... However I did not really test the script properly. It's on my imaginary todo list).

I'm thinking about getting some actual sensors like an i2c temperature sensor (if the hardware part is only "plug and play") and maybe for some fun stuff like logging my consumption of coffee over a day. (Don't know if i really want to do that. I would have to face the truth if i start logging)
Not everything is great

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Raspi is also good for boring server work

Fri Jun 15, 2012 8:56 am

I almost agree with the boring bit.

After years of working with Debian, I found absolutely no surprises with the RPi, except for a few packages missing that I had to install from the standard repositories. So far, it has been just like any adult server, not childish at all.

I also work with PIC microcontrollers, using GPIO, serial ports and I2C. Once again, it was very easy to move my programs to the RPi (no, the RPi does not actually run PIC assembly language) and there were no surprises.

The end result is that the RPi would be a great place for a beginner to learn about Debian and low-level interfacing. All the skills learned on the RPi are easily transferrable to other environments.

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Raspi is also good for boring server work

Fri Jun 15, 2012 10:10 am

Christoph wrote:
SN wrote:10 days or more into web server life but has taken nearly 5,000 hits on http://www.bryxx.com
I'm close to that ... 30* Hits in the past two days ... ;-) (* I wrote the counter script myself. Actually I logged 58 hits, but I check for plausibility and try not to count hits from the same ip within the last 5 minutes ... However I did not really test the script properly. It's on my imaginary todo list).

I'm thinking about getting some actual sensors like an i2c temperature sensor (if the hardware part is only "plug and play") and maybe for some fun stuff like logging my consumption of coffee over a day. (Don't know if i really want to do that. I would have to face the truth if i start logging)
By the way, you don't need to script any counters - go set up Google Analytics and add their script to your pages - much easier than counters and you get loads of stats about where in the world people are coming from and what browsers their using etc etc and a really cool 'On The Site Right Now' screen

Image Image
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

BoxingOrange
Posts: 2
Joined: Fri May 11, 2012 12:02 pm

Re: Raspi is also good for boring server work

Fri Jun 15, 2012 11:42 am

I like the graphs you've produced, would you mind sharing your scripts that turns the raw datadile info JSON format?

Thanks

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Raspi is also good for boring server work

Fri Jun 15, 2012 11:44 am

BoxingOrange wrote:I like the graphs you've produced, would you mind sharing your scripts that turns the raw datadile info JSON format?

Thanks
They're not mine, they belong to Google. You just sign up (for free) on Google Analytics and then paste in a small piece of Javascript (that Google provide) into each page you want stats for. Then you just use the Google Analytics Web Interface to get the graphs/data
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

madsb
Posts: 3
Joined: Sun Jun 17, 2012 7:56 pm

Re: Raspi is also good for boring server work

Sun Jun 17, 2012 8:15 pm

Seems like an accessible and easy way of checking the state of your Pi. Why not use nginx or likewise instead of apache, if you're just serving html pages? :)

User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Re: Raspi is also good for boring server work

Sun Jun 17, 2012 9:26 pm

Well ... does "just type apt-get install apache2" and "having done it a few times befor so I know which config-files to edit" sound like a reason? :D

And to be honest ... never spend a second on such blasphemy that there might be something else than apache.
Not everything is great

BoxingOrange
Posts: 2
Joined: Fri May 11, 2012 12:02 pm

Re: Raspi is also good for boring server work

Mon Jun 18, 2012 12:26 pm

Thanks SN, the question was actually for Christoph, I looked at his website and noticed he used FLOT to generate his graphs, but this needs JSON data. I've got some basic home automation monitoring going on and would like to store the data and then graph it. Like a lot of people here I'm new to Linux so a bit of head start on the script to convert raw data to JSON would be useful.
SN wrote:
BoxingOrange wrote:I like the graphs you've produced, would you mind sharing your scripts that turns the raw datadile info JSON format?

Thanks
They're not mine, they belong to Google. You just sign up (for free) on Google Analytics and then paste in a small piece of Javascript (that Google provide) into each page you want stats for. Then you just use the Google Analytics Web Interface to get the graphs/data

empire
Posts: 42
Joined: Thu Jun 14, 2012 2:00 pm

Re: Raspi is also good for boring server work

Mon Jun 18, 2012 1:58 pm

I agree with the majority of the above; I have noticed that the RPi is very handy for teaching people about both Linux desktops and Linux servers. I am running mine headless and I am using it for a few basic tasks such as downloading torrents (and due to the lower power usage I have no issues leaving it on overnight seeding the RPi torrents from the download page), and I am also using it as my PHP dev machine. The RPi has a lot more uses than just teaching programming, which is great :D
http://rpi-blog.com - Raspberry Pi guides, tips, tricks, and resources :-)

User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Re: Raspi is also good for boring server work

Mon Jun 18, 2012 5:36 pm

BoxingOrange wrote:Thanks SN, the question was actually for Christoph, I looked at his website and noticed he used FLOT to generate his graphs, but this needs JSON data. I've got some basic home automation monitoring going on and would like to store the data and then graph it. Like a lot of people here I'm new to Linux so a bit of head start on the script to convert raw data to JSON would be useful.

:mrgreen: Ok, it's really nothing special, just some basic write file, read file and parse string parsing.
I execute a shell command (which maybe is weird that it actually works ....) and write the output to a file. I then read the file and parse the line. I do this only because I was too lazy to find equivalent php-fucntions and because somehow directly using the output of $shell_exec('...') got me some problems with the format (something about newline).

here you go:

http://s31108.dyndns.org/ and click on code (i'm such a great webdesigner)
df.txt - php script that creates the JSON Object for the pie plot
sar.txt - php script that creates the JSON Object for the CPU-Time-Plot
Not everything is great

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Raspi is also good for boring server work

Mon Jun 18, 2012 8:53 pm

Nothing wrong with a bit of basic scripting, stuck in the cgi-bin directory of lighttpd :lol
christoph why have you used awk AND php for your JSON transforms, awk can do it all effortlessly
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Re: Raspi is also good for boring server work

Mon Jun 18, 2012 9:38 pm

Oh I did try and actually got a script to work.
Basically I use awk and sed. Maybe in an awkward manner but still I thought it should do just fine so I could use a cronjob.

see here if you like
http://s31108.dyndns.org/src/sar_to_json.txt

It turned out the script takes about 16 seconds to finish.
My conclusion: I'm not good at shell scripting. So I tried basically the same with a php script. (The php script takes less than one second.) The leftover awk is just a result of not having searched for a propper way to do it in php.
Not everything is great

Furyio
Posts: 23
Joined: Tue Jun 05, 2012 7:02 am
Location: Dublin,Ireland
Contact: Website

Re: Raspi is also good for boring server work

Wed Jun 20, 2012 1:43 pm

Figured this might be a good start rather then a new thread.

I am utilising my Rpi for a few cool things. But one thing I want it to be is a private portal as such for me. A very simple webpage ( expanding to a small site) for strictly private use.

Contained on the page I just want simple links and things that would be handy ( links to some other home hardwware and network locations) for me to access their respective WebUI's.

I also run a very public mumble server that I want to be able to manage through a webui.

I'm a bit of a goose when it comes to home web hosting, I've got apache and the likes working, and I have a good few videos guides to assist, I guess the Derp I have is , do I need hosting?

I have a dynamic DNS setup, so I can already ssh into my machine remotely through putty, and I guess I want to know how can I get about viewing the page from outside my home.

Will the dyanmicDNS I have be enough, or do I need to go buy a domain from somewhere?

*The idea of a private wiki sounds great, was also humming and haughing over seeing if the PI could handle hosting a simple php forum with small traffic*

Thanks in advance
Raspberry Pi Debian Squeeze
IRC channels : #raspi.ie #d3.ie #att #airsofter.ie

User avatar
Christoph
Posts: 9
Joined: Fri Jun 01, 2012 7:33 pm
Location: Germany

Re: Raspi is also good for boring server work

Thu Jun 21, 2012 7:43 am

Furyio wrote:I'm a bit of a goose when it comes to home web hosting, I've got apache and the likes working, and I have a good few videos guides to assist, I guess the Derp I have is , do I need hosting?
I'm not good with non us-english :mrgreen: ... do what now? :geek:
Furyio wrote:I have a dynamic DNS setup, so I can already ssh into my machine remotely through putty, and I guess I want to know how can I get about viewing the page from outside my home.
You have to configurate your router (i assume you have one) so that it forwards the propper ports. E.g. you would have to forward port 80 for regular http-web-request to the (local) ip of your raspberry. How you actually do it depends on your device.
If it's really only for you, you might have a look at VPN and see if you could set it up. Basically VPN is like an "extension networkcable" to your home network. You use VPN from anywhere and it looks like home. (Especially usefull if you wan't to annoy your folks at home by printing random stuff)
Furyio wrote:Will the dyanmicDNS I have be enough, or do I need to go buy a domain from somewhere?
dyndns is fine. A "real" domain just looks better. Depends on what you want, actually your home IP would be enough to know. Anyway, I don't know about you, but in germany it's not common to have a static IP so the dyndns is kind of mandatory.
Furyio wrote:*The idea of a private wiki sounds great, was also humming and haughing over seeing if the PI could handle hosting a simple php forum with small traffic*
The pi can handle it. The question ist: How many connections are you expecting? "A few" is no problem, but "many" could seriously stress the pi. It's also a question of your internet connection. Is it fast enough to handle many web-requests? I've got a darn fast connection (50MBit/s down, 10Mbit/s up) but still, 10Mbit/s is not enough for serious webhosting.
Not everything is great

Furyio
Posts: 23
Joined: Tue Jun 05, 2012 7:02 am
Location: Dublin,Ireland
Contact: Website

Re: Raspi is also good for boring server work

Thu Jun 21, 2012 9:20 am

"I'm a bit of a newcomer when it comes to home web hosting, I've got apache and the likes working, and I have a good few videos guides to assist, I guess the problem I have is , do I need hosting?"

:lol:

Sounds easy enough, I'll just port forward so

My SD card is acting out so someone recommended I reformat and use the new Wheezy distro, the main use for my Pi is to download files through newsgroups, at the moment it seems pretty fail.
Raspberry Pi Debian Squeeze
IRC channels : #raspi.ie #d3.ie #att #airsofter.ie

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: Raspi is also good for boring server work

Fri Sep 21, 2012 4:59 pm

im also running a web server on one of my rpi

raspbian apache2 php and mysql

using the latest rasbian with the really useful overclock code, well worth upgrading to if your headless
i have also removed all the x window environment and run on a 16mb gpu memory split

very stable and reliable and highly configurable, all using 3 watts :-)

carry on the great work/play everybody

regards

adrian
http://212.159.76.122:81/serendipity/

Return to “Networking and servers”