redirect all non-matched urls to the docs.
This commit is contained in:
parent
1307295e20
commit
33e23b69bd
@ -6,14 +6,12 @@ COPY . /opt/converge/
|
||||
WORKDIR /opt/converge
|
||||
RUN go mod download
|
||||
COPY . /opt/converge/
|
||||
#RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o main .
|
||||
RUN go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin ./cmd/...
|
||||
#RUN mkdir -p /opt/converge/downloads/
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /opt/converge/bin/converge /opt/converge/bin/
|
||||
COPY --from=builder /opt/converge/bin/agent /opt/converge/bin/tcptows /opt/converge/downloads/
|
||||
COPY --from=builder /opt/converge/static/ /opt/converge/downloads/
|
||||
COPY --from=builder /opt/converge/bin/agent /opt/converge/bin/tcptows /opt/converge/docs/
|
||||
COPY --from=builder /opt/converge/static/ /opt/converge/docs/
|
||||
|
||||
ENTRYPOINT ["/opt/converge/bin/converge", "/opt/converge/downloads" ]
|
||||
ENTRYPOINT ["/opt/converge/bin/converge", "/opt/converge/docs" ]
|
||||
|
@ -20,6 +20,11 @@ func parsePublicId(path string) (publicId string, _ error) {
|
||||
return matches[1], nil
|
||||
}
|
||||
|
||||
func catchAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/docs", http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
downloadDir := "downloads"
|
||||
@ -60,7 +65,8 @@ func main() {
|
||||
|
||||
http.HandleFunc("/agent/", registrationService.Handle)
|
||||
http.HandleFunc("/client/", clientService.Handle)
|
||||
http.Handle("/downloads/", http.StripPrefix("/downloads/", http.FileServer(http.Dir(downloadDir))))
|
||||
http.Handle("/docs/", http.StripPrefix("/docs/", http.FileServer(http.Dir(downloadDir))))
|
||||
http.HandleFunc("/", catchAllHandler)
|
||||
|
||||
// Start HTTP server
|
||||
fmt.Println("Rendez-vous server listening on :8000")
|
||||
|
@ -23,12 +23,12 @@
|
||||
</p>
|
||||
<pre>
|
||||
# for HTTP hosted server
|
||||
curl http://HOSTPORT/downloads/agent > agent
|
||||
curl http://HOSTPORT/docs/agent > agent
|
||||
./agent ws://HOST:PORT/agent/ID
|
||||
chmod 755 agent
|
||||
|
||||
# for HTTPS hosted server
|
||||
curl https://HOSTPORT/downloads/agent > agent
|
||||
curl https://HOSTPORT/docs/agent > agent
|
||||
./agent wss://HOST:PORT/agent/ID
|
||||
chmod 755 agent
|
||||
</pre>
|
||||
@ -51,12 +51,12 @@
|
||||
|
||||
<pre>
|
||||
# for HTTP hosted server
|
||||
curl http://HOST:PORT/downloads/wstotcp > wstotcp
|
||||
curl http://HOST:PORT/docs/wstotcp > wstotcp
|
||||
chmod 755 wstotcp
|
||||
./wstotcp 10000 ws://HOST:PORT/client/ID
|
||||
|
||||
# for HTTPS hosted server
|
||||
curl https://HOST:PORT/downloads/wstotcp > wstotcp
|
||||
curl https://HOST:PORT/docs/wstotcp > wstotcp
|
||||
chmod 755 wstotcp
|
||||
./wstotcp 10000 wss://HOST:PORT/client/ID
|
||||
</pre>
|
||||
@ -81,9 +81,9 @@
|
||||
<h1>Downloads</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="/downloads/agent">agent</a>: The agent to run inside aa CI job
|
||||
<li><a href="/docs/agent">agent</a>: The agent to run inside aa CI job
|
||||
</li>
|
||||
<li><a href="/downloads/tcptows">tcptows</a>: TCP to WS tunnel for allowing regular
|
||||
<li><a href="/docs/tcptows">tcptows</a>: TCP to WS tunnel for allowing regular
|
||||
SSH and SFTP clients to connect to converge.
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user