How can i set a docker action with OpenWhisk in Bluemix? - ibm-cloud

I was testing OpenWhisk on Bluemix. What i want to do is very very simple. I have a js script that works (it's just a console.log). I have a Dockerfile making a docker .. when i run my docker i can see my console.log \o/ (i know it's amazing)
Then i create my action ......
I try to run it from Bluemix UI
I get this :
failed to invoke action XXX/XXXX: Container hash or name expected in makeContainer.
Just what does it means ? I couldn't find anything on it.
ps : If you know where i can find some real doc about how to use docker container for actions i would be very happy :).
Thanks a lot for your help.
Edit : In the end the problem was that i was trying to pull from a private docker repo. I have to say the error message is not explicit x). Thanks for your help.

You can find the documentation about creating docker actions here: https://new-console.ng.bluemix.net/docs/openwhisk/openwhisk_actions.html#openwhisk_actions_docker
Instructions helps you download the docker sdk for OpenWhisk, and allow you to create a docker action that you can invoke from CLI or Web UI.
If you create the action using the Web UI you need to specify the docker Image from Docker hub using the format username/imagename like openwhisk/example
If you need more help feel free to reach the team on Slack for more real time interactions and we should be able to help you and get your feedback on how can we improve the user experience.
Team: https://developer.ibm.com/open/slack-request
Channel: #openwhisk https://dwopen.slack.com/messages/openwhisk

Related

GitHub actions - use a custom container registry

When using GitHub actions (for example CodeQL code scanning) you can specify a container image in which the action would run, see https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainerimage
In the docs it says:
The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a registry name.
I need to specify an image which resides on a private registry, not in (the public) Docker Hub. The docs seem to suggest it is possible ("or a registry name") but I am not sure if and how I could specify a private image (I refer to the private image in docker as https://my.server.com:1234/dir/image-name:latest).
Is it possible? If yes, how?
I've tested the option that you've mentioned but unfortunately it is not working.
Planning to get support from GitHub to try and figure out if it's possible. (Have a corporate account)

CodeSandbox: Using terminal in node template

I'm trying to create a sandbox using the node template but I'm running into issues accessing the terminal. I have a sandbox here that I've uploaded using their define API which should be using a node template (defined in my sandbox.config.json) and have a defined start script. It shows a 504 and doesn't give me access to the terminal. What am I doing wrong?
After more research: I now see the sandbox running in a node environment, but no terminal - but hovering over the "+" on the upper right of the info/console window gives a tooltip "Fork to add a Terminal". I did so, and the terminal became available. I conclude it's some form of ownership issue - I can't open a terminal in your sandbox, but I can in my forked sandbox.
We can conclude that the define API creates a public template/sandbox - but the terminal is only available in a private sandbox. To use the terminal, you'll have to fork the sandbox after creating it.
(thx to #codesandbox for including the tooltip that led to the conclusion)
That's not a container environment, which is required to have access to a terminal. There are known issues with containers & codesandbox; specifically, you can't convert one sandbox type to another, and sometimes forking from someone else's github also does not create as a container.
Best to start with a containerized template.
In case this helps anyone: to enable containers for an existing project you need to create a sandbox.config.json file with the following content before creating the sandbox:
{
"template": "node"
}
I'm not sure if there is a way to change the sandbox once it's created.
Ref: https://github.com/codesandbox/codesandbox-client/issues/1608

Deploy API REST IBM Hyperledger Composer Blockchain (bad flag in substitute command: 'U' ERROR)

I'm getting this error trying to deploy a card to a working blockchain on cloud, any idea? Thanks in advance. I'm using a mac, following the guide (Kubernetes installed/configured well, I think):
https://ibm-blockchain.github.io/interacting/
./create/create_composer-rest-server.sh --paid --business-network-card /Users/sm/jsblock/tutorial-network/PeerAdmin#fabric-network.card
Configured to setup a paid storage on ibm-cs
Preparing yaml file for create composer-rest-server
sed: 1: "s/%COMPOSER_CARD%//User ...": bad flag in substitute command: 'U'
Creating composer-rest-server pod
Running: kubectl create -f /Users/sm/jsblock/ibm-container-service/cs-offerings/scripts/../kube-configs/composer-rest-server.yaml
error: no objects passed to create
Composer rest server created successfully
There is an error in that document. And you are also specifying the Peer Admin card when you need to use a Network Admin Card.
There are 2 sets of 'parallel' documents for paid and free clusters. The command you are using has --paid in it in error. If you remove --paid and use the Network Admin Card I think it will solve the problem.
Your command will look something like this: ./create/create_composer-rest-server.sh --business-network-card admin#YOUR-network
I tried again with the install proccess (deployed blockchain instance seemed to work weall): https://ibm-blockchain.github.io/simple/
But I noticed that the script:
./create_all.sh
...never ended (mostly an internal kubernetes problems I guess). And I reset the installation:
./delete_all.sh
./create_all.sh
I tried again, now everything Ok. I could get my awesome API REST talking with my Hyperledger Blockchain, deployed on IBM Cloud. Ready to develop something amazing.

Google Vision API - tatusCode.RESOURCE_EXHAUSTED

I am new to the Google Vision API and I would like to conduct a label detection of approx. 10 images and I would like to run the vision quickstart.py file. However when I do this with only 3 images then it is successful. With more than 3 images I am getting the error message below. I know that I would need to change something at my setup, but I do not know what I should change.
Here is my error message:
google.gax.errors.RetryError: GaxError(Exception occurred in retry method
that was not classified as transient, caused by <_Rendezvous of RPC that
terminated with (StatusCode.RESOURCE_EXHAUSTED, Insufficient tokens for
quota 'DefaultGroup' and limit 'USER-100s' of service
'vision.googleapis.com' for consumer 'project_number: XXX'.)>)
Does anybody know what I need to do?
Any help would be much appreciated
Cheers,
Andi
I ran into the same problem and fixed it with these steps:
Make sure you have the Google Cloud SDK properly installed: https://cloud.google.com/vision/docs/reference/libraries
Setup a Service Account in the Google Cloud backend: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
Create a Service Account Key and download it as a JSON file to a local folder. You need to keep the key private.
Export the filepath to the key-file as an environment variable: gcloud auth activate-service-account --key-file path/to/your/keyfile/here
Log out/in of the console.
Make sure, the environment variable is properly set with printenv
Try your py-script again...
Good luck...
Edit: In addition to the mentioned steps 1.-3. you can just do vision_client = vision.Client.from_service_account_json('/path/to/your/keyfile.json') in your script. No need for the env variable then.

"Project is not fully initialized with the default service accounts." Error in brand new account on first project?

i just signed up for Google Could Engine and started the most basic container engine quickstart on a brand new project:
https://cloud.google.com/container-engine/docs/quickstart
a few steps in it has me run this command
gcloud container clusters create example-cluster
which errors out:
$ gcloud container clusters create example-cluster
ERROR: (gcloud.container.clusters.create) ResponseError: code=503, message=Project hello-world-161713 is not fully initialized with the default service accounts. Please try again later.
so far, "trying again later" has not helped: it's been doing this every time for the past few hours.
as usual, Google has no obvious way of getting help in any timely manner, and Googling the error turns up nothing useful.
kind of a long shot but i found a link sending me over here on one of their pages (great support guys) so figured i'd give it a shot. thanks in advance.
The Container Engine API needs to be enabled, and unfortunately that error message is not correct (trying again later won't help).
If you visit the Google Container Engine page in the wb console https://console.cloud.google.com/kubernetes/list it should enable Google Container Engine. Make sure you select the project you're using with the quickstart. You can create your cluster from that page too if you'd prefer.
You can also enable the Container Engine API manually here: https://console.cloud.google.com/apis/api/container.googleapis.com/overview