months ago i’ve insulted rails and the gang of retards that tweet and shime about that defacto standard of shit. anyway check this beauty
i almost certainly laugh at 99% of rails developers including prima donna dhh and his nephew patrik lenz.
real quick patch for uWsgi to compile on OpenBSD current.
- first get into your python 2.7.x virtualenv or have your path well set up. i’ve built the sucker for Python 2.7.2 and 2.7.3, i didn’t try for the 3.2 series.
- second download and extract the source or $ pip install uwsgi this should get you uWsgi 1.0.4
now the tweaks as you should be getting compiler warnings and errors with uWsgi logging module. the quick fix is below
$ cd your_virtualenv or your extracted source dir
if using pip $ cd build/uwsgi
first fix the bugs in line 197 and 199, the correct code is below
197 struct kinfo_proc *kproc2; 198 199 kproc2 = kvm_getprocs(kv, KERN_PROC_PID, uwsgi.mypid, sizeof(struct kinfo_proc), &cnt);
we’re not done yet, we have to provide openbsd kvm_getprocs definition by adding the related header files.
add these 2 includes after line 4
#include <sys/param.h> #include <sys/sysctl.h>
and that’s it for this specific bug, i’d recommend you audit the code though and get rid of the dangerous tmpnam(), strcpy(), strcat() and sprintf() and replace them with their openbsd secure counterparts. anyway you now have a working uwsgi 1.0.4 on OpenBSD.
The professor stood before his philosophy class and had some items in front of him. When the class began, wordlessly, He picked up a very large and empty mayonnaise jar and proceeded to fill it with golf balls.
He then asked the students, if the jar was full. They agreed that it was.
The professor then picked up a box of pebbles and poured them into the jar. He shook the jar lightly. The pebbles rolled into the open Areas between the golf balls.
He then asked the students again if the jar was full. They agreed it was.
The professor next picked up a box of sand and poured it into the jar. Of course, the sand filled up everything else. He asked once more if the jar was full. The students responded with a unanimous ‘yes.’
The professor then produced two cups of coffee from under the table and poured the entire contents into the jar, effectively filling the empty space between the sand. The students laughed.
'Now,' said the professor, as the laughter subsided, 'I want you to recognize that this jar represents your life. The golf balls are the important things - family, children, health, Friends, and Favorite passions – Things that if everything else was lost and only they remained, Your life would still be full.
The pebbles are the other things that matter like your job, house, and car.
The sand is everything else —The small stuff.
'If you put the sand into the jar first,' He continued, 'there is no room for the pebbles or the golf balls. The same goes for life.
If you spend all your time and energy on the small stuff, You will never have room for the things that are important to you.
ps. i didn’t write this and i’ll share my insight on it with you as soon as i’ve got my ‘balls’ in order.hehe
let’s start with the most vocal
RoR or Ruby on Rails… as much as i love ruby, as much as i find rails a piece of shit and it’s fanatic vocalist ridiculous. why : slow, pms’y (as in opinionated), memory hog, crappy integration with webserver, it’s magic feature ORM/active record is now available anywhere else. so yeah RoR needs a quad core 8Gb RAM application server to run a prototype and it really doesn’t run unless you call an insecure yet slow memory hog that you have to keep on killing and restarting a framework. it’s a pity that a beautiful language like ruby is tainted by a thing like rails. if you need the beautiful syntax use python and django, not sure how’s zope doing now but it used to be a serious guy 10+ years ago.
Django/Python : beautiful, alot of magic (so ymmv) need wsgi which is a stupid piece of shit as well, but if you get it on a full server you should have something close to a good opinionated framework.
Pyramid/Python : this stuff is just pure perfection. I won’t say anything more.
Webob, routes, mako / Python : loosely coupled stack that’s very close to Pyramid and you’ve got full control here, the advantage is clear your in power, disadvantage is all the wiring, deployment etc. nevertheless with wtforms, mongokit, gevent this becomes something on steroid better than node.js and all the hype stuff.
Perl : in the old days there was CGI, today I really don’t know. I wouldn’t recommend it anyway.
Lua : a beautiful language I use alot, no web framework for it per se, i’ve seen clever implementation dating 3 and 4 years ago and they probably could get you going far, check nanoki or other smart stuff coded by smart people, if you don’t want to get your hands dirty coding internals and want the heavy lifting mostly set up for you, avoid lua for now.
Seaside/Smalltalk : very beautiful but doesn’t power real life scenarios and no data persistence without extreme headache. If you have time to spare this could be a hobbyist framework, nothing more.
Lift/Scala : this thing revolutionized webframeworks and helped shut up the rails cyber parasites once and for all. Scala is lovely, Lift is a solid contender except I really hate the syntax and especially the class naming that resemble java, for that and for the not so trivial deployment (servlet, containers and all the java crap…) i’d only recommend it for entreprise development, forget rapid prototyping etc. also keep in mind that you’ll need tons of closure to serialize forms input in case you have a horizontal deployment (really messy).
Tons of so called frameworks/PHP : first anything that’s PHP and not OOP got to be burned. Only after that, PHP becomes the defacto language of dynamic server generated html pages that it always have been full stop. The problem with php is the quality of so called php apps that are around including the most popular ugly piece of software online today that’s Wordpress. From PHP 5, OOP is here, PHP 5.3 we even get closures, lambdas etc. and in 5.4 traits are here so this makes PHP a capable guy on par with Python, Ruby etc. in addition it’s faster than both of those two and when used with APC is quiet unbeatable (facebook uses what?) and in addition to that PHP deployment is a breeze, you can’t get tighter to a webserver. So PHP is brave, it’s syntax is quiet shitty nevertheless and for frameworks well you have the choice to go Zend for “entreprisy” as they’ve got everything covered and it’s just too much code covering everything stupid, or you can go clever even very clever
i personnaly recommend only 2 contenders here: the trusted one : Kohana (ko3) beautiful, rigid, secure, verbose and just rock solid. the challenger: Lithium (li3) a piece of innovation, something clever, decoupled on purpose, very tolerant, fluid as in many things.
both require dedication reading the source files because of poor documentation, lithium is my favourite today in the php world, it comes nevertheless with some shortings
-no relationship for mongodb (you have to hard code all business logic and make sure to enforce it and that requires a great level of model design and solid OOP background to nail it clean and DRY)
-very opinionated when it comes to Databases and Datasources, you sometime will wish to bypass the wrappers altogether (but then what’s the point of using a framework?)
-the same old problem with PHP, verbose templating. Lithium’s helper functions are either plain dumb or very opinionated, you can either extend or customize, the first option again require alot of thinking and design, the second is so verbose and repetitive you’ll just want to cry. Another route is to go with an external templating library today in the PHP world you’ve got Mustache and Twig and many in between, the two extreme templating engines are suitable for two different worlds and you shall chose, i use both but having them work together asks for solid design, what’s the reward you ask? ux designers that won’t fuck up with business logic. what’s the price, a complete redesign of the request-controller-action-dispatcher-renderer flow, by the way lithium is beautiful in here as it lets you filter after, during and before with beautiful closures which are going to ease the overall pain of this process.
So at the end using lithium is asking for spaghetti and different integration points, but that’s what lithium developers praise, spaghetti makes for a delicious and fast meal and are perfect to RAD and prototyping. Whether you need more structure and probably other kind of headaches there’s Kohana who’s very rigid, only complain about Kohana is that they keep changing the response class names from minor release to minor release plus small shortages here and there.
Opa/OCaml : strongly typed web framework, finally… this guy is new and capable, it already found use in poker sites etc. the architecture’s quiet rigid and comes with the web, app, db servers tightly coupled. never really used it but i’ve researched it and it is promising, my only concern is the syntax style but i’m hearing they are fixing it altogether because it was really a joke just by reading the libraries etc. never thought you could do worse than java syntax wise, well Opa did other than that it’s quiet smart and depending on the spread it might evolve to something very promising.
We could go on and on in the neverending review of web frameworks, but at the end all frameworks suck. some suck less and are capable, well documented, easy to deploy, easy to try and furthermore keep a certain consistency. you’ve got to choose wisely and for every new project/start-up the freedom you have to choose is priceless even if sometimes we as businessmen, developpers, hackers or whatever you call yourself don’t cope well with the clutter and information overload freedom opens up for us. the decision is important and the time spent deciding as well. choose wisely.
and just for the sake of it, here’s the conclusion dated 12.2011
- if you want the best : Pyramid
- if you want speed and need PHP : Lithium or Kohana
- if you want entreprise : Lift
- if you want pythonic : Django
- if you want shit for buzz : Rails
- if you want something else : Node.js + Express.js
the goal as mentioned in the post below is to install npm (node package manager) as user so no sudo and risky stuff with experimental apps.
- git the source from https://github.com/isaacs/npm
- fix ./npm/lib/utils/tar.js
Line 91 : replace "-T" by "-I" Line 199 : replace "-zmvxpf" by "xvfz"
- now build npm and install it in your ~/bin folder if that’s where you already installed node.js and move around the directories so that your lib structure is neat.
#install npm $ node cli.js install -gf
I’d suggest you install in a tmp dir and check the lib structure and move it to your local ~/bin folder it should be straightforward with 2 or 3 copy move.
we ported the node.js 0.6.1 to openbsd and my only concern was to provide a way not to install as root as the js dudes around will just tell you
it but that’s dangerous especially giving a look at the quality of the code of both node.js and npm, the latter is just ridiculous but hey it kind of works so… just install as user and don’t be sorry
sudo make install
- for node, get the port patch or git the port wip from my crew here
$ cd $ git clone https://github.com/firemyst/openbsd-wip
- backup the old port for node and replace it with the new one
$ mv /usr/ports/www/node/ /usr/ports/www/node.old/ $ mv ~/openbsd-wip/www/node/ /usr/ports/www/node/
- build the port
$ cd /usr/ports/www/node/ $ make
- install a fake (an install without root)
$ make fake
- bring the newly build node to your homedir/bin
$ cd # optional $ mkdir bin # install node locally $ cp /usr/ports/pobj/node-0.6.1/fake-i386/usr/local/bin/node/* bin/ $ cp -R /usr/ports/pobj/node-0.6.1/fake-i386/usr/local/include/ bin/ $ cp -R /usr/ports/pobj/node-0.6.1/fake-i386/usr/local/lib/ bin/ # optional add ~/bin to your path global in ~/.profile
tomorrow i’ll hint on npm, it’s easier than node if you know how to fix the tar arguments in its utterly stupid install script
PS. you’ll have to follow the port/package faq of OpenBSD to set your group and /usr/ports permission right to be able to make and make fake with a regular user of the wsrc group. i suppose this is something trivial for an OpenBSD user or even newbie.
this aims for a very lean install of php and mongo on openbsd (dated 11-2011)
so real quick without pear, pecl and unnecessary garbage -install or upgrade to your preferred openbsd flavor (stable, release, current)
$ sudo pkg_add -vi php $ sudo pkg_add -vi mongodb
this should get you php 5.3x and mongo 2.0.x cool isn’t it,
load php into apache
$ sudo cp /var/www/conf/modules.sample/php-5.3.conf /var/www/conf/modules/ $ sudo cat "<? php phpinfo(); ?>" > /var/www/htdocs/info.php $ sudo /usr/sbin/apachectl restart $ lynx http://127.0.0.1/info.php
great now php is rendered through apache
let’s bridge mongo to php via the mongo php driver git the source or dowload the tarball from https://github.com/mongodb/mongo-php-driver unpack it
$ tar xvfz mongodb-mongo-php-driver-xxxxx.tgz $ cd mongodb-mongo-php-driver-xxxxx
now the fun : the autoconfig and shit won’t let you move on and you’ve got to read the errors first it will whine aubout autoconf so you install it
$ sudo pkg_add autoconf
then it’ll cry about autoconf_version so you tell it
$ env AUTOCONF_VERSION=2.68 phpize-5.3
it’ll prepare for ./configure but will whine about php-config so you feed it
$ ./configure --with-php-config=php-config-5.3
ready for make so you
it’ll spit a mismatched quote syntax error at you you have to fix this one by editing the makefile
$ mg Makefile
you’ll find the quote problem midway in the file with the build flags/command line, fix it by removing the orphan -I/Util” (til the quote) and save Ctrl X+C
this should compile the driver quiet fast with no major errors
$ ls modules/
you shall see the mongo.so module that you’ll have to hook up to php by
$ sudo make install $ sudo mg /etc/php-5.3.ini
add a line to tell php it has to load the mongo module we’ve just built inputing this line somewhere in the file
how sweet! let’s now restart apache/httpd to make it load php with the mongo driver
$ sudo apachectl restart $ lynx http://127.0.0.1/info.php
scroll to the mongo section you shall see the driver loaded, if mongod is running you’ll see info about the db, to start mongo create the db folder and run the deamon
$ cd $ mkdir -p data/db $ mongod --dbpath data/db &
hope this helps, no need for pecl, pear and stupid libraries. enjoy lean mongo, secured php 5.3 on chrooted apache with the best puffy of OpenBSD
add-on 11/18/11 b/c i received a couple questions on bugs, well actually there aren’t
httpd would/could whine about pthread and the mongo.so uses them if you can’t connect to the db from php check your httpd error file
$sudo less /var/www/logs/error_log
$sudo LD_PRELOAD=/usr/lib/libpthread.so.13.1 apachectl start
anyway sysvsem semaphores are defaulted in openbsd’s httpd instead of POSIX pthreads.
Meeting Tumbler Lyon Rejoignez nous au Broc Bar Rue de la Platrière Lyon 1er à 19h le Samedi 1er Mai 2010
- Back from NYC in Europe for 1 month