...
- First, log-in as an administrator (use the platform@sagebase.org account) to get an administrator's session token:
Code Block curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json -d '{ "email": "<admin username>", "password": "<admin password>" }' https://staging-auth.elasticbeanstalk.com/auth/v1/session
- Once you have the admin token the backup daemon can be started with the following command:
Request
ResponseCode Block curl -i -k -H sessionToken:<your admin token> -H Accept:application/json -H Content-Type:application/json -d '{ }' https://staging-reposervice.elasticbeanstalk.com/repo/v1/startBackupDaemon
Code Block HTTP/1.1 201 Created Content-Type: application/json Date: Thu, 18 Aug 2011 22:38:56 GMT Server: Apache-Coyote/1.1 Content-Length: 256 Connection: keep-alive { "id":"6695", "type":"BACKUP", "status":"STARTED", "errorMessage":null, "progresssMessage":"Starting...", "progresssCurrent":0, "progresssTotal":0, "errorDetails":null, "backupUrl":null, "totalTimeMS":0, "startedBy":"platform@sagebase.org", "startedOn":1313707136615 }
- Once the daemon is started, its progress can be monitored using its 'id' returned from the '/startBackupDaemon' call:
Request
ResponseCode Block curl -i -k -H sessionToken:<your admin token> -H Accept:application/json -H Content-Type:application/json https://staging-reposervice.elasticbeanstalk.com/repo/v1/daemonStatus/6695
In this example, we are showing that the backup failed. When there is a failure, the status will show as 'FAILED', and 'errorMessage' and 'errorDetails' should show the message and stack trace of the failure. In this example, the service IAM user did not have permission to write the backup file to S3. After fixing the AWS permissions we can try running the backup again:Code Block HTTP/1.1 200 OK Content-Type: application/json Date: Thu, 18 Aug 2011 22:46:06 GMT Server: Apache-Coyote/1.1 Content-Length: 1114 Connection: keep-alive { "id":"6695", "type":"BACKUP", "status":"FAILED", "errorMessage":"Access Denied", "progresssMessage":"Starting to upload temp file: /opt/tomcat7/temp/BackupDaemonJob6695-762955157468269943.zip to S3...", "progresssCurrent":785, "progresssTotal":863, "errorDetails":"Status Code: 403, AWS Request ID: CF8A8149099FE5F9, AWS Error Code: AccessDenied,...", "backupUrl":null, "totalTimeMS":26145, "startedBy":"platform@sagebase.org", "startedOn":1313707136615 }
Response
This time we can see that the backup 'status'='COMPLETED', and that the 'backupUrl' is no longer null and that the entire backup ~25 seconds to complete. We can now use the file found at the 'backupUrl' to restore synapse.Code Block HTTP/1.1 200 OK Content-Type: application/json Date: Thu, 18 Aug 2011 23:00:10 GMT Server: Apache-Coyote/1.1 transfer-encoding: chunked Connection: keep-alive { "id":"6696", "type":"BACKUP", "status":"COMPLETED", "errorMessage":null, "progresssMessage":"Finished: BACKUP", "progresssCurrent":863, "progresssTotal":863, "errorDetails":null, "backupUrl":"https://s3.amazonaws.com/stagingdata.sagebase.org/BackupDaemonJob6696-911306061719227050.zip", "totalTimeMS":24880, "startedBy":"platform@sagebase.org", "startedOn":1313708374613 }
...