Category Archives: Internet & networks

DANG on a Cloud

Thats Django, ArchLinux ,Nginx and Gunicorn on an Amazon EC2instance.Getting a server to play around with root access courtesy of Amazon AWS is pretty easy, just sign up provide your credit card details and you are almost ready to go.First things first setting up the server.Theer are plenty of ready-made AMI images floating out there so one is really spoilt for choice , personally my preference is for Archlinux having run the rolling release distro as a primary dev machine for the better part of a decade it seemed right to give it a run as a production server.Loading the instance was pretty straightforward (instructions available on AWS blogs and forums).As with all good Arch systems getting it up to the latest version is as easy as:

pacman -Syu
once the changes have been made to the system and confirmed it time to setup the environment.The deployed app will be deployed within a virtualenv , this has the advantage of keeping the python installation of the app sand-boxed from that running on the system with a simple:

pacman -S virtualenv
then executing
virtualenv /path/to/apps -p /usr/bin/python2
source /path/to/apps/bin/activate
once created install the source control system of choice (assuming the app is being managed by one) or good old sftp can work just as well with filezilla .Once unpacked into its deployment folder
installing the project requirements is a case of :
pip install requirements.txt
pip install gunicorn.
As the gunicorn server will be running embedded from within the django app its a matter of adding it to the file and running it will be:

python run_gunicorn
The final part of the puzzle is the nginx server, lighter than the more resource hungry Apache and way simpler to configure with the editing of one file the nginx.conf to server the static assets from the project .
   upstream app_server {
server localhost:8000 fail_timeout=0;

server {
listen 80 default;
client_max_body_size 4G;
server_name _;

keepalive_timeout 5;

location /static/ {
autoindex on;
alias   /home/path/to/site_media/static/;

location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;

location @proxy_to_app {
proxy_pass_header Server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;

proxy_pass   http://app_server;

error_page 500 502 503 504 /500.html;


The gunicorn server will execute the python thread to a port that the nginx will listen to and server to the world your great new web-app hosted on amazon cloud.
Leave a comment

Posted by on February 11, 2012 in code, Internet & networks, Python


Tags: , , , , , ,

Mapping the Internet

When surfing the most annoying thing that ive had the displeasure of running into are the “nationwalls” that seem to be popping up with annoying frequency.Content that is on the web and essentially pat of a “network of networks” is increasingly starting to look like a fragmented postcolonial map or ?s that precolonial?Anyway something bad is happening and if it continues as it has there is he very likely possibility that what the internet will look like 10 years from now is not something we will like the look of.
The problem as i see it is borders and nationalism, from Wikipedia:

“Borders define geographic boundaries of political entities or legal jurisdictions, such as governments, sovereign states, federated states and other subnational entities. Some borders–such as a state’s internal administrative borders, or inter-state borders within the Schengen Area–are open and completely unguarded. Other borders are partially or fully controlled, and may be crossed legally only at designated border checkpoints.”

That mentality is increasingly being applied to the internet by a whole host of governments in what obviously an attempt to co-opt and establish de -facto controls on what should be an unfettered public resource.And by public i mean everyone from the US President to the littlest goat herder in the outback(yeah wireless net is where it’s at ).Media content providers like Hulu have been operating under this model for some time now , restricting content to geographically based ips resulting in the inevitable torrenting.For the most part it’s not Hulu’s fault , more like the content creators who are yet to realise that the game has changed and unless they change with it they may not survive.

The internet by connections

Solution?Some years ago in a pc mag i saw a map of what the writers of the time envisioned what the maps of the future would look like.Less of lines in the sand and more geographically dispersed nodes of similar interests.
Neither 19th-century balance-of-power politics nor 20th-century power blocs are useful in understanding this new world. Instead, we have to look back nearly a thousand years, to the medieval age in which cities such as Cairo and Hangzhou were the centers of global gravity, expanding their influence confidently outward in a borderless world. When Marco Polo set forth from Venice along the emergent Silk Road, he extolled the virtues not of empires, but of the cities that made them great. He admired the vineyards of Kashgar and the material abundance of Xi’an, and even foretold — correctly — that no one would believe his account of Chengdu’s merchant wealth.

Internet communities

And finally Einstein:
“we should be on our guard not to overestimate science and scientific methods when it is a question of human problems; and we should not assume that experts are the only ones who have a right to express themselves on questions affecting the organization of society”
We all have a stake in what happens next and if the debates about net neutrality in the States are any indication its a matter that cannot be left to the hands of either business interests or government bureaucracy because in either case the losers in the end will be the users.

Leave a comment

Posted by on September 2, 2010 in Internet & networks


Tags: , , ,

The future of the Social Network pt1


In an increasingly interconnected world a web presence is not only something to be desired it is absolutely necessary as envisaged by the multitude of networking sites littering the webspace.Discounting (or perhaps not) the 600 pound gorilla that is facebook , we have a bunch of up and coming contenders to the throne of social media like the appleseedproject and recently diaspora.

Watching a news blurb on the Bbc there was a talking head being interviewed and what he said struck me as quite succint , essentially he’s of the opinion that fb as a social network is unassailable by any competitors due to the massive userbase it commands and its momentum in adding hordes of new users.Th first thing I thought of was “thats what they were saying about Microsoft in the 90s” and look at where we are now with Oses a dime a dozen and something new getting remixed everytime a itch has to be scratched.The hi5’s and myspace’s cmae and went and increasingly in the area of the social webits all about having something relevant and innovative to offer your users.Acouple of years ago that position was held by facebook as evidenced by their successes to date, as all incumbents do though fb has gotten complacent as is self evident by the gripes userc shave with its quicksand of privacy debacles.

Not to seem to be ragging on fb others such as foursquare have also had their dark days.

From wired:

Foursquare is one of the most popular of a growing number of services that let people quickly report to friends, family or the entire world where they are — and is part of a growing trend of making public more information that used to be private. Foursquare’s popularity is tied to its game-like ecosystem, where users can win “badges” for certain actions or become the “mayor” of locations by checking in there more than any other users.

On pages like the one for San Francisco’s Ferry Building, Foursquare shows a random grid of 50 pictures of users who most-recently checked in at that location – no matter what their privacy settings. When a new check-in occurs, the site includes that person’s photo somewhere in the grid. So Andersen built a custom scraper that loaded the Foursquare web page for each location in San Francisco, looked for the differences and logged the changes.

Whikle tools like openid exist out there their uptake with the general users is pitifully slow and still doesnt address the fact that for every site you log into you leave a trail of breadcrumbs about yourself and given sufficient motivation there are those online that will make use of it(see rule 34 of the internets).

Or another case:

Since Facebook changes its security policies about every 3 seconds, your worries are not limited just to someone seeing a post and telling someone else. In fact, personal pages on sites like LinkedIn, Twitter, and Facebook rank pretty high in Google searches. So that means that a potential employer who’s looking at your resume could also be finding out via social networking about your membership in that Neo-Nazi Glee Club even though your account settings are “Friends only.” (Studies show that 78% of recruiters use Google to research job candidates and social networking sites rank very highly on Google.)

And don’t forget that Facebook is like “Six Degrees of Separation” on Barry Bonds-grade steroids. Even if you make a comment on someone else’s page, THAT person’s friends will see it, and then every friend of those friends will see it, etc.

Thus the question becomes how do we interactwith the social network and the internet at large , it is possible to have as many email accounts and login details as you feel you need to remain aanonymous but that is a cumbersome and highly impractical solution that ends up defeating itself in the long run , case in point which account did you use to login to a particlar site and do you have multiple account on a particular site because you forgot you were already logged on.

Additonally do you trust the custodian of your online identity to be discreet and mindful of your needs , as with most corps the larger percentage of online entities are more interesrted with the bottom line than with any ideological concerns.This is taken from the latest revision of the facebook TOS(emphasis mine):

  • For content that is covered by intellectual property rights, like photos and videos (“IP content”), you specifically give us the following permission, subject to your privacy and application settings: you grant us a non-exclusive, transferable, sub-licensable, royalty-free, worldwide license to use any IP content that you post on or in connection with Facebook (“IP License”). This IP License ends when you delete your IP content or your account unless your content has been shared with others, and they have not deleted it.
  • When you delete IP content, it is deleted in a manner similar to emptying the recycle bin on a computer. However, you understand that removed content may persist in backup copies for a reasonable period of time (but will not be available to others).
  • When you publish content or information using the “everyone” setting, it means that you are allowing everyone, including people off of Facebook, to access and use that information, and to associate it with you (i.e., your name and profile picture).

You agreed to all of the above by simply clicking on that sign up button , to be honest not a great many users read through all the privacy policies when signing up trusting to the vendor that their rights will not be violated,the preceeding chunk of legalese confers upon fb a whole host of rights that most users properly informed would think twice and then think about it once more.

What im advocating for is nothing new and there art ecountless articles online eschewing the importance of gopd data custodianship and efficient privacy controls that are understandable by users.What is lacking is a ubiquity in the implementation of a system that allows a user achieve three things without too much of a hassle.A user should be able to:

  1. .Choose what aspects of their personal data is available to online vendors
  2. .The ability to select the custodian of their data annd have an open framework to change them as they deem fit
  1. Make it as simple as possible for novice users to manage and organise their online presence

In order to foster adoption and faster uptake of such a system an open model is to be preferred to allow as much of a open community of developers and users to take advantage of it.

The first two I would consider the most important and serious issues to be tackled, so I shall try and give a brief of what I see as their role in social network webscape.


Leave a comment

Posted by on July 22, 2010 in Internet & networks


Tags: , ,