Create a web app from scratch in under 5 minutes with Meteor and Mailgun
blog.mailgun.net
blog.mailgun.net
if(Meteor.isClient) {
...
}
if(Meteor.isServer) {
...
}
Does the Meteor compiler somehow split those code blocks into separate files, so that it only serves the client code to the browser?If not, it seems like a pretty bad practice for delivering fast webapps.
Edit: In general, Meteor.isServer seems like a great way for developers to shoot themselves in the foot:
Dev: Let me just add my $secret in the server-side block...
Bad guy (viewing source): Oh, what have we here?
Dev: PWNED :(Anyway, the answer is that the entire script is sent to the file and the server. In practice, this isn't a performance issue so much as a security issue - there may be parts of your server code that you don't want clients knowing about.
You can prevent server-side code from getting shipped to the client by placing it in the server subdir.
Yes.
I really wish people would stop giving instructions like this. Despite all the focus on web security and sandboxing, we continue to instruct people to run arbitrary code on their user account.
People should at least give any shell script they download from the internet a cursory look to see if it's doing what it should be doing instead of blindly executing the response from an HTTP request.
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
Goodness, that looks awful.Chocolatey is sort of like an alternative apt-get for Windows, except that it doesn't need s sudo command and your password to install software. It uses cinst to install stuff:
cinst firefox
Installs Firefox.
The UAC asks the current user to allow the setup program to run and that is about it. No password needed to install like apt-get has.
Oh yeah if your PC doesn't have Powershell installed you are SOL if you try to use that command to install Chocolatey. Some administrators remove it because it can be used to install software without being known to the user.
Why not just restrict the execution policy? I don't really know PS thta well, but doesn't that stop arbitrary (or any) scripts?
`pip install foobar-py` runs a Python setup script, which can do anything bash can. Do you inspect all of those, and comment about their insecurities on HN?
Just because this style makes you think about it harder, doesn't mean it's less secure. It's the simplest and best case.
Good package management systems use digital signatures to ensure that the original package wasn't tampered with. Not that hacking of the central repositories never happened, but it's a major (and thus infrequent) event.
I know my sources, I trust them. If they're compromised and they take me down with them, I'm going to cry a little but it's not like I'm working on a nuclear reactor - I'm making some shit CRUD app. Now as the importance of a codebase increases the kind of attitude like I have should decrease of course.
Finally, some much needed humility on HN. Refreshing. And true.
Great for you, but you're a developer who presumably works on 'shit CRUD apps' for other people who pay you for the effort.
What happens when a script from a compromised source that you run on your devbox grabs the entire contents of ~/.ssh/ and sends it to the bad guys inbox? Congratulations, all your clients have been thoroughly owned.
curl https://install.meteor.com | shasum -c 6fa3128600e9bd73a161a625f8503e6614b44b2b | sh
Could be built into curl possibly.
Just about every other way of installing software ends up letting the remote run arbitrary code on your machine. The disadvantage of the other approaches is that you don't think about it, so you feel safer than you are, and you are more likely to make security-compromising mistakes.
- When you download an OS X installer package and run it, it can run arbitrary code during the install. Is that how you installed Postgres or Rails? Hope you downloaded that disk image over http. (The last time you downloaded a disk image, did you check the link to make sure it was https? ... Are you sure you never forget to do that?)
- OK, so let's say you download a tarball instead, and untar it into /usr/local, and put meteor in your path. Then the next thing you do is.. you type 'meteor', letting the tarball run arbitrary code. There's not much security difference between letting the remote code run at install time, and letting it run two seconds later when you actually start the program fo the first time.
- OK, let's say you downloaded a Meteor tarball, checked its SHA1-- wait, how did you get the correct SHA1? Did you get it off our website? (Best case, over https, bringing us back where we started?) Or did you call me on the phone.. using the phone number you got off of Facebook.. secured by https? (Best case, and only if you manually added https to your Facebook URL. Did you remember to do that?)
- No problem, I'll get it out of macports, fink, or homebrew, and hopefully they'll have the correct authoritative hash and validate the download. Well, how do you know you have the real macports? The chain of trust still goes through https and the CA. Arguably this is a little better because presumably many people will notice if the macports download site is hacked, but just as arguably, it's less secure because there's one more potential compromise point (volunteer macport maintainers -- how are they vetted? do they use two factor auth? what if their email account is compromised?)
There's really two separate issues here:
- Do you trust Meteor enough to run our code? If so, you shouldn't care whether you run curl | sh or whether you download a tarball and unpack it, and then run the program in it. If not, you shouldn't do either. They're equally bad.
- Do you trust https and the certificate authorities to protect you from MITM attacks, so that you get the authentic bits from meteor.com and not an imitation? If so, then curl https://foo solves your problem. If not, you are going to have to find something better than the CA's to serve as your root of trust.
Maybe there is an argument for "defense in depth" -- maybe you should fetch the tarball from one server with one CA, and the SHA1 from a second server with a different CA -- sure, in practice that could make a compromise less likely. But that's a bit much to ask of the random OS X user that just wants to come to meteor.com and install the tools.
Your best option is clearly to come to the monthly DevShop events at Meteor HQ in SF. If you come to DevShop to install Meteor, I will personally confirm the SHA1 for you :)
http://wiki.laptop.org/go/OLPC_Bitfrost#Foreword
Unfortunately, it doesn't look like it went anywhere even in the OLPC world... I'm not very familiar with OLPC, but the fact it carries a 2007 timestamp isn't very encouraging. I wonder if it fell victim to the "sugar" watering down of the project :-(
Personally I run pretty much everything in containers. Not always segregated from each others, but certainly segregated from most of the data I care about. All larger projects get their own containers or VMs, and I have several "scratch" VM's and containers of various types that I don't care if I lose.
Spawning a Virtualbox VM or LXC container (or equivalent) is so quick and painless today that there are few excuses to running all kinds of stuff unrestricted.
This is not to say that I run everything isolated from everything else. I have a "unsafe" VM for example where I compile and mess around with a lot of public code I don't want to evaluate the security of. To get further into my network from that one still takes a little bit of work. I also group together various things based on tasks.
But random code I don't have a reason to trust won't go straight into my normal user account on my laptop.
Note that a "reason to trust" can be as simple as "has been signed by the Debian packagers" for some systems. It's a trade off.
Meetup group link: http://www.meetup.com/Meteor-SFBay/
In all seriousness, you should consider posting a response like this in your FAQ/Help and linking at the install tutorial. I'm really sick of this knee-jerk security reaction happening every time someone builds an installer like this.
Story time. I'm at a hotel, connecting to the Web over Tor and using my distro's package manager (Pacman) to install software. I'm also routing Pacman over Tor because I trusted the hotel wifi even less than I trusted Tor. Anyway, Pacman has this wonderful feature of verifying md5sums - fingerprints of the original source code, as posted by the source code author - from source packages before installing any of the code onto your system. If the md5sums on the software you download don't match the author's posted true md5sums, something is probably wrong. You can tell where this story is going. As I'm installing a few packages, which I've done numerous times in the past, Pacman throws a warning: the md5sums don't match. Slightly annoyed, I then download the software directly from PyPi over the hotel's wifi connection, md5sum it and lo and behold, it's the correct md5. It's the exact same software version and everything.
Importantly, the source code must've somehow been modified between the time it was sent from the AUR/PyPi and when it ended up on my machine. Luckily, the md5sum check failed and the software didn't install, but it did scare me quite a bit.
If I had instead been installing Meteor, as per Meteor's current insecure directions, without checking md5sums or signatures, who knows what could've happened. The Meteor team should really consider releasing an md5sum, sha256sum, or better yet sign their packages, because otherwise there's no way to verify the contents of a download.
The Meteor team clearly has the resources to provide this to the inquisitive. It is SOP for all major FOSS. I get that there's something to be said about the ease of releasing packages from GitHub, but imagine if the Linux kernel did this? What Meteor has right now is ok for alpha software. They certainly have room to grow.
I've never heard of meteor before, and it's likely that many of the people who are reading the article haven't either.
Yes the site is HTTPS, but anyone can buy an SSL certificate for any purpose. It's not even a case of being MITM'd.
Basically we're telling people "read this blog post, run this curl command that runs some random shell script from this server you've never heard of before".
That's a very different from installing packages from your development community's package server, your OS's package repository, or an app store.
I know it's not possible to fully inspect all the code we run, but I'd rather we didn't encourage the habit of entirely disregarding it.
#!/bin/bash
#
# Installs a product from the Internet.
# PLEASE READ CAREFULLY!
#
mkdir /tmp/foo-installer
cd /tmp/foo-installer
cat > file_2.sh <<________EOF_file2.sh________________________________________
A very long script here....
A very long script here....
A very long script here....
________EOF_file2.sh________________________________________
base64 -d > file2.png <<________EOF_file2.png_______________________________________
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
AAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAATdEVY
dFRpdGxlAE9wdGljYWwgRHJpdmU+Z7oMAAABkUlEQVQ4jaWSvy9DURTHv6d9ty0tSgivkdBUkGgR
GotNxGoXjY21SJp0ag2CR8SE2oQ0Qiw2RPwDSASLkDL5EbwOlDZpj6mJ5z2/4puc5eZ7P/ec7z3E
zPiPJKPDjsF4q7u2cvj2XvVbhUjuTPd2HhIlAKCd2f0lwD+0KsuVZTGrTTTcPyRfhZBSP3VAzAz/
0KrsLHZsZbNZ8fzyFiemoxzlzg5i/Te/GsFTI08mru7CRpeUmckIwEEQkqHRsPszgIxCVJSJAaZc
H0BtPm9zmc/bnI2vrewTm+KhUHhZY2ZmTU0p4wu7e9tspN29bZ5Sxhc++k2fX2cg0N3VA1V91FV3
Vw8YCOgy0BxIkv3k9Bg+b4tutKvrBCRJsn8LAICK8gpcXJ4jlUpBTT5BCAEAcJaU6ryGALPZjAKb
DSYTwWIRyGTSSGfSsDscOq8uAwAoLMx3SWAA+X8ig63XAYgQXVyaR1FRMaqqXPC469BY3wSXXI2N
zXUQIarxG+3B7JwSYdYa8/CRYGjsR8BfZJjBX/QObiW573fRhdIAAAAASUVORK5CYII=
________EOF_file2.png_______________________________________Whilst the security aspect is a background concern, these functional concerns are far more important to me. Because npm or some other system wasn't used, meteor is now an outlier and doesn't easily fit into most of my development flow. I've now been burdened with an external maintenance process that requires separate tools and workflow to accommodate.
Honestly, that's the biggest turn-off I have about meteor right now. Hopefully that will change before the big 1.0.
Compare it to alternatives like "gem install NAME_ANY_GEM_HERE", which also executes arbitrary code and which, for the typical Ruby/Rails developer, is totally impenetrable. (If you think otherwise, tell me, when's the last time you did a line-by-line audit of every single dependency prior to installing a gem?)
Even the embedded assumptions like e.g. the Rubygems server is, as of this instance, being operated by Rubygems and not being operated by The Adversary are really, really tenuous.
Why is there such a desire to do X in N minutes? How can something unique and truly useful come from 5 shell commands?
Hey, I can teach you the theory of relativity in 30 seconds: type this "e=mc2".
Me: But...but..how does this all work? Why?
Harvard University Press: Why? That's us! Dude check us out !! The 600 page book on the top rung with no cool memes and 1980 typeface. That's us.
But again, I'm being unfair. While what I said before still stands, there is the fact that I doubt anyone expects you to truly learn the framework in 5 minutes. It's just supposed to be an example of how easy it is to get started. And it works I guess. I personally have never gotten much out of the whole "X in Y time" genre of tutorials but I'm sure others do. Because I'm not new to programming I prefer to take my time and build out my own ideas as I follow these things. So while I read them I'm not actually following each step. I'm just understanding how you get from A to B, translating that to other tasks, and using pieces of the articles as I need them to suit my purposes if that makes sense.
So instead of the theory of relativity, how about using a calculator to do your taxes.
To use the calculator metaphor it would like saying: "enter 75345 + 3455 / 4, there's your taxes!"
meteor create --list
Personally, I think the `parties` example is a good one, so you can do: meteor create --example parties
Enjoy.So, given that common tasks become stone walled and meteor promises productive. I'm waiting for 1.0, meteor is all too young.
I do love some parts of the pattern. I'm surprised that it hasn't been done before; like years ago.
Part of this is because the Meteor use of reactive programming is very different.
Regarding the whining: projects like this take time and effort to create. Wanting something "a year ago" ignores the reality that this is what we have now, and for all it's warts, it's good!
It's basically an open-source HN clone built with Meteor, it's a good place to get an overview of the various features you need to build a useful app.
> This package is automatically configured to send emails (up to 300 per day) through Mailgun
I'm not sure I like having 'email' linked to a specific service. But maybe that's the Meteor way?
Do I have to install things like sendmail to make it work? If so that needs to be in the documentation.
Yes I did the meteor add email part, I followed every step.
It looks like you haven't actually deployed the code. Once deployed a free Mailgun account is created for you behind the scenes and assigned to your app. To test locally you need to create a Mailgun account and follow instructions from the "Extra optional step" section.
BR, Sergey
Brief example: A grocery list that both my wife and I are editing, deleting, adding, and re-arranging at the same time.
1) Teams who started with Mongo (which makes sense when your schema is still in flux and you are still feeling out what you want it to finally be) then stuck with it when they should have moved to an RDBMS due to their use case, but never did and then find out that Mongo doesn't support features that any RDBMS from the 90's would.
2) Old school RDBMS people who are, as Steve Yegge would say "software conservatives." They love the way RDBMS's force people to really put thought into their data modeling upfront, and believe that anything that allows people more flexibility is opening the door to increasing amounts of chaos. Plus they hate the thought of returning to the dark ages when databases didn't all use SQL, and everyone had to learn a new query language for a new DB.
FYI: I've heard Meteor is planning on allowing use of other databases. I would particularly be keen on use of RethinkDB. I really like what those guys have been doing so far.
RegUsers = new Meteor.Collection("regUsers");
RegUsers.insert({email:email});
Also that then, our present efforts and knowledge will be culturally relevant but totally unnecessary for developing great new generation apps ?
But...... we have what we have now, and we still code because we like it NOW, so we should accept the passing of time (and all evolutions it will bring) and think that we are still doing what we enjoy doing and that we have the luck of making a life out of it, possibly :)
Only moment to be concerned about the future is when they'll invent a time machine..
But to play devils advocate, if we were to create true artificial intelligence (I guess it would just be intelligence at that point) then not only would programmers be obsolete, but all of humanity would be obsolete. We'd all just be WALL-E style mouths to feed. This seems difficult to imagine, but we already see it happening in some ways. Unemployment is high almost everywhere and there's no fundamental economic law that every human on the planet can contribute sufficiently to match said human's consumption.
Essentially what this means is we have two pretty rough options. First, all of these people fall under the welfare state. The homeless and hungry all get what they need through governments, NGOs and charities. The other is the Darwinian approach, nature's great equalizer. Both of these options suck pretty hard, but that may be the world we're looking at until our robot overlords turn us into batteries (although it's more likely we'd become pets if anything at all).
If it's about Mailgun, you can get started for free without any configuration and if you want to send more than 300 emails/day later, you can create a mailgun account and easily integrate your own SMTP credentials into the app using the steps outlined in the blog.
This is tough for me to answer objectively, but I'll do my best.
Both services offer many of the same features and eliminate the pain of managing your own email server. Both services will achieve better deliverability at scale than managing your own server unless you know what you are doing and most people aren't interested in diving that deep into email.
Mailgun is very focused on serving developers and that guides our product roadmap. Therefore, we don't offer features like WYSYWIG newsletter creation tools. We build everything API first and we strive to make them RESTful, intuitive and well documented. Admittedly, our GUI / control panel is not the strongest part of the product. We also focus a lot on incoming email and we are pretty proud of our inbound email parsing through Routes. Mailgun is owned by Rackspace (acquired in Aug 2012).
Sendgrid is definitely the largest transactional email sender in the market. I recently read they do something like 7 billion emails monthly. They have more tools for non-developers like newsletter creators and support language wrappers that some developers prefer. They also offer inbound through their Parse App. Sendgrid is an independent, private company that has raised $27.4mm in funding according to Crunchbase [1].
My recommendation would be to try both - the docs are all online and both offer free plans to test with.
I did a quick try at it and ran into a 415 from couchdb, which means mailgun didn't send json. Is there a way to configure a route to do that? If not, I'll have to write a custom _update handler.
Support has been very lacking. At one point I had waited a long time (a week?) for a ticket response while they said they would investigate, and suddenly they just closed the ticket with no explanation. I felt like I had to fight to get any attention.
That said, its delivery seems reliable.
We have since switched to Mailgun for a lot of stuff, and will be migrating the rest soon. Mailgun has been rock solid from the start, the admin screens are fast, the APIs just make sense, and they were really responsive when we asked about a missing feature. Unlike SendGrid where the delivery log took ages to show results, Mailgun's equivalent page is really snappy. A big time saver when someone complains about not receiving a password or something.
Mailgun is also quite a bit cheaper.
EDIT: Usually it's the business monkey, UX snake oil guys and product leeches that say "Hey, that will only take like 5 minutes, right?"
― Carl Sagan, Cosmos
(This isn't a knock against Rails, it's just that five minutes barely gives you time to open the documentation and start to actually get an idea of how a library/framework is designed.)
Everytime I see a meteor post, I get the feeling the article is telling me I'd be a fool to use anything else.
Assuming that's so, can we start talking about things like PCI compliant meteor apps. And what the security landscape looks like since you can interact with the data store via your browser's javascript console.
Meteor has an "insecure" mode that is active by default where everything is published. Don't use that in production.
By default, Meteor is in a "development" mode where all the security is off while you get the app doing what you want on localhost. The security is implemented later by turning off the autopublish feature and using authentication at the pub/sub level in the "model" component of the MVVM stack. At this point, when you try to do what they do in the demo, and change data from the browser console, it will make the change in the client for a split second, but that change is rejected at the model level, and the client resyncs with the model and the change is undone in the view.
BTW, I only "learned" (i'm not at all an expert) Meteor a few weeks ago (although I've been following the project since they first announced it 10?? or so months ago.) It's actually pretty straightforward once you get the hang of it. But it is unmistakably a BIG FRAMEWORK in the Rails sense, whereas everyhing else in the Node world is truly modular in the Node fashion, with full transparency into what's going on. For people who like that, check out Derby, and it looks like there is some more stuff in the pipeline with Rendr by the dudes at AirBnB.
1. Flexibility: The tool has limited scope and has used this limited scope to make decisions for you; or
2. Maintenance: The tool uses code generation. Maintenance cost grows with the amount of code, indifferent to its origin (generated vs manual).
Rails, in particular, suffers from problem 2.