Closed eljuanchosf closed 8 years ago
This error usually suggests that your backing datastore is not configured correctly (i.e., you did not install the required guest and admin credentials by running createImmortalDBs.sh
). If you are using a couchdb instance that is not persisted, note that you have to run this script every time you deploy. The sequence is:
ant clean build
tools/db/couchdb/start-couchdb-box.sh whisk_admin some_passw0rd
tools/db/createImmortalDBs.sh
ant deploy
Ok, so I have installed CouchDB in the same box. Then I run createImmortalDBs.sh
. Output of that script is:
./tools/db/createImmortalDBs.sh
About to drop and recreate database 'subjects' on:
http://localhost:5984
This will wipe the previous database if it exists and this is not reversible.
Respond with 'DROPIT' to continue and anything else to abort.
Are you sure? DROPIT
subjects
curl -s -k --user lagavulin:singlemalt -X DELETE http://localhost:5984/subjects
{"ok":true}
curl -s -k --user lagavulin:singlemalt -X PUT http://localhost:5984/subjects
{"ok":true}
{"ok":true,"id":"_design/subjects","rev":"1-75bab8a4d7d4cc346954de8deb35e984"}
Create immortal key for guest
{"ok":true,"id":"guest","rev":"1-64f0f9a3b79cb8546c67a1e8631e097c"}
Create immortal key for whisk.system
{"ok":true,"id":"whisk.system","rev":"1-990db25b72e29cb614594f0c8faea2a2"}
Which I think it is Ok, that I'm not seeing errors.
But when I do ant deploy
I keep seeing the error I specified above.
In your Vagrant machine, try from the openwhisk
directory:
wsk action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)
If that fails, then the key installed in your CouchDB for whisk.system
does not match the expected value used during catalog installation. You can verify what that the key in the database wskadmin user get whisk.system
matches what is in this file.
It is weird. Running the hello.js
script fails, but the keys seems to match:
~/openwhisk# bin/wskadmin user get whisk.system
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
~/openwhisk# cat config/keys/auth.whisk.system
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
Do you have a ~/.wskprops
file? One more thing to check (note use of -v
):
wsk -v action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)
{'apihost': '172.17.0.1', 'namespace': '_', 'clibuild': '2016-05-04T23:27:24-04:00', 'apiversion': 'v1'}
========
REQUEST:
PUT https://172.17.0.1/api/v1/namespaces/_/actions/hello
Does the above match your setup? In particular, is namespace
equal to _
and the API end point https://.../api/v1/namespaces/_/actions/hello
?
I notice that the user name and password you use for the Couch instance are not the default values - I assume you updated the generated couchdb-local.env file accordingly.
Also keep in mind, that everytime you run ant clean
the whole docker daemon is cleaned up including the couchDB instance. That means: after each clean
you need to redeploy couchdb and create the immortal databases.
It's important to follow the sequence @rabbah lined out above in his comment.
@rabbah I don't have a .wskprops
file in my home.
Yes, I did change the username and password in the couchdb-local.env
.
@markusthoemmes I followed the steps, except for the tools/db/couchdb/start-couchdb-box.sh whisk_admin some_passw0rd
, since I have CouchDB installed permanently in my box.
Here is the result of the command you specified:
# wsk -v action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)
{'apihost': '172.17.0.1', 'namespace': '_', 'clibuild': '2016-05-05T03:03:03+00:00', 'apiversion': 'v1'}
========
REQUEST:
PUT https://172.17.0.1/api/v1/namespaces/_/actions/hello
Headers sent:
{
"Authorization": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=",
"Content-Type": "application/json"
}
Body sent:
{"exec": {"kind": "nodejs", "code": "/**\n * Hello, world.\n */\nfunction main(params) {\n console.log('hello', params.payload+'!');\n}\n"}}
error: [Errno 111] Connection refused
There is no issue after all. The problem was with the name of the database host. I'll create a PR with the "workaround" in the README.
Thank you @rabbah and @markusthoemmes for your help!
@eljuanchosf I think I met with the same issue with you. I'm running my OpenWhisk in a CouchDB installed in the same server. couchdb-local.env is configured as following:
OPEN_WHISK_DB_PROTOCOL=https OPEN_WHISK_DB_HOST=127.0.0.1 OPEN_WHISK_DB_PORT=6984 OPEN_WHISK_DB_USERNAME=root OPEN_WHISK_DB_PASSWORD=ps
Can you explain more detail about "The problem was with the name of the database host" and how to "workaround" ?
Daisy
Hi @daisy-ycguo
The problem @eljuanchosf faced was using a non-ephemeral, non-docker couchdb running natively on his system. He tried to use localhost
to reach that database but localhost
in a container is not your local machine but the container itself.
Does that match your local deployment?
A possible workaround is to use the IP of your machine as DB_HOST instead of localhost
or aliases like 127.0.0.1
.
Hi, @eljuanchosf
Yes, it matched. You can see from my couchdb-local.env, I want to reach my database using https://127.0.0.1:6984, not localhost. I think it's exactly the same situation with @eljuanchosf .
I'm sure my local CouchDB runs well. It can be reached both by https://127.0.0.1:6984 and http://127.0.0.1:5984. I tested by "curl -k https://127.0.0.1:6984" and "curl -k http://127.0.0.1:5984". I'm even quite sure the whisk.system is stored in the database. I can query the data by: curl -s -k --user root:ps -X GET https://127.0.0.1:6984/subjects/whisk.system.
I tried to config https and 6984 in couchdb-local.env, it reported the same error as @eljuanchosf reported when "ant deploy". Then I tried to config http and 5984 in couchdb-local.env, it reported the same error: The supplied authentication is invalid.
It's quite interesting because ./tools/db/createImmortalDBs.sh can successfully insert data to CouchDB, but it looks like wsk cannot. I'm quite curious how @eljuanchosf work it around.
Daisy
Oh. I understand. I should use the exact IP address, not IP address: 127.0.0.1 to access CouchDB. Let me try if it works. Thank you, @markusthoemmes
Yeah, it works. I changed the IP address in couchdb-local.env to the real IP address, not 127.0.0.1, "ant deploy" runs well. Thank you for the help, @markusthoemmes
@daisy-ycguo can you tell me the real ip you mean ? is it the ip of vagrant vm or which command you use to get this ip?
@lfzCarlosC I don't use vagrant. I use a Ubuntu VM with a CouchDB installed in the same VM. I don't know if it is similar.
When I type command: ifconfig
, I will see three network interfaces and three IP address:
docker0 172.17.0.1
eth0 10.0.2.15
lo 127.0.0.1
I choose the IP address of eth0
as the database IP in the database configuration file, i.e. 10.0.2.15.
I don't know if that is helpful. If you can explain the detail of your network, I can see if I can help.
Daisy
Running the buid on a Ubuntu 14.04 Vagrant image I have this issue, which is consitent every time I do
ant build run deploy
.