How to deploy Piwik Web Analytics on OpenShift Online

Piwik Web Analytics is a Free Software traffic analytics application for Web publishers. If you have the resources to run your own, it is a good replacement for Google Analytics. It is a database-driven, PHP application that you can download and install on your Web hosting account. There is also a hosted service provided by Arvixe.

If you have a Web hosting account, but not enough resources to host Piwik, OpenShift Online presents an alternative platform to host it on. OpenShift Online is a cloud computing Platform as a Service (PaaS) provided by Red Hat, Inc. If you are new to OpenShift, you may want to review OpenShift Online: A non-developer’s guide.

This article, the second on OpenShift, shows how to deploy Piwik on a FreeShift account, the free service component of OpenShift Online.

If you don’t yet have an account, you may sign up for one here. After signing up and verifying the account, you may start using and deploying applications via a Web interface or by using the command-line OpenShift Client Tools (RHC) from any supported operating system. Linux, Mac OS X, and Windows are currently supported.

OpenShift Online Web Console

The Web interface is really nice, but I find that the easiest method for deploying an application initially is via RHC. That requires installing the client control application on the operating system you are using. In this article, the steps to install and use it from Fedora and Ubuntu are given. For Windows or Mac OS X installation guide, please see this installation guide.

After setting up a new account, one of the first things you do from the Web management interface is create a namespace. Your account will have a URL, which will be accessible from so your namespace is like a subdomain of That’s a very simplified way of explaining it, but I think it gets the point across better than spewing more technical jargon. Any application you create will be accessible from

I deployed Piwik from a Fedora 18 installation, but you can do it from any other Linux distribution. The client tools are Ruby applications, so you’ll need to install it and everything else that it needs to run. Plus, Git will have to be installed, because that’s what will be used to push or deploy the app to your OpenShift Online account.

So after creating and configuring a new account, here are the steps required to create and deploy Piwik:

1. Install the requirements: Ruby 1.8.7 (or later) and Git are required. To install them on Fedora 18, you just need one command – yum install rubygem-rhc git. Or if you installed and prefer using Dnf, type dnf install rubygem-rhc git. That will install Ruby, the RHC tools and Git. On Ubuntu, you need two commands to achieve the same thing. First, type sudo apt-get install rubygems git, then gem install rhc.

2. Create and deploy Piwik: Now that you have all the requirements in place, the next step is to create and deploy the applications to your OpenShift Online account. Doing this involves creating a PHP app on your account. (Piwik is a PHP applications.). Then adding a (MySQL) database cartridge, cloning the Piwik repository, and pushing it to your OpenShift account. (Steps for doing this were taken from the official Piwik OpenShift quickstart guide.) You may want to visit that guide, then come back to step 3 of this tutorial when you are done.

Related Post:  Wildcard certificates coming to Let's Encrypt January 2018

The next five screen shots show how the process unfolded on my Fedora 18 computer.

Run the command rhc setup to start the setup wizard. This assumes that you have already created and configured your account, so what you have to do here is login.
OpenShift Online Setup PaaS

Authentication between your computer and your OpenShift account is accomplished using SSH keys. The first time you run rhc setup, the keys will be created and the public key uploaded to your account. After this, you may log into your account via ssh. The instruction will be on the Web management interface.
OpenShift PaaS

Next. Create the application using the commands in this screen shot. The “-a” switch is used to specify the name of the application, while the “-t” is used to specify the Web framework (cartridge) the application will use.
OpenShift PaaS Create App

Piwik is database-driven, so you need to add a MySQL cartridge using the commands shown in this screen shot. Make note of the name, username, and password of the database created here, because you’ll need them to setup and Piwik later. To make it easier to manage the MySQL databases you create in your account, I highly recommend that you create a phpMyAdmin cartridge from the Web Management interface. Creating one on my account made it easy to identify the source of a show-stopper error during the final step of this exercise.
OpenShift PaaS Create cartridge

The foregoing should have created a “piwik/php” directory where you’ve been running the commands. So you need to change into the piwik/php directory, make sure its empty (run rm -rf *), then clone the Piwik Git repository using these commands:

git remote add upstream -m master git://
git pull -s recursive -X theirs upstream master


Finally, push the cloned repo to your OpenShift account using the git push command. You’ll be promoted to enter a commit message. Note that you’ll be entering the message via Vi, so you need to enter edit mode by hitting the a, i, or o keys. Type the message, then press the Esc key to exit edit mode. After that, save and quit by using the following character sequence :wq. That takes care of step 2. You will be given the URL of your applications, which should take for form: For the final step, you need to access that URL and install Piwik.

Related Post:  What you need to know about blockchain technology and gaming

3. Setup and configure Piwik: When you access Piwik’s URL, you will see something like this screen shot. Click Next.
Piwik Web analytics

This is where you input the database name, username and password that was created in the previous step. It was supposed to be the easiest step, but it improved otherwise. By default, the database server is referenced by the server’s loopback address, which is always
Piwik database

Specifying the database credentials and clicking Next produced the error message shown in this screen shot.
Piwik error

Changing the loopback address to localhost, which means the same thing, produced a different error message.
Piwik Web analytics error

Using the server’s routable IP address produced yet a different error message. A search of the knowledgebase and googling did not give me a solution that worked, so I accessed phpMyAdmin to see what I could find.
Piwik Web analytics error

This screen shot shows what I found on phpMyAdmin. For some reason, a duplicate of the username was created with an actual IP address. Specifying the IP address I found here in place of localhost or the loopback address solved the problem.
Piwik Web Analytics phpMyAdmin

So there you have it. I now have Piwik running on a FreeShift account on OpenShift Online, which I use to monitor traffic on this website. Saves me from running it on my VPS account. Besides the RAM and disk space quota, one small gear also has a 40,000-file limitation. But that’s not something to worry about here, because this setup has generated just 3287 files.
Piwik realtime statistics stats

This just shows how a non-developer can take advantage of a developer-targeted service like OpenShift. Piwik is just one of many ready-made applications you can deploy on OpenShift. View the complete list here.


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Hola! Did you notice that no longer run network ads?  Yep, no more ads from the usual suspects that track and annoy you across the Internet. But since I still need to pay to keep the site running, feel free to make a small donation by PayPal or your favorite cryptocurrency.

  • Bitcoin
  • Ethereum
  • Xrp
  • Bitcoin cash
  • Bitcoin sv
  • Litecoin
  • Binance coin
  • Cardano
  • Ethereum classic
Scan to Donate Bitcoin to bc1qzvlte2m224zkayhdc7fdfjkp2rsgt0l5a496ua

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x0F4362DFF77F3Ba0Dc637F5f3Eba35D09a2fA60C

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Xrp to r4ggjvL36njsMCYTkJ3S7cTHscPsMsSGQv

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Bitcoin cash to qrs0dedzp9t55af3nfwypydghp29r0xguy9s20fz2k

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Bitcoin sv to 15K9TLyVDBtLuG9cYvXCX9SSkq9C9oUKHK

Donate Bitcoin sv to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin sv

Scan to Donate Litecoin to LetJ9QQMb7u2LMZ9Tu6rtHwcBcQFW98fbG

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Binance coin to bnb1ga8trq08ssqepd90v6225nzfgy448pu5pw8gxp

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Cardano to addr1qx2354yw49etstfljpdhwja3ajjlt487lg95vu9ngy2q6vu4rf2ga2tjhqknlyzmwa9mrm997h20a7stgectxsg5p5esq5l7d9

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Ethereum classic to 0xcD6CC972a2297FcafACDcfE042C55C69516a9264

Donate Ethereum classic to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum classic

Subscribe for updates. Trust me, no spam!

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Upcoming events

3 Responses

    1. Actually, it’s not more or less complicated, just a different process. I’ve installed it on a shared hosting account, so I know the process.

      Using a free service like yours is great, but I, like many others, like to own my own data – if possible. The message here is to show to to take advantage of OpenShift, and how to free your VPS or shared hosting resources from handling Piwik.

      Your service gives the second benefit, but in your case, users don’t own the data they generate.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.


The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.