IBM | Ops (original) (raw)
IBM
Ops can integrate with your existing IBM Cloud Platform (IBM) account. You can use Ops CLI to create and upload an image to your account. Once, you have uploaded image, you can also create an instance with a particular image using CLI.
Create an api key and export it:
$ export TOKEN="somethinguniqueandrandom"If you have already created an Ops project, you can update your existing config.json. You need to add CloudConfig which mentions specific details like BucketName.
{
"RunConfig": {
"Ports": ["8080"]
},
"CloudConfig" :{
"Zone": "us-south-2",
"BucketName":"nanos-test"
}
}Once, you have updated config.json you can create an image in IBM Cloud with the following command.
For creating an image using a particular package, you need to provide the package name to ops image create command with -p option.
You can list existing images on IBM cloud with ops image list.
ops image delete <imagename> can be used to delete an image from IBM Cloud.
After the successful creation of an image in IBM Cloud, we can create an instance from an existing image.
You need to export TOKEN.
You can list instance on IBM Cloud using ops instance list command.
You need to export TOKEN:
Alternatively you can pass zone with cli options.
ops instance delete command can be used to delete instance on IBM Cloud.
You need to export TOKEN.
Alternatively you can pass zone with cli options.
- Pre-requisites
- Image Operations
- Create Image
- List Images
- Delete Image
- Instance Operations
- Create Instance
- List Instances
- Get Logs for Instance
- Delete Instance
- Volume Operations
- Create Volume
- List Volumes
- Delete Volume
- Attach Volume
- Detach Volume
$ ops image create -t ibm <program> -c config.json$ ops image create -c config.json -p node_v14.2.0 -a ex.js -i <image_name> -t ibm$ ops image list
+--------------------+--------+-------------------------------+
| NAME | STATUS | CREATED |
+--------------------+--------+-------------------------------+
| nanos-main-image | READY | 2019-03-21T15:06:17.567-07:00 |
+--------------------+--------+-------------------------------+
| nanos-node-image | READY | 2019-04-16T23:16:03.145-07:00 |
+--------------------+--------+-------------------------------+
| nanos-server-image | READY | 2019-03-21T15:50:04.456-07:00 |
+--------------------+--------+-------------------------------+$ ops delete image nanos-main-image$ export TOKEN=<token>
$ ops instance create <image_name> -t ibm -c config.json$ export TOKEN=token
$ ops instance list
+-----------------------------+---------+-------------------------------+-------------+--------------+
| NAME | STATUS | CREATED | PRIVATE IPS | PUBLIC IPS |
+-----------------------------+---------+-------------------------------+-------------+--------------+
| nanos-main-image-1556601450 | RUNNING | 2019-04-29T22:17:34.609-07:00 | 10.240.0.40 | 34.83.204.40 |
+-----------------------------+---------+-------------------------------+-------------+--------------+$ ops instance list -t ibm$ export TOKEN=mytoken
$ ops instance delete my-instance-running$ ops instance delete -z us-south-2 my-instance-running