I’m trying to Build docker container with support for Indexes and N1QL but the command
curl -u $CB_USER:$CB_PASS -v -X POST http://127.0.0.1:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex'
isn’t adding support for the same. I am using docker-compose and dockerfile is running this bash command
I have docker file command as
printf "Set hostname for cluster\n"
curl -v -X POST -u $CB_USER:$CB_PASS \
http://127.0.0.1:8091/node/controller/rename -d hostname=$CB_HOSTNAME
printf "Setup Services for n1ql\n"
curl -u $CB_USER:$CB_PASS -v -X POST http://127.0.0.1:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex'
The above command runs fine and update the hostname but when it comes to enable n1ql it shows 400 bad request.
here’re my Docker File contents
#!/usr/bin/env bash
cd / && ./entrypoint.sh couchbase-server &
httpstatus="000"
printf "Waiting for server to start\n"
while [ $httpstatus -ne "301" ]; do
httpstatus=$(curl -s -o /dev/null -I -w "%{http_code}" http://127.0.0.1:8091/)
done
bucketstatus=$(curl -s -o /dev/null -I -w "%{http_code}" http://127.0.0.1:8091/pools/default/buckets/$BUCKET)
if [ $bucketstatus != 200 ]
then
printf "Set hostname for cluster\n"
curl -v -X POST -u $CB_USER:$CB_PASS \
http://127.0.0.1:8091/node/controller/rename -d hostname=$CB_HOSTNAME
printf "Setup Services for n1ql\n"
curl -u $CB_USER:$CB_PASS -v -X POST http://127.0.0.1:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex'
printf "Setup admin\n"
curl -s -X POST http://127.0.0.1:8091/settings/web \
-d port=8091 \
-d username=$CB_USER \
-d password=$CB_PASS
printf "\nCreating bucket\n"
curl -s -X POST -u $CB_USER:$CB_PASS \
-d name=$BUCKET \
-d ramQuotaMB=300 \
-d authType=sasl \
http://127.0.0.1:8091/pools/default/buckets
fi
printf "Server ready\n"
while true; do sleep 1000; done
Followings are the logs
db_1 | Set hostname for cluster
db_1 | Note: Unnecessary use of -X or --request, POST is already inferred.
db_1 | * Trying 127.0.0.1...
db_1 | % Total % Received % Xferd Average Speed Time Time Time Current
db_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
db_1 | * Server auth using Basic with user 'admin'
db_1 | > POST /node/controller/rename HTTP/1.1
db_1 | > Host: 127.0.0.1:8091
db_1 | > Authorization: Basic YWRtaW46cGFzc3dvcmQ=
db_1 | > User-Agent: curl/7.49.1-DEV
db_1 | > Accept: */*
db_1 | > Content-Length: 18
db_1 | > Content-Type: application/x-www-form-urlencoded
db_1 | >
db_1 | } [18 bytes data]
db_1 | * upload completely sent off: 18 out of 18 bytes
db_1 | < HTTP/1.1 200 OK
db_1 | < X-XSS-Protection: 1; mode=block
db_1 | < X-Permitted-Cross-Domain-Policies: none
db_1 | < X-Frame-Options: DENY
db_1 | < X-Content-Type-Options: nosniff
db_1 | < Server: Couchbase Server
db_1 | < Pragma: no-cache
db_1 | < Expires: Thu, 01 Jan 1970 00:00:00 GMT
db_1 | < Date: Tue, 06 Nov 2018 16:17:29 GMT
db_1 | < Content-Length: 0
db_1 | < Cache-Control: no-cache,no-store,must-revalidate
db_1 | <
100 18 0 0 100 18 0 449 --:--:-- --:--:-- --:--:-- 461
db_1 | * Connection #0 to host 127.0.0.1 left intact
db_1 | Setup Services for n1ql
db_1 | Note: Unnecessary use of -X or --request, POST is already inferred.
db_1 | * Trying 127.0.0.1...
db_1 | % Total % Received % Xferd Average Speed Time Time Time Current
db_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
db_1 | * Server auth using Basic with user 'admin'
db_1 | > POST /node/controller/setupServices HTTP/1.1
db_1 | > Host: 127.0.0.1:8091
db_1 | > Authorization: Basic YWRtaW46cGFzc3dvcmQ=
db_1 | > User-Agent: curl/7.49.1-DEV
db_1 | > Accept: */*
db_1 | > Content-Length: 26
db_1 | > Content-Type: application/x-www-form-urlencoded
db_1 | >
db_1 | } [26 bytes data]
db_1 | * upload completely sent off: 26 out of 26 bytes
db_1 | < HTTP/1.1 400 Bad Request
db_1 | < X-XSS-Protection: 1; mode=block
db_1 | < X-Permitted-Cross-Domain-Policies: none
db_1 | < X-Frame-Options: DENY
db_1 | < X-Content-Type-Options: nosniff
db_1 | < Server: Couchbase Server
db_1 | < Pragma: no-cache
db_1 | < Expires: Thu, 01 Jan 1970 00:00:00 GMT
db_1 | < Date: Tue, 06 Nov 2018 16:17:29 GMT
db_1 | < Content-Type: application/json
db_1 | < Content-Length: 138
db_1 | < Cache-Control: no-cache,no-store,must-revalidate
db_1 | <
db_1 | { [138 bytes data]
100 164 100 138 100 26 18020 3395 --:--:-- --:--:-- --:--:-- 19714
db_1 | * Connection #0 to host 127.0.0.1 left intact
db_1 | ["insufficient memory to satisfy memory quota for the services (requested quota is 1710MB, maximum allowed quota for the node is 1598MB)"]Setup admin
db_1 | {"newBaseUri":"http://127.0.0.1:8091/"}
db_1 | Creating bucket
db_1 | Server ready
Any help on this will be appriciated