Optimize image create in Bluebox for use with Test Kitchen
This is the first article in a series on how to use GitHub pages (the service that hosts this blog) and the BlueMix PaaS to create an automatically updating news section.
I will be consuming the Cloudant Database as a Service to persist the articles I want for my news section of this blog. Cloudant DBaaS has several features that make it a good fit, including:
You will need to register to get started with BlueMix. Click here to create a BlueMix account.
You should see a screen like this
From here, you can add and configure the Cloudant service. I left all the default values and clicked create.
BlueMix will configure your Cloudant service. Once it is done click the Launch icon to open the Cloudant console.
Refer to the BlueMix docs for more details or troubleshooting.
Now that the Cloudant service is added, it needs to be configured for our use case.
Click on the upper right hand corner link that says create database. I named mine blog_news.
To access this from our the web browser I want to create a read only user ID.
To make and configure the user:
When done your screen should look something like this
Store the password for this user somewhere - you can’t retrieve it later.
To create a test news item:
Your screen should look like this right before you click ‘New Doc’
This should open the Cloudant online JSON text editor. Let’s author our first news item document. Add the following fields for all news article documents. In addition to the _id field inserted automatically by Cloudant we will
Your screen should look something like this.
Record the automatic document id assigned by Cloudant we will need that in the next section.
Click the create document button to insert the document into Cloudant.
To test our process we will retrieve the document we just inserted into Cloudant.
In the all documents view, click on the pencil icon next to the document whose ID matches the document ID you noticed in the previous section. This should bring up an editable version of the document you crafted earlier. In the upper right hand side of the browser click the API icon and then select copy URL.
Your screen should look like this
Create a curl like the one below replacing
This is what it looks like with some fake values in place.
The results of the curl, should be the same JSON document you just finished creating with a revision id automatically inserted by Cloudant.
Should you run into any issues consult the BlueMix Documentation, the Cloudant Documentation or reach out to me on twitter