2011-07-17 10:59:59 -07:00
# NewsBlur
2013-04-12 10:11:21 -07:00
* NewsBlur is a personal news reader bringing people together
to talk about the world. A new sound of an old instrument.
* [www.newsblur.com ](http://www.newsblur.com ).
2011-07-17 10:59:59 -07:00
* Created by [Samuel Clay ](http://www.samuelclay.com ).
* Twitter: [@samuelclay ](http://twitter.com/samuelclay ) and
[@newsblur ](http://twitter.com/newsblur ).
## Features
2013-04-30 01:14:38 -03:00
1. Shows the original site (you have to see it to believe it).
2011-07-17 11:00:36 -07:00
2. Hides stories you don't want to read based on tags, keywords, authors, etc.
3. Highlights stories you want to read, based on the same criteria.
2011-07-17 10:59:59 -07:00
## Technologies
### Server-side
2011-07-17 11:34:38 -07:00
* [Django ](http://www.djangoproject.com ): Web framework written in Python, used
to serve all pages.
* [Celery ](http://ask.github.com/celery ) & [RabbitMQ ](http://www.rabbitmq.com ):
Asynchronous queueing server, used to fetch and parse RSS feeds.
* [MongoDB ](http://www.mongodb.com ), [Pymongo ](http://www.mongodb.com/pymongo ), &
[Mongoengine ](http://www.github.com/hmarr/mongoengine ): Non-relational database,
used to store stories, read stories, feed/page fetch histories, and proxied sites.
* [PostgreSQL ](http://www.postgresql.com ): Relational database, used to store feeds,
subscriptions, and user accounts.
2011-07-17 10:59:59 -07:00
### Client-side and design
2011-07-17 11:34:38 -07:00
* [jQuery ](http://www.jquery.com ): Cross-browser compliant JavaScript code. IE works without effort.
* [Underscore.js ](http://documentcloud.github.com/underscore/ ): Functional programming for JavaScript.
Indispensible.
2011-07-17 10:59:59 -07:00
* Miscellaneous jQuery Plugins: Everything from resizable layouts, to progress
bars, sortables, date handling, colors, corners, JSON, animations.
[See the complete list ](https://github.com/samuelclay/NewsBlur/tree/master/media/js ).
2010-02-14 22:53:51 -05:00
2011-07-17 11:31:07 -07:00
## Installation Instructions
2011-07-17 15:30:25 -07:00
### Prerequisites
2011-07-17 11:31:07 -07:00
2011-07-17 21:50:37 -07:00
#### Relational Database (MySQL, PostgreSQL)
2011-07-17 13:48:53 -07:00
2013-04-30 01:14:38 -03:00
You will want to have your database set up before you begin installation. Fabric can install
2011-07-17 13:48:53 -07:00
both PostgreSQL and MongoDB for you, but only on Ubuntu. Mac OS X users will want to have
2011-07-17 15:52:06 -07:00
MySQL or PostgreSQL already installed. You can [download MySQL ](http://dev.mysql.com/downloads/mysql/ )
2011-07-17 13:48:53 -07:00
or [download PostgreSQL ](http://www.postgresql.org/download/ ). Additionally,
2011-07-17 15:52:06 -07:00
if running as a development machine on Mac OS X, I would recommend using MySQL with
2011-07-17 13:48:53 -07:00
[Sequel Pro ](http://www.sequelpro.com/ ) as a GUI.
2011-07-17 15:52:06 -07:00
If you are installing MySQL, you will also need the MySQLDB python library:
sudo easy_install mysql-python
2011-07-17 13:48:53 -07:00
#### Fabric
2011-07-17 11:31:07 -07:00
Both Mac OS X and Linux require [Fabric ](http://docs.fabfile.org/ ) to be installed.
Many common tasks, such as installing dependencies, deploying servers, migrations,
and configurations are in `fabfile.py` .
sudo easy_install fabric
On recent installations of Mac OS X using XCode 4, you may run into issues around the
`ppc` architecture. To fix this, simply run:
2011-07-17 15:30:25 -07:00
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc \
/Developer/usr/libexec/gcc/darwin
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc \
/usr/libexec/gcc/darwin
2011-07-17 11:31:07 -07:00
Sym-linking the ppc architecture comes from this StackOverflow answer on
2011-07-17 15:30:25 -07:00
"[assembler for architecture ppc not installed on Mac OS ](http://stackoverflow.com/questions/5256397/ )".
2011-07-17 11:31:07 -07:00
2011-07-17 15:30:25 -07:00
#### MongoDB
2011-07-17 15:52:06 -07:00
On top of MySQL/PostgreSQL, NewsBlur uses MongoDB to store non-relational data. You will want to
2011-07-17 15:30:25 -07:00
[download MongoDB ](http://www.mongodb.org/downloads ). If you are on Ubuntu, the `setup_mongo` Fabric
command will automatically do this for you, but Mac OS X needs to have it installed manually.
2011-07-17 21:29:25 -07:00
#### Numpy and Scipy
Not the easiest to get installed. If you are running Mac OS X, you have a few options:
2012-01-23 13:07:59 -08:00
* Use the [Superpack by Chris Fonnesbeck ](http://fonnesbeck.github.com/ScipySuperpack/ )
2011-07-17 21:29:25 -07:00
* Use MacPorts: `sudo port install py26-numpy py26-scipy`
* Install from source (grueling): [http://www.scipy.org/Download ](http://www.scipy.org/Download )
2012-05-22 19:10:11 -07:00
* Use a combination of pip, easy_install, and [homebrew ](http://mxcl.github.com/homebrew/ ): `pip install numpy && brew install gfortran && easy_install scipy`
2013-04-27 15:09:44 -04:00
#### Other assorted packages
From inside the repository, run:
pip install -r requirements.txt
2011-07-17 21:29:25 -07:00
2011-07-17 15:52:06 -07:00
### Configure paths
In `fabfile.py` there are two paths that need to be configured.
* `env.paths.NEWSBLUR` is the relative path to the NewsBlur repository.
* `env.paths.VENDOR` is the relative path to where all downloaded code should go.
In `local_settings.py` there are a few paths that need to be configured. Configure
these after the installation below.
2011-07-17 15:30:25 -07:00
### Installing on Mac OS X
2011-07-17 11:31:07 -07:00
2011-07-17 20:53:30 -07:00
1. Using Mac OS X as a development environment, you can run all three servers (app, db, task)
on the same system. You should have [Fabric ](http://docs.fabfile.org/ ) installed to run
the `fabfile.py` . You should also have MySQL/PostgreSQL and MongoDB already installed.
fab -R local setup_python
2011-07-17 21:29:25 -07:00
fab -R local setup_imaging
2011-07-17 20:53:30 -07:00
fab -R local setup_mongoengine
fab -R local setup_forked_mongoengine
fab -R local setup_repo_local_settings
2012-05-22 19:10:11 -07:00
fab -R local compress_assets
2011-07-17 12:08:24 -07:00
2011-07-17 20:53:30 -07:00
If any of the packages fail to install (`lxml` , for instance), look through `fabfile.py`
and check if there is a function that can be used to circumvent broken easy_install
processes. For example, lxml may need libxslt and libxml2 to be installed. This is
automated with the following Fabric command:
fab -R local setup_libxml_code
2012-05-22 19:10:11 -07:00
2. Configure MySQL/PostgreSQL by adding in a `newsblur` user and a `newsblur` database. Here's an example for MySQL:
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/path/to/var/mysql --tmpdir=/tmp
mysql.server start
mysql -u root
> CREATE USER 'newsblur'@'localhost' IDENTIFIED BY '';
> GRANT ALL PRIVILEGES ON *.* TO 'newsblur'@'localhost' WITH GRANT OPTION;
> CREATE DATABASE newsblur;
> exit
2011-07-17 20:53:30 -07:00
Then load up the database with empty NewsBlur tables and bootstrap the database:
./manage.py syncdb --all
./manage.py migrate --fake
2013-04-27 14:30:39 -04:00
./manage.py migrate
2011-07-17 20:53:30 -07:00
./manage.py loaddata config/fixtures/bootstrap.json
If you don't create a user during `syncdb` , the `bootstrap.json` file will create a
newsblur user with no password.
2012-05-22 19:10:11 -07:00
3. Start mongodb (if not already running):
mongod run
4. Run the development server. At this point, all dependencies should be installed and no
2011-07-17 20:53:30 -07:00
additional configuration is needed. If you find that something is not working at this
point, please email the resulting output to Samuel Clay at
2012-06-20 18:37:46 -07:00
[samuel@newsblur.com ](samuel@newsblur.com ).
2011-07-17 20:53:30 -07:00
./manage.py runserver
2013-04-27 15:09:44 -04:00
5. Navigate to:
http://localhost:8000/
Create an account. At the end of the account creation process, you
will be redirected to https://localhost/profile/stripe_form. Hit
the back button a few times, and you will be inside the app.
2011-07-17 11:31:07 -07:00
2011-07-17 15:30:25 -07:00
### Installing on Linux / Ubuntu
2011-07-17 11:31:07 -07:00
2013-04-30 01:14:38 -03:00
If you are on Ubuntu, you can simply use [Fabric ](http://docs.fabfile.org/ ) to install
2011-07-17 11:31:07 -07:00
NewsBlur and its many components. NewsBlur is designed to run on three separate servers:
an app server, a db server, and assorted task servers. To install everything on a single
machine, read through `fabfile.py` and setup all three servers without repeating the
`setup_common` steps.
2011-07-17 15:52:06 -07:00
### Finishing Installation
You must perform a few tasks to tie all of the various systems together.
1. First, copy local_settings.py and fill in your OAuth keys, S3 keys, database names (if not `newsblur` ),
task server/broker address (RabbitMQ), and paths:
2011-07-17 21:50:37 -07:00
cp local_settings.py.template local_settings.py
Edit local_settings.py to change any keys that you have.
2011-07-17 15:52:06 -07:00
2011-07-17 21:50:37 -07:00
2. Create the `newsblur` database in MySQL/PostgreSQL
2011-07-17 15:52:06 -07:00
#### MySQL/PostgreSQL
./manage.py syncdb
2011-07-17 21:50:37 -07:00
2011-07-17 15:52:06 -07:00
2011-07-17 11:31:07 -07:00
#### App server
2011-07-17 11:34:38 -07:00
2011-07-17 13:48:53 -07:00
fab -R local setup_app
2011-07-17 11:31:07 -07:00
#### Database server
2011-07-17 11:34:38 -07:00
2011-07-17 13:48:53 -07:00
fab -R local setup_db
2011-07-17 11:31:07 -07:00
#### Task server
2011-07-17 11:34:38 -07:00
2011-07-17 13:48:53 -07:00
fab -R local setup_task
2011-07-17 11:31:07 -07:00
2011-07-17 21:00:15 -07:00
## Keeping NewsBlur Running
These commands keep NewsBlur fresh and updated. While on a development server, these
commands do not need to be run more than once. However, you will probably want to run
the `refresh_feeds` command regularly so you have new stories to test with and read.
### Fetching feeds
If you just want to fetch feeds once, you can use the `refresh_feeds` management command:
2011-07-17 21:50:37 -07:00
./manage.py refresh_feeds --force
2011-07-17 21:00:15 -07:00
You can also fetch the feeds for a specific user:
./manage.py refresh_feeds --user=newsblur --force
### Feedback
To populate the feedback table on the homepage, use the `collect_feedback` management
command every few minutes:
./manage.py collect_feedback
### Statistics
To populate the statistics graphs on the homepage, use the `collect_stats` management
command every few minutes:
./manage.py collect_stats
2011-09-01 09:11:29 -07:00
### Running unit and integration tests
NewsBlur comes complete with a test suite that tests the functionality of the rss_feeds,
reader, and feed importer. To run the test suite:
./manage.py test --settings=utils.test-settings
2011-07-17 21:00:15 -07:00
2011-07-17 21:03:31 -07:00
## Author
* Created by [Samuel Clay ](http://www.samuelclay.com ).
2012-06-20 18:37:46 -07:00
* Email address: < samuel @newsblur .com >
2011-07-17 21:03:31 -07:00
* [@samuelclay ](http://twitter.com/samuelclay ) on Twitter.
2010-06-28 12:39:41 -04:00
2011-07-17 21:03:31 -07:00
## License
2010-06-28 12:39:41 -04:00
2013-04-30 01:12:35 -03:00
NewsBlur is licensed under the MIT License. (See LICENSE)