Developing for OpenWrt? Bintray Has an Opkg For You

Opkg280x215OpenWrt is typically associated with network routers and similar equipment, and indeed the official OpenWrt website lists overs 1200 devices on which it runs. Network routers may sound boring (well, to some of us), but as the Internet of Things (IoT) continues its crusade around the world, many people don’t know that OpenWrt is also used on other devices such as phones, robots, sensor networks and more. To accommodate these more glamorous devices, and implement their cool features and functionality, and to give a network router an edge beyond the basic functions, you need a bit more than the Linux kernel on which OpenWrt is based. This good stuff comes in the form of over 3,500 Opkg packages which are available for download from public repositories. The good news is that JFrog Artifactory and JFrog Bintray together offer developers an end-to-end solution to manage their Opkg packages from development through to distributing them automatically to all those routers and robots alike.

While you can use Bintray to distribute your Opkg packages independently of Artifactory, using Artifactory for your OpenWrt development, can speed up your development cycles. For example, Artifactory support for Opkg gives you local repositories for the components you are developing, remote repositories to proxy remote ipk packages and get all those dependencies you need, and it even handles GPG signatures to verify packages. Once your packages are ready to go, use Artifactory’s Distribution Repository and push them to Bintray.

Bintray support for Opkg lets you work transparently with the Opkg client to resolve packages from Bintray and to upload them for distribution. As a mature and universal cloud platform for the distribution of software, Bintray can deliver software updates to users and devices alike over fast CDN, with advanced security features like access entitlements, detailed download stats and logs and more.

Uploading files is easy as 1-2-Oh-there-isn’t-even-a-3

  1. Create an Opkg repository and package in Bintray
  2. Upload your “ipk” file using Bintray’s REST API.
    For example, to upload kool-bot-utils to my robot-utils package in repository opkg-distributions with cURL, I would use:
curl -T kool-bot-utils.ipk -ujaycroaker:myapikey https://api.bintray.com/content/jaycroaker/opkg-distributions/robot-utils/1.0/.

Once your file is uploaded, Bintray will calculate the repository-wide Opkg metadata to maintain compatibility with the Opkg client.

If the version specified in the command don’t exist, Bintray will create it for you. And of course, you can do all of this through Bintray’s REST API, or through the JFrog CLI and in that case, you can do the above and publish the file in a single call.

Downloading is also a snap

The Opkg client works transparently with Bintray. You just need to define Bintray as a feed in your opkg.config file:

echo 'src bintray-feeds https://dl.bintray.com/jaycroaker/opkg-distributions/.' >> /etc/opkg/opkg.conf

Now you just install …

opkg install robot-utils

And if you need authenticated access to the repository, you can just add your Bintray credentials to the config file:

echo 'option http_auth jaycroaker:myapikey' >> /etc/opkg/opkg.conf

You don’t even need to memorize these lines. Bintray has a cool Set Me Up feature for every repository type that displays these code snippets for you to copy and paste into your scripts.

OpkgSetMeUp

So if routers, robots, and OpenWrt are what make your day, have a look at Bintray’s support for Opkg. Need private repositories? Check out Bintray Premium where you can use signed URLs and access entitlements for fine-grained control over who (or what) can download your ipk files. We envision the day when, not only routers and robots, but all devices get their software updates from Bintray.

 

Increase your Maven Package’s Exposure by Adding it to JCenter

If you already distribute your Maven packages via Bintray, your packages can gain further exposure by including them in Bintray’s JCenter! (if you are not very familiar with Bintray’s support for Maven, please refer to the user guide and to my previous post).

JCenter is the repository with the biggest collection of Maven artifacts in the world. And it’s on the best software distribution platform around – Bintray. This is where you want your Maven packages to be! CDN speed, user exposure, and live statistics to monitor the use of your artifacts are some of the benefits you get from JCenter. And if you really want to, you can also have your project synced with the older Maven Central repository.

Submit an Inclusion Request to JCenter

To promote sharing of packages within the developer community, once you have uploaded a package to one of your repositories, you can submit a request to the owner of any other repository to have your package included in theirs. If your request is granted, your package can be found just like any other package in that repository. You still maintain full control over the package in your own repository, and any changes you make to it, such as delivering new versions, or even removing it, are automatically synced to the other repository in which it’s included. So to maximize exposure of your Maven package in Bintray, all you need to do is request to have it added to JCenter.
In order to submit a request, just click on the ‘Add to JCenter’ button:

Add Package To JCenter
Once a Bintray moderator approves your request, your package will be available on JCenter, and you will receive a message into your Bintray mailbox. You will also see that your package is now linked to JCenter:
Maven Projects Linked To JCenter

Sync with Maven Central

At this point you can also have JCenter sync your package to Maven Central if you need to serve frameworks still using this repository. All you need to do is click on the ‘Maven Central’ link as shown above. Remember that you need to provide your Sonatype user name to Bintray before the syncing, but don’t worry, Bintray will remind you to do so if you haven’t already added it to your profile under Accounts:
Accounts Sonatype
Bintray takes care of the rest. Please also refer to the step by step instructions for how to sync your artifacts with Maven Central.

Good luck, and keep your package front and JCenter!

Even more Vagrant love in Bintray

You, of course, know, that for nearly the last two years, you have been downloading your Vagrant software from JFrog Bintray. But recently, Bintray has taken Vagrant support to a whole new level; it is now is a fully fledged Vagrant repository allowing you to distribute your public and private Vagrant boxes from Bintray! As for everything in Bintray, it’s simple and powerful:

Publishing Vagrant Boxes

1. Create a Vagrant repository (if you’re a new user it is likely that you already have a default Vagrant repository named “boxes”):

Create a Vagrant repository

2. Click on “Set Me Up!” and copy/paste the REST command to upload the boxes:

Create a Vagrant repository

Consuming Vagrant Boxes

Follow the “Downloading” section under “Set Me Up!” to configure box resolution for downloading Vagrant boxes, and be able to enjoy automatic box update during ‘vagrant up’ a box either by an explicit call to  ‘vagrant box update’. That’s it, now you can benefit from all the power behind Bintray distribution: CDN, stats, logs, version notifications and more. So give it a try, put a box or two on JFrog Bintray today!

Share Your JavaScript Libraries With The World

laziness

Let’s face it, developers are lazy (including myself). Philipp Lenssen agrees with this saying in his post by stating:

Only lazy programmers will want to write the kind of tools that might replace them in the end. Lazy, because only a lazy programmer will avoid writing monotonous, repetitive code – thus avoiding redundancy, the enemy of software maintenance and flexible refactoring. Mostly, the tools and processes that come out of this endeavor fired by laziness will speed up the production.

You, being a brilliant JavaScript developer building this awesome library that everyone has been waiting for, looking for a tool which will help you avoid writing monotonous, repetitive code.

Validating, compiling, minimizing, concatenating and the list goes on, these are the tasks you need to do before releasing your library to the wild.

Fortunately, those are the tasks almost anyone writing JavaScript code needs to do and that’s the problem Ben Alman set out to solve when he created Grunt.

Meet Grunt: The Build Tool for JavaScript

grunt

Grunt is a task-based command line build tool for JavaScript projects that facilitates creating new projects and makes performing repetitive but necessary tasks such as linting, unit testing, concatenating and minifying files (among other things) trivial.

That’s what Grunt aims to be. It has a bunch of built-in tasks that will get you pretty far, with the ability to build your own plugins and scripts that extend the basic functionality.

For more Grunt intro goodness, see Ben’s post on his personal blog and the Bocoup blog.

So, now you are sold and your project is fully automated in just about few minutes of work, now what? Well, now it’s time to distribute it to the people. That’s the whole point of software anyway, we want people to use our stuff.

Bintray + Grunt + grunt-bintray-deploy = Pure Awesomeness

The Grunt ecosystem is huge and it’s growing every day. With literally hundreds of plugins to choose from, you can use Grunt to automate just about anything with a minimum of effort, that’s exactly what I decided to do.

I’ve written a grunt plugin which will help you share and distribute your project to Bintray and from there to the rest of the world.

By using Bintray you are are able to distribute your library through a high speed CDN, your users could point their HTML JavaScript tags directly to a URL Bintray gives you!

With Bintray you know how your library is being consumed. Not only do you get download stats per version, but users are also able to communicate with you; comment and rate your libraries; or otherwise give you feedback.

Setup

Let’s use Yeoman to scaffload a Node.js module which later on will be distributed to Bintray:

mkdir mylib

Install Yeoman globally:

npm install -g yo

Install the nodejs generator globally:

npm install -g generator-nodejs

Download the grunt-bintray-plugin and save it as a development dependency into our package.json:

npm install grunt-bintray-deploy --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-bintray-deploy');

Now let’s configure the task to publish our index.js and package.json files to Bintray!

grunt.initConfig({
  bintrayDeploy: {
    bintray: {
      options: {
        user: "bintray_user",
        apikey: "bintray_api_key",
        pkg: {
          repo: "repo",
        }
      },
      files: [{
        expand: true,
        flatten: true,
        src: ["index.js", "package.json"],
        dest: "<%= pkg.version %>",
        filter: "isFile"
      }]
    }
}})

Now we are ready to run our grunt task:

grunt bintrayDeploy

Running "bintrayDeploy:bintray" (bintrayDeploy) task
>> Successfully created new package 'mylib'.
>> Deploying files to 'https://bintray.com/shayy/repo/mylib/0.0.1/files'
>> Successfully deployed 'index.js'
>> Successfully deployed 'package.json'

Done, without errors.

That’s it, here is how it looks like under your Bintray account:
Publish to Bintray

Look, this is the URL your users will use to consume your library from a fast CDN:
Download from Bintray

Now that everything is automated, we can finally go taking a nap and leave our CI server to do this nasty job.

Piece out.

Hot on Bintray: Package Merging

We have recently introduced package merging: several packages from the same repository can now be merged into one. This is extremely useful when you have existing packages that are not aligned properly. For example, when you have many small technical packages (modules) that are logically one, single package, often using the same version scheme. Such situations are extremely common with maven packages that were created to reflect existing group IDs and that are effectively part of a single package (a common situation for packages imported to JCenter).

This is how it works:

Package Merging

(1) From the package you wish to merge the other packages into, click the new Merge button.
(BTW, have you noticed our new tabs UI? ;-))

(2) Once clicked, select the other packages to merge into the package you have just selected.
The merge page contains two sections: On the left side, a list for filtering, finding and selecting candidate packages in the same repo for merging.  On the right side, the  package that is the merge target – all other selected packages will be merged into it. Note that the default is the name of the package you have selected in step #1, but you can change this name.

How to Merge Packages?

(3) Click Merge to have the files and versions of all the selected packages merged. Note that your files will be laid-out in the repository exactly as they were before the merge – but you can now manage them and all your versions under a new, consolidated logical package.

Knock yourself out! 🙂