Working of One Click Deployment Buttons in loklak

Today’s topic is deployment. It’s called one-click deployment for a reason: Developers are lazy. It’s hard to do less than clicking on one button, so that’s our goal to make use of one click button in loklak.

For one click buttons we only need a central build server, which is our loklak_server. Everything written here was based on Apache ant, but later on ant build was deprecated and loklak server started to use gradle build. We wanted to make the process of provisioning and setting up a complete infrastructure of your own, from server to continuous integration tasks, as easy as possible. These button allows you to do all of that in one click.

How does it work?

You can see the one click buttons in the README page of loklak_server repository.

These repositories may include a different files like scalingo.json for scalingo, docker-compose.yml and docker-cloud.yml for docker cloud etc files at their root, allowing them to define a few things like a name, description, logo and build environment (Gradle build in the case of loklak server). Once you’ve clicked on any of the buttons, you will be redirected to respective apps and prompted with this information for you to review before confirming the fork.

This will effectively fork the repository in your account. Once the repo is ready, you can click on it. You will then be asked to “activate” or “deploy” your branch, allowing it to provision actual servers and run tasks. At the same time, you will be asked to review and potentially modify a few variables that were defined in the predefined files (for eg: app.json for heroku) of the apps. These are usually things like the Git URL of the repo for loklak, or some of the details related to the cloud provider you want to use (eg: Digital Ocean).

Once you confirmed this last step, your branch i.e., most probably master branch of loklak server repo is activated and the button will start provisioning and configuring your servers, along with the tasks which may allow you to build and deploy your app. In most of the cases, you can go to the tasks/setup section and run the build task that will fetch loklak server’s code, build it and deploy it on your server, all configurations included and will get a public IP.

What’s next

In loklak we are also introducing new one click “AZURE” button, then the users can also start deploying loklak in azure platform.


Working of One Click Deployment Buttons in loklak

One Click Deployment Button for loklak Using Heroku with Gradle Build

The one click deploy button makes it easy for the users of loklak to get their own cloud instance created and deployed in their heroku account and can be used according to their flexibility. Heroku uses an app.json manifest in the code repo to figure out what add-ons, config and other deployment steps are required to make the code run. This is used to configure and deploy the app.

Once you have provide the app name and then click on deploy button, Heroku will start deploying the loklak server to a new app on your account:

When setup is complete, you can open the deployed app in your browser or inspect it in Dashboard.

All these steps and requirements can now be encoded in an app.json file and placed in a repo alongside a button that kicks off the setup with a single click.

App.json is a manifest format for describing apps and specifying what their config requirements are. Heroku uses this file to figure out how code in a particular repo should be deployed on the platform. Here is the loklak’s app.json file which used gradle build pack:

	"name": "Loklak Server",
	"description": "Distributed Tweet Search Server",
	"logo": "",
	"website": "",
	"repository": "",
	"image": "loklak/loklak_server:latest-master",
	"env": {


If you are interested you can try deploying the peer from here itself. Checkout how simple it can be to deploy.

Deploy button:



One Click Deployment Button for loklak Using Heroku with Gradle Build

Loklak Server just a click away – One Click Deployments

As a person with an Android background working on the loklak project for the first time last month, I really did have a lot to pick up, and somehow I had to get started off.

I checked out the loklak docs which listed the process of deploying the server on your local machine or on Heroku / DigitalOcean / AWS, and all of those processes were lengthy and needed a bit of time to get set up, and besides I had never worked with Heroku before so I had to read up how it worked. There was no other feature to speed up the deployment process at that time, and that is when we decided to add a new feature: One Click Deploy!

One Click Deploy is the easiest, most convenient method to start up your own loklak server. Instead of going through the long drawn setting up through the terminal, you can simply deploy your server and get loklak running with a single click. We extended our list of supported platforms, and today, loklak server can be started onto Heroku, Scalingo, Docker Cloud and Bluemix, just with a single click. And all you need to do? Give your deployed app a name. That’s it. Quite literally.

Screen Shot 2016-06-01 at 12.08.47 AM

Integrating One Click Deploy into loklak, at first, wasn’t too big of a task. For Heroku, I just created an app.json file and linked it to the custom buildpack we had here. For Scalingo, I similarly had to create a scalingo.json, however I had issues as they didn’t have a JDK for Heroku Buildpacks, so I contacted them and they mended their own codebase to accommodate Heroku, and it finally worked. The Bluemix deployment was a bit more tedious: we had to make a manifest.yml and a pipeline.yml file, and then added a Bluemix start shell script and a Bluemix buildpack to make it work.

However, we did end up facing a lot of challenges after a period of time. After some days, our deployed servers started crashing. I communicated with the Scalingo team over email and they told us that our servers used an Xmx (maximum memory) of 600 MB while Scalingo containers worked with 512 MB, thus increasing swapping and reducing performance hereby crashing the applications. This was sorted by keeping an environment variable $ENVXmx which set the Xmx level based on the environment.

Finally, we decided to update our existing codebase to support Java 8, and as a result, we modified our buildpacks (Bluemix and Heroku) to accommodate for this change. This took a couple of days but finally it was done.

So at the end of it all, loklak finally has a much needed feature with which you can experience it in a matter of seconds, and a way with which you can set up multiple servers in just a few minutes, to multiple platforms. We have plans for having a deployment to Azure as well, and will plan on implementing it in the days to come 🙂

Loklak Server just a click away – One Click Deployments