What to do if you are discovering PaaS? Well for sure a standard “hello world” project is available in our Documentation but what if you are looking for something more useful?

A more compelling idea might be to display a simple web page that would fetch tweets on a specific Twitter query. This could make a nice social dashboard for you or your enterprise, tracking in real time mentions of your name in Twitter.

Such apps exists in several languages. I have chosen a simple node.js one from @cmichi on github: https://github.com/cmichi/twitterwall

Get started

You will need a valid Exoscale account and a Twitter account (not necessarily the one you want to monitor on your wall).

And some tools:

  • GIT
  • Node.js
  • NPM

Register a Twitter App

Go to the Twitter developer site at dev.twitter.com and login with your account.

On your account logo, select My Applications twitter applications

then create a new application, and follow the form for the name, URL, …

Select then the API Keys tab and Generate an Access Token. Finally take note of the following:

  • API Key
  • API Secret
  • Access Token
  • Access Token Secret

Retrieve the code

Download the code to your laptop and unzip it.

wget https://github.com/retrack/twitterwall/archive/master.zip

Configure the wall

in the directory where you unzipped the code, create a file config.js with the following contents:

exports.consumer_key = 'QWERTY';
exports.consumer_secret = 'QWERTY';
exports.access_token_key = 'QWERTY';
exports.access_token_secret = 'QWERTY';

Where you replace the QWERTY with the appropriate values from your Twitter App page.

In order for the PaaS to automatically launch your app when we push it we need to tell which node file to execute. This is done via a Procfile file you need to create if absent in the directory with the following contents:

web: node server.js

more info on Buildpacks

Also make sure this config.js file is not excluded in the .gitignore file. Remove the entry if found.

Security warning: beware not to include this file if you push to a public git repository.

Launch your APP

Create an App on Exoscale Apps

Login to your Exoscale account and go to the application tab.

Select create App and chose a name for your application. Select the Node.js language and hit create.

create PaaS app on Exoscale

Initialize the Git repository

Follow the on screen instructions for the initialization of your git repository

# Create a new repository then commit, push and deploy
git init
git add .
git commit -am "Initial deploy"

Push and deploy the App

Continuing on your application root directory push and deploy the application to Exoscale apps:

exoapp mytwwall/default push
exoapp mytwwall/default deploy

Back on the Exoscale portal, in the list of applications you should now see your application deployed twitterwall app deployed

or just click on the Check Deploy button

twitterwall app status

Play with your wall

A nice blue background app should now be available for your, capable to track via the Twitter streaming API hashtags or usernames and display messages nicely.

Mine runs at http://super-mytwwall.app.exo.io/

twitterwall running

Tech notes

The app leverages the Websockets feature of Exoscale apps note that you deactivate this with a simple config statement like:

exoapp mytwwall/default config.add NO_WS_SUPPORT=1

but it is less optimal for both server and browser. This is more a way to show you how to take environment variables in account for your application.

EDIT: June 14th, my app crashes

Unfortunately with some success to this post, my app crashed offering visitors a nice 502 error code.

Fortunately however, I have all necessary logs on Exoscale Apps:

error logs

looks like it needs JS debug…