5 ms·
A Docker-inspired Heroku clone in 100 lines of PHP
- pavel_lishin 11y agohttps://gist.github.com/igorw/1d67f422689017e814a8#file-app-php-L49 https://gist.github.com/igorw/1d67f422689017e814a8#file-app-... Is it possible to craft a zip file that will write data to parent directories, or an explicit path?
- CaveTech 11y agounzip intentionally prevents such from happening. So while you could make a .zip file that intends to do that, you need an unzipping tool that would actually allow it.
- tlrobinson 11y agoWho cares about a possible directory traversal when the entire purpose of this is to run arbitrary code? It doesn't appear to attempt to sandbox the uploaded code at all. This is obviously not meant to be exposed to untrusted parties.
- rand1012 11y agoI have never found "X lines of code" to be impressive. Write clean code and polish it and make it readable. Who cares how long it is. Hackers brag about lines, not engineers.
- gkoberger 11y agoThe actual number doesn't matter. It's just shorthand for "It's easy and quick! This isn't a mammoth 10k-line library".
- mbreese 11y agoIt's also shorthand for "doesn't have feature X or support Y and hasn't really been tested!"
- diggan 11y agoWell, could be a reason this place is called Hackers News rather than Engineers News
- georgestephanis 11y agoIn only 100 lines of PHP! Requires Symfony.
- MichaelApproved 11y agoRequiring libraries/frameworks shouldn't detract from something like this. I'd be more worried about bugs and feature support.
- ihsw 11y agoNah, requiring Symfony is like requiring Django. Doesn't make much sense.
- deleted 11y ago[deleted]
- mod 11y agoIt's actually Silex. Maybe that makes more sense.
- aikah 11y agoSilex is hardly a "micro framework", it's basically Symfony without the configuration files. So it's a LOT of code. I like it by the way, always hated the Spring like insanity of Symfony, but let's not pretend Silex + all Symfony libs the framework has to import are small. The irony is that for this very project, Both Silex and Symfony\Process are completely redundant, especially with PHP bloated core APIs.
- Gigablah 11y agoThat's not correct. Silex replaces the Symfony DI (or service locator, if you will) component with something much simpler called Pimple. You can read the code within a few minutes. The only other required libraries for Silex to function are the event dispatcher, routing (which you can swap out for something like nikic/FastRoute), and the request/response stuff. I'm not sure if you think that's a "lot" of code, but if you're rolling your own you'd probably end up using the HTTPFoundation stuff anyway.
- mmanfrin 11y agoPeople like to specialize and seek extremes of different metrics. Do you think that the demoscene is not impressive because they could do much more with more than 4k of code? This comment is an example of the type of negativity that is unhelpful and creates the toxic atmosphere HN is renown for, and I believe you know that considering you posted with a throwaway.
- khwhahn 11y agoWhat about dokku...loads of plugins and easily extendable.... https://goo.gl/JzMstI https://goo.gl/JzMstI
- simonpantzare 11y agoI have been playing with Dokku lately. I ran into some problems with the Dockerfile mode (creates tags like myapp:latest but then tries to start dokku/myapp:latest) and the CLI not parsing arguments correctly (had to put extra " chars in strange places). Perhaps the Procfile mode is more polished. Would like to know if there are any alternative single-host PaaSes out there to use for side projects.
- infecto 11y agoDid you create github issues for these? Dokku is an active project that gets a lot of attention. IMO this is currently the best solution for small scale projects.
- savant 11y ago+1 As one of the dokku maintainers, I would love to see any random issues fixed. Feel more than free to open an issue on our tracker[1] and I'll be sure to comment. FWIW space processing in command line args is a bit... difficult given our mode of transport (ssh). This is something we're thinking about fixing somehow, though there isn't a great solution yet. [1] https://github.com/dokku/dokku/issues https://github.com/dokku/dokku/issues
- matthewcford 11y agoOr use convox https://convox.com/ https://convox.com/
- tylermauthe 11y agoIs this real or ironic?
- Perihelion 11y agoFirst one, then the other.
- deepflame 11y agoHmm, but this only runs PHP projects if I understand the code correctly.
- guillegette 11y agoI would add that when you use a framework not sure if the 100 lines actually counts
- kenshaw 11y agoDokku is more complete, and works more or less just like Heroku. It's written in Bash and uses Docker for containers.
- jacques_chester 11y agoI work on the fringes of what is, arguably, a Heroku alternative. Heroku does slightly more than stage and place apps, guys.
- synchrone 11y agoAm I the only one who noticed `php -S` is used, which is a debug server, not intended even for testing purposes? One cannot seriously consider this for anything except a proof that basic utilities like zip, netcat, supervisord and php can be scripted with a higher-level language to hack together something that somehow works. That being said, I like this cool hack.