Automate adding servers to master server? #479
-
I can see it's possible to automate deploying cronicle onto additional worker nodes. You would run the install command, copy over the master config then start the service. The part I'm not clear on is how I could automate adding the worker nodes to the cronicle master server. Right now It looks like the only option is to add them via the web UI? I checked through the API calls and didn't see any option for add_server. Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello! I do apologize -- the API you want exists of course, but it's not documented, and it's an "admin-only" API. To make matters worse, due to reasons I can't remember now, Cronicle API Keys cannot have the "admin" privilege. I honestly don't remember why I put in this restriction -- possibly due to security reasons. Anyway, you should be able to do it by following these steps. Warning: This is a bit of a hack. First, create the API key you will be using to add servers in the UI. Second, shut down the Cronicle service on your master server:
Then execute these commands as root:
This command should spawn the editor of your preference in the terminal (e.g. Locate the API key you want to "admin-ify" in the list, and then locate the {
"privileges": {
"admin": 1
},
"active": "1",
"title": "Joe's Test Key",
"description": "It does a few things.",
"id": "93fe0f04",
"key": "0095f5b664b93304d5f8b1a61df605fb",
"username": "admin",
"modified": 1454300467,
"created": 1441659908
} The "privileges": {
"admin": 1
}, Once you make this change to your API key, save the file and exit. The storage CLI script should detect that your editor exited and saved the temp file, and it should re-submit it back into the Cronicle DB. Please look closely at the console output for any errors here (JSON syntax errors, storage write errors, etc.). Now you are ready to use the API key, which has been effectively promoted to administrator, against the application's wishes. I am honestly not sure if this will cause problems, but I think it should work. Just be super careful with it. Remember to restart the Cronicle service on the master server:
Here is the undocumented API you want to hit:
This API follows the same rules as the others -- see the Cronicle JSON REST API docs for details. It expects two parameters, which you can either add as query string params on the URL and do an HTTP GET, or JSON keys with an HTTP POST:
Example URL (HTTP GET):
Make sure you check the response back from this API for any errors. See the Cronicle Standard Response Format in the docs. Check the Remember, the server has to be "reachable" from the master server. The hostname needs to be resolvable in DNS, and the IP needs to be routable from the master server, and visa-versa. Good luck! -- Joe |
Beta Was this translation helpful? Give feedback.
-
Hi, does this still work in v0.9.12 ? I've followed the steps but alas am getting the following response from the API: {"code":"api","description":"API Key cannot use administrator features"} API Key hack: "type": "list_page", API call curl -v 'http://localhost:3012/api/app/add_server' -d hostname=172.17.0.3 -d api_key=e4e77328d6a6e751b506272935c69d31 any help appreciated! thanks |
Beta Was this translation helpful? Give feedback.
Hello! I do apologize -- the API you want exists of course, but it's not documented, and it's an "admin-only" API. To make matters worse, due to reasons I can't remember now, Cronicle API Keys cannot have the "admin" privilege. I honestly don't remember why I put in this restriction -- possibly due to security reasons.
Anyway, you should be able to do it by following these steps. Warning: This is a bit of a hack.
First, create the API key you will be using to add servers in the UI. Second, shut down the Cronicle service on your master server:
Then execute these commands as root:
This command sho…