Skip to content

Commit

Permalink
Add Control Plane API call to return the Snowplow Mini version (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
aldemirenes committed Oct 5, 2017
1 parent aae96fd commit a0d366e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions provisioning/resources/control-plane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func main() {
http.HandleFunc("/local-iglu-apikey", addLocalIgluApikey)
http.HandleFunc("/credentials", changeUsernameAndPassword)
http.HandleFunc("/domain-name", addDomainName)
http.HandleFunc("/version", getSpminiVersion)
log.Fatal(http.ListenAndServe(":10000", nil))
}

Expand Down Expand Up @@ -268,3 +269,16 @@ func addDomainName(resp http.ResponseWriter, req *http.Request) {
io.WriteString(resp, "added successfully")
}
}

func getSpminiVersion(resp http.ResponseWriter, req *http.Request) {
if req.Method == "GET" {
versionBytes, err := ioutil.ReadFile(config.VersionFilePath)
if err != nil {
http.Error(resp, err.Error(), 500)
return
}
versionStr := string(versionBytes)
resp.WriteHeader(http.StatusOK)
io.WriteString(resp, versionStr)
}
}
6 changes: 6 additions & 0 deletions provisioning/roles/sp_mini_3_setup_apps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
src: "{{playbook_dir}}/resources/control-plane/snowplow-mini-control-plane-api"
dest: "{{executables_dir}}"

- name: Copy VERSION file to /home/ubuntu/snowplow for Control API
become: yes
synchronize:
src: "{{playbook_dir}}/../VERSION"
dest: "{{main_dir}}"

- name: Check Kinesis Packages
stat:
path: "{{staging_dir}}/{{kinesis_package}}"
Expand Down

0 comments on commit a0d366e

Please sign in to comment.