Skip to content

Commit

Permalink
make websocket work in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Aug 22, 2020
1 parent 3075d12 commit c822069
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 6 additions & 1 deletion kotsadm/operator/Makefile
@@ -1,5 +1,5 @@

SHELL := /bin/bash -o pipefail
CURRENT_USER := $(shell id -u -n)
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org

Expand Down Expand Up @@ -37,6 +37,11 @@ build:
run: bin
./bin/kotsadm-operator --api-endpoint http://localhost:30065 --token local

.PHONY: build-ttl.sh
build-ttl.sh:
docker build -f deploy/Dockerfile -t ttl.sh/${CURRENT_USER}/kotsadm-operator:12h .
docker push ttl.sh/${CURRENT_USER}/kotsadm-operator:12h

.PHONY: build-alpha
build-alpha:
docker build -f deploy/Dockerfile -t kotsadm/kotsadm-operator:alpha .
Expand Down
13 changes: 13 additions & 0 deletions kotsadm/operator/build-ttl.sh
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

make build build-ttl.sh

GREEN='\033[0;32m'
NC='\033[0m' # No Color

printf "\n\n\n"
printf "Run command: ${GREEN}kubectl edit deployment kotsadm-operator${NC}\n"
printf "Replace image with: ${GREEN}ttl.sh/${CURRENT_USER}/kotsadm-operator:12h${NC}\n"
printf "\n"
printf "This image is good for 12 hours\n"
4 changes: 2 additions & 2 deletions kotsadm/pkg/apiserver/server.go
Expand Up @@ -180,14 +180,14 @@ func Start() {
// task status
r.Path("/api/v1/task/updatedownload").Methods("OPTIONS", "GET").HandlerFunc(handlers.GetUpdateDownloadStatus)

r.Handle("/socket.io/", socketservice.Start().Server)

// to avoid confusion, we don't serve this in the dev env...
if os.Getenv("DISABLE_SPA_SERVING") != "1" {
spa := handlers.SPAHandler{StaticPath: filepath.Join("web", "dist"), IndexPath: "index.html"}
r.PathPrefix("/").Handler(spa)
}

r.Handle("/socket.io/", socketservice.Start().Server)

srv := &http.Server{
Handler: r,
Addr: ":3000",
Expand Down

0 comments on commit c822069

Please sign in to comment.