vania-janet/multiturn-rag-retrieval-data huggingface dataset:
Publishing a virtual server image to the IBM Cloud catalog 

This tutorial walks you through how to publish a virtual server image with Terraform to IBM Cloud®. By completing this tutorial, you submit your publishing request, respond to any review feedback, and then publish the virtual server image to the IBM Cloud catalog.

This tutorial is one of four in a series that demonstrates how to onboard and publish a [sample virtual server image with Terraform](https://github.com/IBM-Cloud/isv-vsi-product-deploy-sample/tree/v1.0). As you complete the tutorial, adapt each step to fit your product's needs.



 Before you begin 



1. [Register a virtual server image](https://cloud.ibm.com/docs/sell?topic=sell-vsimage-register).
2. [Define your product details](https://cloud.ibm.com/docs/sell?topic=sell-vsimage-define).
3. [Onboard the virtual server image](https://cloud.ibm.com/docs/sell?topic=sell-vsimage-onboard).
4. [Update the visibility of the virtual server image](https://github.com/IBM-Cloud/isv-vsi-product-deploy-sampleupdate-the-visibility-of-your-image-patch-api).







 Step 1: Submit your publishing request 

The details of any third-party software must be reviewed by IBM Cloud before it can be published to the catalog. Complete the following steps to submit a request to publish your virtual server image:



1. In the IBM Cloud console, click the Navigation Menu icon ![Navigation Menu icon](https://cloud.ibm.com/docs-content/v1/content/ff5860bfede49db3197c4bbba7f7123769bdc068/icons/icon_hamburger.svg) > Partner Center > Sell > My Products.
2. Select your virtual server image.
3. From the Onboarding checklist, click Request Approval.
4.
IBM Cloud cloud-init images are created for the environment by using the [Config Drive](http://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html) Version 2 data source to supply the metadata.



4. Windows images require the Cloudbase-init Metadata Service for public and private network support in IBM Cloud infrastructure. You can access the service [here](https://github.com/softlayer/bluemix-cloudbase-init).









 Preparing to import an encrypted image 

If you plan to import a VHD image that's encrypted with your own data encryption key, make sure that you complete the prerequisites and instructions for encryption that are described in [Using End to End (E2E) Encryption to provision an encrypted instance](https://cloud.ibm.com/docs/image-templates?topic=image-templates-using-end-to-end-e2e-encryption-to-provision-an-encrypted-instanceusing-end-to-end-e2e-encryption-to-provision-an-encrypted-instance).

You must use the vhd-util tool to encrypt your image, which must be in VHD format. For more information, see [Encrypting VHD images](https://cloud.ibm.com/docs/image-templates?topic=image-templates-create-encrypted-image).





 Uploading an image to IBM Cloud Object Storage 

When your image is ready, you can upload it to IBM Cloud Object Storage. Make sure to use a bucket in a [regional location](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpointsendpoints).



1. In IBM Cloud Object Storage, go to your bucket and select Upload > Files to [upload](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-upload) the image.
2.
Getting started with image templates 

With IBM Cloud® Classic infrastructure image templates, you can capture an image of a virtual server to quickly replicate its configuration with minimal changes in the order process. Image templates provide an imaging option for all Virtual Servers, regardless of operating system. Image templates are not compatible with bare metal servers.

Image templates are not intended for backing up your data.



 How image templates work 

The two main actions for any image template are create and deploy. When you request to create an image, the automated system of IBM Cloud® takes your server offline. While the server is offline, a compressed backup of your data is created, the configuration information is recorded, and the image template is stored on the IBM Cloud SAN. During the deployment stage of the image template, the automated system constructs a new server that is based on the data that is gathered from the selected image. The deployment process makes adjustments for volume, restores the copied data, and then makes final configuration changes (for example, network configurations) for the new host.





 Private images 

Private images are images that are created by users on their own accounts or images that are created on another account and shared. By default, all the images that you create are private.





 Public images 

Public images are pre-configured virtual servers that are posted by IBM Cloud or made public by customers and are available for use by all IBM Cloud customers. Virtual servers that are provisioned through public image templates are generally configured for optimal performance, with specific combinations of different configuration specs.

ISO images of licensed operating systems, such as Windows and Red Hat Enterprise Linux, and open source operating systems, such as CentOS and Ubuntu, are not provided by IBM. If you need these ISO images, you can download them from the respective vendor website.





 Creating an image template 

Complete the following steps to create an image template of a virtual server.



1. Go to your console's device menu and make sure that you have the correct account permissions to complete the tasks.
2. From the Devices menu, select Device List.
3. Click the virtual server that you want to use to create an image template.

Check the Passwords tab of the Device Details page.
Container Registry docs 

Find out about how you can use Container Registry to provide a multi-tenant private image registry that you can use to store and share your container images with users in your IBM Cloud account. Click the tiles on this page to explore more information about Container Registry.

 Developer tools 

[API & SDK reference](https://cloud.ibm.com/apidocs/container-registry)[CLI reference](https://cloud.ibm.com/docs/Registry?topic=Registry-containerregcli)[Terraform reference](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/cr_namespace)

 Recommended content 

[Getting started with IBM Cloud Container Registry Install the Container Registry CLI, set up your own image namespace, and push container images to your namespace.](https://cloud.ibm.com/docs/Registry?topic=Registry-getting-started)[About IBM Cloud Container Registry Find out about Container Registry.](https://cloud.ibm.com/docs/Registry?topic=Registry-registry_overview)[IBM Cloud Container Registry and Vulnerability Advisor workflow tutorial Find out about the basic functions of both IBM Cloud Container Registry and Vulnerability Advisor. These services are pre-integrated and work together seamlessly in IBM Cloud, and their features provide a robust but straightforward workflow for users of containers.](https://cloud.ibm.com/docs/Registry?topic=Registry-registry_tutorial_workflow)

 Learn more 

[IBM Developer<br><br>Visit IBM Developer for technical articles, code patterns, tutorials, and more.<br><br>![112-Developer-tools.svg](https://cloud.ibm.com/media/docs/images/homepage/112-Developer-tools.svg)](https://developer.ibm.com/?q=IBM%20cloud%20container%20registry)[IBM Training<br><br>Build your skills with IBM Cloud training.<br><br>!
How design documents work 

IBM® Cloudant® for IBM Cloud® reads specific fields and values of design documents as functions. Design documents are used to [build indexes](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsindexes-design-docs) and [validate updates](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsupdate-validators).

Each design document defines either partitioned or global indexes, which are controlled by the options.partitioned field. A partitioned index allows only queries over a single data partition in a partitioned database. A global index allows querying over all data within a database, at a cost of latency and throughput over a partitioned index.



 Creating or updating a design document 

Method
: PUT /$DATABASE/_design/$DDOC

Request
: JSON of the design document information.

Response
: JSON status.

Roles permitted
: _admin

To create a design document, upload it to the specified database.

In these examples, $VARIABLES might refer to standard or design documents. To distinguish between them, standard documents have an _id indicated by $DOCUMENT_ID, while design documents have an _id indicated by $DDOC.

A design document's ID never includes a partition key regardless of the database's partitioning type. The partition key isn't included because the indexes that are included within a design document apply to all partitions in a partitioned database.

If a design document is updated, IBM Cloudant deletes the indexes from the previous version, and re-creates the index from scratch. If you need to change a design document for a larger database, have a look at the [Design document management guide](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-document-managementmanaging-changes-to-a-design-document).

A design document's structure includes the following parts:

_id
: Design document ID.
PUT /{db}/_local/{doc_id} <br>[Cloudant](https://cloud.ibm.com/apidocs/cloudantputlocaldocument), [CouchDB](https://docs.couchdb.org/en/latest/api/local.htmlput--db-_local-docid) Store the specified local document. <br>Local documents aren't replicated to other databases. 
 COPY /{db}/_local/{doc_id} <br>Cloudant, [CouchDB](https://docs.couchdb.org/en/latest/api/local.htmlcopy--db-_local-docid) Copy the specified local document. 
 DELETE /{db}/_local/{doc_id} <br>[Cloudant](https://cloud.ibm.com/apidocs/cloudantdeletelocaldocument), [CouchDB](https://docs.couchdb.org/en/latest/api/local.htmldelete--db-_local-docid) Delete the specified local document. 
 POST /{db}/_missing_revs <br>Cloudant (This endpoint is deprecated. See [POST /{db}/_revs_diff](https://cloud.ibm.com/apidocs/cloudantpostrevsdiff).), [CouchDB](https://docs.couchdb.org/en/latest/api/database/misc.htmlpost--db-_missing_revs) Retrieve the document revisions from the list that don't exist in the database. 
 POST /{db}/_purge <br>[CouchDB](https://docs.couchdb.org/en/latest/api/database/misc.htmlpost--db-_purge) Remove the references to deleted documents from the database.
[Enable public access](https://cloud.ibm.com/docs-content/v1/content/63322f2f3a72050206eb05ba7f590fdcb741105c/cloud-object-storage/images/cos-sw-ui-complete-config.jpg)







 Upload content to your bucket 

The content of your hosted static website files focuses naturally on information and media. A popular approach to creating content for static websites are open source generators listed at [StaticGen](https://www.staticgen.com). For the purpose of this tutorial, we only need two files:



* An index page, typically written in HTML and named index.html, that loads by default for visitors to your site
* An error page, also in HTML and here named error.html; typically the error page is loaded when a visitor tries to access an object that isn't present or doesn't have public access



Other files, like images, PDFs, or videos, can also be uploaded to your bucket (but this tutorial will focus only on a minimum set of requirements).

For the purpose of this tutorial, place the HTML pages for the index and error handling in a local directory. Replace the placeholder content as shown in the example command to upload your html files:

ibmcloud cos object-put --bucket BUCKET_NAME --key KEY [--body FILE_PATH]

You may have already completed the basic configuration for hosting your static website. Files can be uploaded directly in the Console once you've named and configured your bucket. Note the step is optional as shown in Figure 4, and can occur at any point before the testing of your new hosted website.

![Upload files](https://cloud.ibm.com/docs-content/v1/content/63322f2f3a72050206eb05ba7f590fdcb741105c/cloud-object-storage/images/cos-sw-ui-upload-files.jpg)
* UI
* CLI
* API







 Granting access to IBM Cloud Object Storage to import and export images 

To import a custom image to IBM Cloud VPC, or to export a custom image from IBM Cloud VPC, you must have an instance of IBM Cloud® Object Storage available. You must also create a bucket in IBM Cloud Object Storage to store your images. Finally, you must create an authorization so that the Image Service for VPC can access IBM Cloud Object Storage.



 Creating an IBM Cloud Object Storage service instance 

If you need to create an instance of IBM Cloud Object Storage, see [Getting started with IBM Cloud Object Storage](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-getting-started-cloud-object-storage).

From IBM Cloud Identity and Access Management, you must create an authorization so that the Image Service for VPC can access IBM Cloud Object Storage.





 Creating an authorization 

To authorize the Image Service for VPC to access the target service, IBM Cloud Object Storage, you must create an [authorization](https://cloud.ibm.com/docs/account?topic=account-serviceauth). To import an image, you must specify the Reader service access role for IBM Cloud Object Storage. To export an image, you must specify the Writer service access role for IBM Cloud Object Storage. With both Reader and Writer service access roles for IBM Cloud Object Storage, you can both import and export images.



 Granting Reader and Writer access with the UI 

Complete the following steps to create an authorization for the Image Service for VPC to both import images from an IBM Cloud Object Storage service instance and export images to an IBM Cloud Object Storage service instance.



1. From the [IBM Cloud console](https://console.cloud.ibm.com) menu bar, click Manage > Access (IAM), and select Authorizations.
2. On the Manage authorizations page, click Create.
3. Make your selection for the Source account. By default This account is selected.
4. Select a source service for the authorization. Specify VPC Infrastructure Services as the source service.



1.
In [IBM Cloud console](https://cloud.ibm.com/login), go to Menu icon ![Menu icon](https://cloud.ibm.com/docs-content/v1/content/f02b9c9adcbb7328d95a45e105cec371d50f15eb/icons/icon_hamburger.svg) > VPC Infrastructure > Compute > Images.
2. On the Custom images tab, click the name of the custom image that you want to export.
3. On the image details page, click the Actions menu and select Export.
4. On the Export custom image panel, you can optionally specify a name for the export job. The name is used, along with the image name, to construct the name of the exported object in IBM Cloud Object Storage. If you do not specify a name, a name is automatically generated.
5. Select the file format for exporting. Valid file formats are QCOW2 and VHD. If the custom image is an encrypted image, QCOW2 format is required.
6. Specify the IBM Cloud Object Storage service instance and bucket where you want to export the custom image. Alternatively you can specify the CRN for the IBM Cloud Object Storage bucket where you want to export the image.
7. Click Export custom image.







 Exporting a custom image by using the CLI 

You can export an IBM Cloud VPC custom image to IBM Cloud Object Storage by using the command-line interface (CLI).

To export a custom image by using the CLI, use the ibmcloud is image-export-job-create command. Specify the name or ID of the custom image to export by using the IMAGE variable. You can specify a name for the export job with NEW_NAME. You can also specify the file format for exporting the image, either qcow2 or vhd. The qcow2 format is the default file format and is the required format if the custom image is encrypted. Additionally, specify the IBM Cloud Object Storage BUCKET where you want to export the custom image.
* Backup - Replicate your data from IBM Cloudant to your own CouchDB databases and take nightly snapshots of your data for archiving purposes. Send the data to a backup service such as [Amazon Glacier](https://aws.amazon.com/glacier/) for safe keeping.
* Local-first data collection - Write your data to local Apache CouchDB first, then replicate it to IBM Cloudant for long-term storage, aggregation, and analysis.







 PouchDB 

[PouchDB](https://pouchdb.com/) is an open source, in-browser database that allows data to be replicated in both directions between the browser and IBM Cloudant. Storing the data in a web browser on the client side allows web applications to function even without an internet connection. PouchDB can synchronize any changed data to and from IBM Cloudant when an internet connection is present. Setting up replication from the client side requires a few lines of JavaScript.

See the following example JavaScript that uses PouchDB to enable replication:

var db = new PouchDB("myfirstdatabase");
var URL = "https://$USERNAME:$PASSWORD@$SERVICE_DOMAIN/my_database");
db.sync(URL, { live: true });







 Filtered replications 

It is useful to be able to remove some data during the replication process, when you replicate one database to another, as you can see in the following examples:



* Removing all traces of deleted documents, making the target database smaller than the source.
* Separating data into smaller chunks, such as storing UK data in one database and US data in another.





 Replication filter functions 

IBM Cloudant’s filtered replication allows the definition of a JavaScript function that uses the return value to determine whether each document in a database is to be filtered or not. [Filter functions](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsfilter-functions) are stored in [design documents](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-design-documentsdesign-documents).

See the following example filter function for replicating non-deleted documents:
To delete an attachment, make a DELETE request with the document's most recent _rev to https://$ACCOUNT.cloudant.com/$DATABASE/$DOCUMENT_ID/$ATTACHMENT. If you don't supply the most recent _rev, the response is a [409 error](https://cloud.ibm.com/apidocs/cloudantlist-of-http-codes).

See the following example of deleting an attachment by using HTTP:

DELETE /$DATABASE/$DOCUMENT_ID/$ATTACHMENT?rev=$REV HTTP/1.1

See the following example of deleting an attachment:



* Curl
* Java
* Python
* Go
* Node



curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/products/small-appliances:100001/product_details.txt?rev=4-1a0d1cd6f40472509e9aac646183736a"

import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.cloudant.v1.model.DeleteAttachmentOptions;
import com.ibm.cloud.cloudant.v1.model.DocumentResult;

Cloudant service = Cloudant.newInstance();

DeleteAttachmentOptions attachmentOptions =
new DeleteAttachmentOptions.Builder()
.db("products")
.docId("small-appliances:100001")
.attachmentName("product_details.txt")
.rev("4-1a0d1cd6f40472509e9aac646183736a")
.build();

DocumentResult response =
service.deleteAttachment(attachmentOptions).execute()
.getResult();

System.out.println(response);

from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance()

response = service.delete_attachment(
(https://cloud.ibm.com/docs/schematics?topic=schematics-blueprint-intro)[Deploy cloud services with workspaces Use an IBM-provided Terraform template to create an Object Storage service instance to store your data in IBM Cloud.](https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform)[Explore the IBM Cloud software catalog Try out one of the IBM-provided software templates to quickly spin up a classic virtual server instance (VSI), and automatically configure the instance to connect to an IBM Cloud Database.](https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-software)[Learn more about Schematics Learn about how Schematics works, integrated open source technologies, and the benefits of using the service.](https://cloud.ibm.com/docs/schematics?topic=schematics-learn-about-schematics)[Browse Terraform templates Explore the sample Terraform templates, onboard them to your private catalogs, and try them using Schematics.](https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-provider-template)[Set up the Schematics CLI Install the Schematics CLI plug-in to perform Schematics Actions in your IBM Cloud account.](https://cloud.ibm.com/docs/schematics?topic=schematics-setup-cli)

 Learn more 

[IBM Developer<br><br>Visit IBM Developer for technical articles, code patterns, tutorials, and more.<br><br>![112-Developer-tools.svg](https://cloud.ibm.com/media/docs/images/homepage/112-Developer-tools.svg)](https://developer.ibm.com/?q=schematics)[Architecture Center<br><br>Discover the architecture references available for this product.<br><br>!
* Make content globally available with a Content Delivery Network (CDN).
* Expose files by using a static website application.



Zoom

![Architecture](https://cloud.ibm.com/docs-content/v1/content/f84e2238288b7f0355715a4c355609ce7ac48fb0/solution-tutorials/images/solution3/Architecture.png)

Figure 1. Architecture diagram of the tutorial



1. The user accesses the application
2. The application includes content distributed through a Content Delivery Network
3. If the content is not available in the CDN or has expired, the CDN pulls the content from the origin.







 Before you begin 

This tutorial requires:



* IBM Cloud CLI with the IBM Cloud Object Storage plugin (cloud-object-storage),
* git to clone the source code repository,
* jq to query JSON files.



You will find instructions to download and install these tools for your operating environment in the [Getting started with tutorials](https://cloud.ibm.com/docs/solution-tutorials?topic=solution-tutorials-tutorials) guide.

To avoid the installation of these tools you can use the [Cloud Shell](https://cloud.ibm.com/shell) from the IBM Cloud console.

In addition, you need the following permissions on Classic Infrastructure:



* [Manage CDN Account](https://cloud.ibm.com/docs/CDN?topic=CDN-faqshow-do-i-use-cloud-to-give-users-permission-to-create-or-manage-cdn)



These permissions are required to be able to order and view the CDN service.





 Step 1: Get the web application code 

Let's consider a simple web application with different types of content like images, videos and cascading style sheets. You will store the content in a storage bucket and configure the CDN to use the bucket as its origin.

To start, retrieve the application code:
* [Writing a document to an IBM Cloudant database](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_write)
* [Updating a document](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_update)



* [Create a trigger by using the filter function](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_trigger)



* [Data structure of a trigger activation](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_struct)



* [Filter database change events](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_filter)
* [Processing an individual document by using an action sequence](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_seq)



* [Creating an action to process an individual document](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_action_individual_doc)
* [Create a sequence with the read action](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_sequence_read)
* [Create a trigger with changes feed](https://cloud.ibm.com/docs/openwhisk?topic=openwhisk-pkg_cloudantcloudant_trigger_change)