Closed NavleenKaur-24 closed 8 years ago
if you run cf logs on the api server while you are performing the curl, what comes out in the log?
2016-06-07T10:58:17.80+0000 [App/0] OUT 2016-06-07 10:58:17,808 INFO org.cloudfoundry.autoscaler.api.rest.PublicRestApi:85 [http-nio-61018-exec-10] [createPolicy] Received JSON String of policy content: { } 2016-06-07T10:58:17.81+0000 [RTR/0] OUT autoscalingapi.apps.eu.cfdev.canopy-cloud.com - [07/06/2016:10:58:17.688 +0000] "PUT /v1/apps/cfe24ac0-d059-4070-8685-6fb875a2c95f/policy HTTP/1.1" 500 3 105 "-" "curl/7.35.0" 10.0.0.253:37199 x_forwarded_for:"52.201.224.134" x_forwarded_proto:"https" vcap_request_id:d88376ee-cdc4-491c-6824-1cecb55cf3c7 response_time:0.125237882 app_id:17f72572-0910-430a-9fbc-344cf54bcb36 2016-06-07T10:58:17.81+0000 [App/0] OUT 2016-06-07 10:58:17,815 INFO org.cloudfoundry.autoscaler.api.rest.PublicRestApi:111 [http-nio-61018-exec-10] [createPolicy] error in getserverinfo: java.net.UnknownHostException: https 2016-06-07T10:58:17.81+0000 [App/0] OUT 2016-06-07 10:58:17,816 ERROR org.cloudfoundry.autoscaler.api.util.RestApiResponseHandler:163 [http-nio-61018-exec-10] [getResponseInternalServerError] com.sun.jersey.api.client.ClientHandlerException: java.net.UnknownHostException: https
Looks like you are misconfigured. The scalingServiceName is not configured or is not deployed as CF-AutoScaler (default). Did you run the acceptance tests to make sure you have configured things correctly?
Yes , But they are failing because of our Password Policy , Is there any workaround ?
You can configure the clientId and clientSecret so I don't understand why you can't pick a password that meets your policy needs.
Failure [1.240 seconds] [BeforeSuite] BeforeSuite /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance/api/api_suite_test.go:47
Got stuck at: Creating user CATS-USER-1-2016_06_08-08h11m44.735s... FAILED Error creating user CATS-USER-1-2016_06_08-08h11m44.735s. Server error, status code: 400, error code: invalid_password, message: Password must be at least 8 characters in length.,Password must contain at least 1 uppercase charact ers.,Password must contain at least 1 digit characters.,Password must contain at least 1 special characters.
Waiting for: scim_resource_already_exists
You just need to tweak your config for running the tests by using an existing user that would be valid.
"use_existing_user": true,
"keep_user_at_suite_end": true,
"existing_user": "USERNAME",
"existing_user_password": "PASSWORD"
I tried but its showing one more error:
./bin/test_default ++ dirname ./bin/test
can't load package: package acceptance: no buildable Go source files in /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance
Ginkgo ran 1 suite in 338.652ms Test Suite Failed
Your initial GOPATH path is wrong. Set it to nothing and see if it works.
ubuntu@ip-10-0-0-80:~/navleen/CF-AutoScaler/app-autoscaler/src/acceptance$ unset GOPATH ubuntu@ip-10-0-0-80:~/navleen/CF-AutoScaler/app-autoscaler/src/acceptance$ echo $GOPATH
ubuntu@ip-10-0-0-80:~/navleen/CF-AutoScaler/app-autoscaler/src/acceptance$ ./bin/test_default ++ dirname ./bin/test
can't load package: package acceptance: no buildable Go source files in /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance
Ginkgo ran 1 suite in 334.065ms Test Suite Failed
What version of GO are you using?
Your output is does not match mine...
Notice that you do not have acceptance/template
Make sure you are using the latest code base and you have updated the submodules.
go version xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3 linux/amd64
++ dirname ./bin/test
can't load package: package acceptance: no buildable Go source files in /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance
Ginkgo ran 1 suite in 339.902ms Test Suite Failed
Use Go 1.6 and see if it works.
++ dirname ./bin/test
Ginkgo ran 1 suite in 4.194203389s Test Suite Failed
Now This is the error , I have not made any changes to config.go
Something in your json configuration is wrong. I would start with trying to see where you have invalid json in that file.
⢠Failure [18.781 seconds] AutoScaler API History API [It] retrieves the scaling history /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance/api/api_test.go:138
Expected
You will have to do further investigation but it confirms that the configuration you used during the build/deploy is broken. If configured properly, all the acceptance tests should pass.
"api": "api.sys.eu.cfdev.canopy-cloud.com", "admin_user": "admin", "adminpassword": "***", "apps_domain": "apps.eu.cfdev.canopy-cloud.com", "skip_ssl_validation": true, "use_http": true, "use_existing_user": true, "keep_user_at_suite_end": true, "existing_user": "navleenkaur", "existing_userpassword": "***", "service_name": "CF-AutoScaler", "api_url": "https://autoscalingapi.apps.eu.cfdev.canopy-cloud.com", "report_interval": 120
json file , In case you need to look at , Please let me know if any errors are there
can you attach the api server log again?
The issue is in the Acceptance Tests , Do you want me to put the api server log when I do Curl for establishing the API Connection?
400 [2016-06-13 05:58:20.85 (UTC)]> cf unbind-service autoscaler-APP47d24db1-678c-45d5-6803-8343558921f4 scaling-c0765a87-f00b-4ca3-6601-8ba74165f68b Unbinding app autoscaler-APP47d24db1-678c-45d5-6803-8343558921f4 from service scaling-c0765a87-f00b-4ca3-6601-8ba74165f68b in org CATS-ORG-1-2016_06_13-05h57m12.515s / space CATS-SPACE-1-2016_06_13-05h57m12.515s as navleenkaur... OK
[2016-06-13 05:58:31.33 (UTC)]> cf delete-service scaling-c0765a87-f00b-4ca3-6601-8ba74165f68b -f Deleting service scaling-c0765a87-f00b-4ca3-6601-8ba74165f68b in org CATS-ORG-1-2016_06_13-05h57m12.515s / space CATS-SPACE-1-2016_06_13-05h57m12.515s as navleenkaur... OK
[2016-06-13 05:58:31.79 (UTC)]> cf delete autoscaler-APP47d24db1-678c-45d5-6803-8343558921f4 -f -r Deleting app autoscaler-APP47d24db1-678c-45d5-6803-8343558921f4 in org CATS-ORG-1-2016_06_13-05h57m12.515s / space CATS-SPACE-1-2016_06_13-05h57m12.515s as navleenkaur... OK ⢠Failure in Spec Setup (BeforeEach) [23.512 seconds] AutoScaler API Policy API with a valid policy [BeforeEach] retrieves the policy /home/ubuntu/navleen/CF-AutoScaler/app-autoscaler/src/acceptance/api/api_test.go:88
Expected
This is not an acceptance test issue but highlights the same issue you started with. You have an issue with your deployment configuration.
I have already sent you the json file, Let me know how can I troubleshoot it
You provided the config for the Acceptance tests. We are saying the configuration you deployed with is wrong.
Sorry for the misunderstanding The file I used to deploy is as follows:
cfUrl=https://xyz.com cfClientId=cf-autoscaler-client cfClientSecret=Secret
serviceName=CF-AutoScaler brokerUsername=admin brokerPassword=admin
internalAuthUsername=admin internalAuthPassword=admin
scalingServerURIList=https://autoscaling.xyz.com apiServerURI=https://autoscalingapi.xyz.com
couchdbUsername=admin couchdbPassword=Password couchdbHost=Internal_IP couchdbPort=5984 couchdbServerDBName=couchdb-scaling couchdbMetricDBPrefix=couchdb-scalingmetric couchdbBrokerDBName=couchdb-scalingbroker
reportInterval=120
Let us get some more detailed logging. Can you modify app-autoscaler/api/src/main/resources/log4j.properties and change the log4j.rootLogger's INFO to DEBUG
You can also try to add to api/src/main/java/org/cloudfoundry/autoscaler/api/rest/PublicRestApi.java change line 111 to
logger.error("error in getserverinfo", e);
Run either one of your scenarios whichever is quicker since they both have the same issue while doing a cf logs so we can see where things fail and what is being passed around.
Do you have any slack Channel where I can get to know things better?
@fraenkel @boyang9527
https://cloudfoundry.slack.com/ #autoscaler
Whenever I execute this command , mvn test -Denv=unittest I am able to see this error :
[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] app-autoscaler ..................................... SUCCESS [ 0.008 s] [INFO] common ............................................. FAILURE [ 12.292 s] [INFO] api ................................................ SKIPPED [INFO] server ............................................. SKIPPED [INFO] servicebroker ...................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.568 s [INFO] Finished at: 2016-07-12T07:49:28+00:00 [INFO] Final Memory: 12M/188M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project common: There are test failures.
[ERROR] [ERROR] Please refer to /home/ubuntu/navleen/autoscaler/app-autoscaler/common/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project common: There are test failures. Please refer to /home/ubuntu/navleen/autoscaler/app-autoscaler/common/target/surefire-reports for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures. Please refer to /home/ubuntu/navleen/autoscaler/app-autoscaler/common/target/surefire-reports for the individual test results. at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:91) at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:320) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:892) at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn
What version of maven are you using? Try mvn test -Denv=unittest -pl common What are the errors reported in common/target/surefire-reports/
Apache Maven 3.3.9
For now I have CF-AutoScaler visible in my marketplace , I have pushed an app and binded to the service instance of CF-AutoScaler
Next is to define the policy ?
Yes.
curl -X -i -k PUT -H "Authorisation: $ACCESS_TOKEN" -H "Accept: application/json" $API_URL/vi/apps/
curl -X -i -k PUT -H "Authorisation: $ACCESS_TOKEN" -H "Accept: application/json" $API_URL/vi/apps/app_id/policy/policy.json
Close. curl -X PUT -k -i -H "Accept:application/json" -H "Content-Type: application/json" -H "Authorization: $ACCESS_TOKEN" --data-binary @"$API_URL/vi/apps/app_id/policy/policy.json"
I have taken this default example for policy.json
{ "instanceMinCount":1, "instanceMaxCount":5, "policyTriggers":[{ "metricType":"Memory", "statWindow":300, "lowerThreshold":30, "upperThreshold":80, "instanceStepCountDown":1, "instanceStepCountUp":1, "stepDownCoolDownSecs":600, "stepUpCoolDownSecs":600 }], "schedules": { "timezone":"(GMT +08:00) Asia/Shanghai", "recurringSchedule":[{ "startTime":"00:00", "endTime":"23:59", "repeatOn":"[\"1\",\"2\",\"3\",\"4\",\"5\"]", "minInstCount":2, "maxInstCount":5 }], "specificDate":[{ "startDate":"2017-06-19", "startTime":"00:00", "endDate":"2017-06-19", "endTime":"23:59", "minInstCount":1, "maxInstCount":5 }] } }
But when I run the above command I get this error :
Warning: Couldn't read data from file Warning: "https://$API_URL/vi/apps/app_id Warning: /policy/policy.json", this makes an Warning: empty POST. curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information
It doesn't like your curl command. Do it in phases, but it is also saying you didn't do a -X PUT.
Closing due to inactivity. Please reopen if you have further questions.
Following the Documentation for app-autoscaler, When I am trying to make the API connection to the server by the following command- curl -v -X 'PUT' -H "Content-Type: application/json" -H "Authorization: $ACCESS_TOKEN" app_url/v1/apps/app_id/policy -d '{ }'
I am facing the 500 : Internal Server Error
OUTPUT is as follows
upload completely sent off: 3 out of 3 bytes HTTP/1.1 500 Internal Server Error Content-Length: 0 Date: Tue, 07 Jun 2016 09:37:29 GMT Server Apache-Coyote/1.1 is not blacklisted Server: Apache-Coyote/1.1 X-Vcap-Request-Id: Vcap_ID Connection #0 to host app_url left intact