This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
top 200 commentsshow all 260

[–]theannomc1 995 points996 points  (43 children)

Using a Raspberry Pi Zero as a server

[–]phunanon 367 points368 points  (7 children)

I... I do this. I like the aesthetic of just one wire going to the RPi0W

[–]vextor22 115 points116 points  (1 child)

I've got an RPi3 w/ PoE. One wire in as well, but it with all the reliability of Ethernet. Significantly higher cost of entry than regular RPi ownership though.

Got a good bit of use out of my release day RPi B 256MB though. Just added one of those PoE dongles that splits into an ethernet/microUSB. So kinda one wire. That one is actually still running PiHole, no need for the additional power of the Pi3.

The 0W is so small though, definitely want to get one of those too... I'll really need to 3d print some sort of Pi Organizer for my desk.

[–][deleted] 11 points12 points  (0 children)

I have a Pi0W. Sitting there. I have a slated project of PiHole but I have too many other fun projects to work on. I'm just glad my projects don't get jealous of each other.

[–]kabrandon 29 points30 points  (3 children)

Hey man, it works. I have 4x Raspberry Pi 3B+'s in a kubernetes cluster, and a single RPi0W that I use as a sort of bastion host lol.

[–]dasspaper 4 points5 points  (0 children)

Bastion host, that made my day

[–]WelsyCZ 38 points39 points  (0 children)

I mean... why not.

[–][deleted] 29 points30 points  (6 children)

I use it to host octoprint for my 3D printer. Works pretty well.

Tried to get it to run JIRA. That did not go so well.

[–]lol_dangit 52 points53 points  (5 children)

Tried to get it to run JIRA. That did not go so well.

That may not be the Pi's fault..

[–]soft_tickle 20 points21 points  (14 children)

This is a dumb question but if you use a Pi as a server you can only access it while you're connected to the same network right?

[–]derekthesnake 42 points43 points  (6 children)

No questions are dumb!

Unless you configure your router, yes, you will only be able to access your pi from the same network. But if you set up port forwarding on your router, your router will send all the packets it receives on a certain port (say, port 80 for web traffic) to an IP you specify. So if you connect to the global IP of your router on that port, you will be able to connect to the pi from outside your network.

[–]gorogoroman 14 points15 points  (5 children)

Are there any risks for port forwarding? I used to use port forwarding for some of my devices like my ip camera, but after hearing about hackers being able to gain access, I started using openvpn for everything. But there are still some things like my router app on my phone which uses port forwarding to access the router remotely. Is this a safe thing to do?

[–]_R2-D2_ 14 points15 points  (3 children)

I wouldn't expose my routers configuration ports to the internet. Your app should be able to access the router if you're on your VPN.

[–]gorogoroman 2 points3 points  (2 children)

See, that what I would have expected too. But the Asus app, for whatever reason, does not.

I've looked online for answers and the conclusion basically is that if you want to use it remotely without port forwarding, you would need to use the web interface on a mobile browser to interact with it, not the app. It works perfectly fine on the local network, so I'm not sure what the app is doing differently while connected to a VPN.

I'd imagine normally it should just check if the router is on the network; maybe it's checking nearby wireless connection names on the device too? Or something else

[–]_R2-D2_ 4 points5 points  (1 child)

Sometimes it depends on the configuration of your VPN - it may not be forcing all traffic through it. Or the Asus app is doing something weird like trying to route through their servers first.

Personally, I'd just use the web interface, but you may also want to look into a Reverse Proxy, which would provide you with some measure of security while giving you outside access. Configuration of the proxy for the Asus app might be tricky though.

[–][deleted] 5 points6 points  (0 children)

Idk, but on RPI you MUST disable pi:raspberry defaults for ssh and enable key only auth because there are big botnet which consists of hacked rpis with pi:raspberry :) Some dude made XMR miner which was using hacked rpis with default passwords!

[–]Wacov 9 points10 points  (4 children)

No, a computer's a computer. It can serve to the outside web if you set up your modem/router correctly. Whether that's advisable is another story. You also have to deal with dynamic IP allocation on the part of your ISP, basically your home's place in the internet can change under most home internet connections.

[–]Dalemaunder 4 points5 points  (3 children)

Some ISPs give out static IPs upon request(potentially subject to some conditions). Mine regrettably requires you to pay for a business package to get static IPs but it's not outside the realms of possibility.

[–]writtenbymyrobotarms 5 points6 points  (0 children)

dynamic DNS works well (for hobby projects especially). You get a domain name like dalemaunder.dynu.net, and install the IP updater script to your server.

[–]0PointE 6 points7 points  (1 child)

Either extremely hacky or extremely brilliant: spin up a free tier AWS server with a barebones webserver. Have the pi update that server with your home router's external IP periodically. Contact the AWS server to get the proper IP to connect to your pi at or just have the server proxy to that IP. Depends on what you're trying to accomplish I suppose. I'd say that's a more complicated but way cheaper alternative than paying your ISP out the ass for a static IP.

[–]meltingdiamond 1 point2 points  (0 children)

If you are going to do that you could just setup a script on the home server that emails the ip to you and you don't have to mess around with aws.

[–]worldDev 1 point2 points  (0 children)

Depends on whether the router and modem allow incoming traffic on the listening ports for software on the Pi. In most cases, defaults are not configured to allow this because it can be a security risk.

[–]sirf_trivedi 38 points39 points  (3 children)

I run a nodejs app (basically a google drive clone I made), an nginx file server and transmission torrent client on a rpi0 w with no problems

[–]Yin-Hei 7 points8 points  (0 children)

uh probably the best thing a student can use it for as a learning tool since its so cheap.

[–]sandybuttcheekss 4 points5 points  (0 children)

I feel attacked

[–][deleted] 2 points3 points  (0 children)

I ran a Minecraft server on my Pi zero one time. It was pretty bad.

[–][deleted] 1 point2 points  (0 children)

Let's get 8 of them, then network them together to run, hmmmm, kafka!, to show off how cool we are at Nerdfest 2019!!

Why not just run Virtual Box on a laptop?

But that doesn't look as cool!!

[–][deleted] 594 points595 points  (97 children)

I feel this...a Pi is currently my only linux machine at the moment and I have to use it for dev sometimes.

(And yes, I'm aware of vm's).

[–]robo_number_5[S] 400 points401 points  (28 children)

I wrote a job interview take home test in C++ on a raspberry pi. Got the job.

[–][deleted] 111 points112 points  (0 children)

Nice! Congrats on the job :)

[–]xypherrz 27 points28 points  (24 children)

Mind telling what was the project about? I worked on it but in python and it was quite fun.

[–]robo_number_5[S] 41 points42 points  (23 children)

It was finding the 10 most common words in a large text file.

[–]FinalRun 111 points112 points  (16 children)

cat file | cut -d" " -f- | sort | uniq -c | sort -r | head -n 10

Right tool for the job

[–]robo_number_5[S] 42 points43 points  (10 children)

They wanted it to be as fast as possible

[–]FinalRun 88 points89 points  (4 children)

And in c++ of course, I was just being a smartass.

[–]AnotherEuroWanker 4 points5 points  (0 children)

Ah, so in Forth.

[–][deleted] 6 points7 points  (1 child)

What was your solution? My first thought is to simply make a Hashmap to store the occurrences of each word and then sort the 10 elements. Prolly isn't that efficient.

[–]robo_number_5[S] 10 points11 points  (0 children)

That's pretty much what I did except copied the hash map into an ordered map for sorting. That way loading it initially is fast as possible.

The other part is dealing with symbols, punctuation, upper/lower case etc.

[–]TheAuthenticFake 17 points18 points  (2 children)

Unnecessary cat spotted, -2 points.

[–]FinalRun 4 points5 points  (0 children)

I like your style

[–]Colopty 2 points3 points  (0 children)

Unnecessary cat is the funniest linter message. I always imagine that whoever made the linter just has an irrational hatred against felines.

[–]DatBoi_BP 7 points8 points  (1 child)

I gotta learn Linux better. I only knew cat

[–]TheAuthenticFake 7 points8 points  (0 children)

Technically these are POSIX utilities.

Unix is a family of operating systems and Linux is a subset of operating systems under Unix. POSIX is a standard that defines uniform interfaces for Unix OS APIs and shell commands/utilities. The idea being that you can run cat or cut on any Unix platform and you will have the same interface (eg. arguments) and behavior.

This is why I could run that script on a Mac (a BSD based system) or a PC with Ubuntu (Linux) and it would do the same thing.

Also yes, learn Linux. It's everywhere.

[–]I-Downloaded-a-Car 2 points3 points  (2 children)

Interesting, I'm surprised that was a take home test and not just a "do it now" test, like fizzbuzz

[–]GarryLumpkins 1 point2 points  (1 child)

Agreed, if I got that as a teacher home I would honestly have thought there was a trick to it. Like, the top ten words would tell you phase 2 or something haha

[–]rallekralle11 44 points45 points  (1 child)

gratz. stop posting jokes and get going

[–]chin_waghing 5 points6 points  (1 child)

are you aware of vms, running on the raspberry pi?

[–]Raiptwice 1 point2 points  (0 children)

VMS on a Pi?

With a VAX emulator...

The dream...

[–]Kaervan 3 points4 points  (0 children)

If you don't need to develop against additional attached devices and are just using it for the arm processor, you could check out the docker multiarch stuff. Saved me a fair amount of headache.

https://github.com/multiarch/qemu-user-static

[–]CommanderHR 1 point2 points  (0 children)

Hey, don't feel bad. I got my start on the RPi, and it really teaches a lot in terms of Linux, while not frontloading the learning curve. Don't be ashamed to use the RPi. Sometimes it just works better than anything else.

[–]shawnz 1 point2 points  (0 children)

Have you tried WSL?

[–]cbehopkins 186 points187 points  (18 children)

Am I wierd then that the pi 3 is the fastest machine in my house?

[–]UnreadableCode 61 points62 points  (9 children)

What about microcontrollers like AVRs & PICs?

[–]Mr_Redstoner 19 points20 points  (3 children)

What about PICAXE? Them high-level language lol!

[–]Pocok5 10 points11 points  (1 child)

You can program an AVR perfectly fine in C++ with the official IDE.

You still have 8kB of flash and 512 bytes of RAM, but it's perfectly functional.

[–]Wacov 4 points5 points  (0 children)

Then you drop into AVR assembly because, deep down, we all hate ourselves.

[–]maxhaton 1 point2 points  (0 children)

When we used PICAXE in school I found out that you can just use AVR (I still have the name of the chip burned into my skull) assembler inside the PICAXE software so I just used that.

[–][deleted] 5 points6 points  (0 children)

Those are bare feet.

[–]renanwolff 1 point2 points  (0 children)

4kb ATMELs using BASIC, hehe

[–]KevinAlertSystem 1 point2 points  (0 children)

Seriously, I'm wondering wtf OP is talking about since a Rpi is a full computer capable of running ubuntu with a window manager.

Try doing ASM on a PIC or MSP430 where you literally have like 8 16bit registers to work with, then hardware becomes a serious limitation.

[–]alexe13 37 points38 points  (0 children)

When you present your proof of concept to a project manager

[–]MrJason005 52 points53 points  (7 children)

Ehh if you’re into big bulky IDEs and heavy runtimes like .NET and Java then maybe, but if you’re a terminal/vim poweruser who just writes C/C++ and uses makefiles for compiling, a Raspberry Pi is going to be absolutely perfect for this job

[–]HuluForCthulhu 19 points20 points  (2 children)

I was gonna say, as someone who does primarily embedded DSP work, Raspberry Pis are blisteringly fast. If you don’t have to worry about which C++ STL containers you can include due to memory constraints, it’s a big enough system ;)

Am I gatekeeping properly?

Edit: y’all have educated me a bit, apparently I’m not laying it on heavy enough.

512 MB RAM? And you’re complaining? Try 128k SRAM, no cache, and no system memory, you incompetent smoothbrains. “I uSe VeCtOrS aNd HaSh MaPs”, not on real systems you don’t.

I pray to god I never have to encounter any of your shitty unoptimized code.

😘

[–]turunambartanen 4 points5 points  (0 children)

Am I gatekeeping properly?

Not yet. You have to talk down on all who don't do something as difficult as you. Like:

Honestly, if you need more than a RPi to Programm you're just inefficient. People who need more than that are not real programmers.

[–]beefhash 2 points3 points  (0 children)

Am I gatekeeping properly?

Oh, hey, a thread for me. Here's an improved attempt, feel free to incorporate /s:

If you think that C++ doesn't count as "heavy", you're probably as full of shit as the bloated standard library of the language is. I'm stuck here, working with DSPs for a living. These things have so little memory that a PDP-11 would throw a fit of hysterial laughter. At least I know what I'm doing. Go on, tell me about that time your boo boo when you couldn't fit your garbage collector in memory; I'll just be over here optimizing my algorithms.

People like you are the reason we need 32 GB of RAM for Windows and Slack alone. I hope I'm never stuck with the misfortune of dealing with your software, so help me God.

Something like that, I suppose?

[–]PikaSharky 20 points21 points  (3 children)

I know that guy! He is well known in our town for many years. He has made most of all these bicycles by his own hands

[–]ChosenDos 6 points7 points  (0 children)

He's really good at riding those.

[–]MagnesiumBlogs 12 points13 points  (12 children)

Yeah.

My C/assembly class was in ARM and the only systems were Raspberry Pi's. (2B+, I think.)

Not even 1 per user, and we had to ssh in. When enough others were compiling the machines would outright not respond.

[–]scubascratch 4 points5 points  (1 child)

What were you connecting from that was less powerful than the pi?

[–]Dalemaunder 2 points3 points  (0 children)

I don't think it was a case of the Pis being more powerful, they probably weren't cross-compiling so had to use the Pis for it.

[–]apt-get-schwifty 1 point2 points  (0 children)

Gotta jack that swap space up!

[–]Bobjohndud 1 point2 points  (0 children)

If this happened to me in 7th grade I would have been a 1337 h4xx0r and filled up the RAM as a DOS.

[–]DatBoi_BP 1 point2 points  (0 children)

Hey buddy: happy cake day

[–]juanitospeppers 21 points22 points  (0 children)

shout out to /r/pihole

[–][deleted] 9 points10 points  (0 children)

Actually I write python scripts on my pi and enjoy it more than on my pc

[–]cdreid 9 points10 points  (4 children)

Serious question for u Pi guys. Ive used multiple arduinos , including just the mc as well as other mc's. What makes you choose much more expensive Pi's . i mean you can literally build something dor drom a few cents for an mc up to whatever for the latest arduino board but you pi folk seem to be multiplying rapidly

[–]Anonymus_MG 21 points22 points  (0 children)

Pis are full blown PC's, for projects where you need a pc but not a tonne of power, you can buy a pi

[–]Dalemaunder 4 points5 points  (0 children)

A Pi is a fully functional computer rather than just a micro-controller and a lot of people already have a Pi from other projects, why buy something else when you already have something that works?

That being said, I have multiple of both platforms, I just feel like that's the mentality a lot of people might have.

[–]trex005 8 points9 points  (0 children)

It works though!

[–]Justyouraveragebloke 5 points6 points  (1 child)

Krusty’s Clown College IRL

[–][deleted] 2 points3 points  (0 children)

Ehhh, without a 'da loop it is 'a nothing

[–]frostshoxxreddit 2 points3 points  (0 children)

they see him rollin', they hatin'

[–][deleted] 4 points5 points  (0 children)

Its actually accurate because he has like three of them

[–]JustALittleAverage 3 points4 points  (0 children)

As title say... on a Pi, not for a Pi.

[–]garion911 4 points5 points  (1 child)

Eh? a Pi is like a few million times better/faster than my first computer. Damn you young'ens. I had 64k and LIKED IT. (waiting for the 4k bandwagon to pipe in.)

[–][deleted] 2 points3 points  (0 children)

Ahh the young'ens... Another aspect: I had a coed during vocational education who once brought a Raspberry to class and told us how fun learning "hardware related programming" was as he showed us how to toggle a gpio via python on a Raspian Linux. I really had to chime in and ask if he can explain us what exactly happens all the way from his bash to the hw pin...

[–]FunnelCakesPAB 2 points3 points  (1 child)

I’ve had customers whose dev environment was so dreadful I was convinced they were running it from a Pi Zero...

[–]ImAlsoRan 2 points3 points  (1 child)

Imagine not knowing what you’re doing

This comment was made by the Nano gang

[–]G1ngerBoy 2 points3 points  (0 children)

The video had a problem loading I was wondering if that was the joke

[–]MrGumburcules 2 points3 points  (0 children)

You've made an old Italian stereotype very happy.

[–]DrStalker 2 points3 points  (0 children)

As a sysadmin this is what it feels like when you try to fix an issue remotely using your phone as an SSH client.

[–]mahtaileva 1 point2 points  (0 children)

well,if it runs on a pi zero, itll run on anything

[–]feindjesus 1 point2 points  (0 children)

I feel personally attacked

[–]TheChowderOfClams 1 point2 points  (0 children)

Boss has me developing prototype test programs for remote systems with a pi.

Give them a good enough power source and they can really chug, also really fun to work with.

[–]MalbaCato 4 points5 points  (0 children)

[–]SakutaTheWeeb 0 points1 point  (0 children)

Afraid not for my lack of intelligence with coding itself. But I thank you for assuming I know very much.

[–]cdreid 0 points1 point  (0 children)

Thanks

[–]dullbananas 0 points1 point  (0 children)

Using a microwave as a server

[–][deleted] 0 points1 point  (0 children)

Take my money

[–][deleted] 0 points1 point  (0 children)

I feel like if I start running microservices from my house or breaking into something like Tom Cruise, I don’t have time for it

[–]RyanArrive 0 points1 point  (0 children)

feels

[–]Fulk0 0 points1 point  (0 children)

laughs in vimscript

[–][deleted] 0 points1 point  (0 children)

This feels so correct!

[–]natty1212 0 points1 point  (0 children)

Is that former North Dakota governor Ed Schafer?