Not that it should be a surprise, but Preposterous runs great on the Raspberry Pi . Since it doesn’t need a database or web application server, the memory-constrained environment of the Raspberry Pi doesn’t hold back Preposterous’s performance at all.
At some scale, the throughput of the USB-based network interface would probably begin to slow things down, or perhaps the speed at which files on the SD card can be accessed, but “seat of the pants” performance seems almost on- par with remote servers (i.e., across a Internet link), even for audio or video.
If you want to try this yourself, the setup is very straightforward and the standard Raspian distro includes everything you’ll need to get started using the steps below:
Create email box to receive posts
This can be a simple free gmail account, or any other service that provides IMAP access.
Clone the github repo
Issue the command below anywhere you like (probably easiest to do in your home directory if you don’t have something else in mind):
git clone https://github.com/jjg/preposterous.git
Create the web root
This is a folder where the blog files will be stored. If you don’t already have a webserver installed, this can go anywhere (the easiest place to get started is to create a directory inside the Preposterous directory you made in the previous step):
Copy the config
Copy the preposterous.cfg.template file to preposterous.cfg:
cp preposterous.cfg.template preposterous.cfg
Edit the config
Open preposterous.cfg in your favorite editor and fill in the blanks. Here’s a brief description of each parameter:
imap_server: _address of imap server, for gmail it’s imap.gmail.com _
smtp_server: _address of smtp server, for gmail use smtp.gmail.com _
smtp_port: smtp server port, for gmail use 587
email_address: email address the server will use to receive posts
email_password: password for above email address
web_hostname: name of this device, either a DNS name or IP address
web_filesystem_root: path to where blog files should be stored
For example, here’s what the config looks like on my test Pi:
Initialize the site
Send a test post to the email address you created above and then run the following command inside the Preposterous directory:
After a few minutes you should get back your prompt and you can move on to the next step. If you receive any errors, double-check your configuration file, and if things still don’t work, let us know. You should also receive an email back from the server that includes a link to your new blog’s index, and a second message linking to the post itself. Of course these links won’t work until you have a running webserver…
Run the web server
For testing, we can use Python’s built-in web server (and for most things Pi- related, it’s probably sufficient). Run the following command inside the “web root” folder you specified in the config:
python -m SimpleHTTPServer
Now point a browser at the IP address of your Raspberry Pi and include the port of the SimpleHTTPServer (by default this is port 8000). The URL should look something like this:
With any luck you’ll be greeted with the Preposterous server index page and a link to the blog you created by sending that initial email.
To make the server operate in an ongoing fashion, you’ll need to create a cron task to run preposterous.py on a scheduled basis. To do this issue the following command:
This will open the crontab file for the current user in the system’s default editor. At the bottom of the file, add a line like this to check for new posts every five minutes:
*/5 * * * * cd /home/jason/preposterous; /usr/bin/python /home/jason/preposterous/preposterous.py
Note: be sure to replace “jason” with the name of your home directory (or replace the entire path if you choose to install Preposterous elsewhere).
You’ll probably also want to configure the web server to run all the time (or select another web server that runs automatically). To run the built-in Python server at boot, edit the file /etc/rc.local and add a line like the one below to the end of the file:
cd /home/jason/preposterous/blogs; /usr/bin/python -m SimpleHTTPServer
Note: again, adjust the path accordingly..
This should get you up-and-running with your own Preposterous server on your Raspberry Pi. Updating to new versions of Preposterous is very easy using the git pull command in the preposterous directory. After pulling a new build, it may be necessary to “rebuild” the html files generated by Preposterous to get the latest features. To do this, first delete the existing files in your “web root” directory, then run the following command in the Preposterous directory:
This will regenerate all posts using the contents of the server’s inbox, and will suppress notification during the rebuild process (otherwise everyone who posted messages to the server would receive an email for every post they ever sent). Once this is complete the server is upgraded!