Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
ref :[server] guacenc copied inside Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrg3se committed Sep 16, 2020
1 parent 704727e commit 6bf41f1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
12 changes: 10 additions & 2 deletions build/docker/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ COPY dashboard ./

RUN yarn run build

FROM ubuntu:xenial-20200706

FROM debian:stable-slim
USER root
WORKDIR /trasa
ENV GUACENC_INSTALLED=true
COPY --from=seknox/guacd:v0.0.1 /usr/local/guacamole/bin/guacenc /usr/local/guacamole/bin/guacenc
COPY --from=seknox/guacd:v0.0.1 /usr/local/guacamole/lib/ /usr/local/guacamole/lib/
COPY --from=seknox/guacd:v0.0.1 /usr/local/guacamole/DEPENDENCIES /usr/local/guacamole/

RUN apt-get update
RUN apt-get install -y --no-install-recommends ca-certificates
RUN apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev ffmpeg
RUN apt-get install -y $(cat /usr/local/guacamole/DEPENDENCIES)

RUN update-ca-certificates
COPY --from=gobuilder /go/src/seknox/trasa/server/server .
COPY --from=dashbuilder /trasa/build /var/trasa/dashboard
Expand Down
2 changes: 1 addition & 1 deletion build/etc/trasa/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
sshlistenAddr = "127.0.0.1:8022"
dbListenAddr = "127.0.0.1:3333"
guacdEnabled = false
guacdAddr = "127.0.0.1:4822"
guacdAddr = "guacd:4822"


[vault]
Expand Down
6 changes: 6 additions & 0 deletions server/accessproxy/rdpproxy/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ func getGuacencCmd(sessionID string) *exec.Cmd {

func getFFMPEGcmd(tempFileDir, sessionID string) *exec.Cmd {

if os.Getenv("GUACENC_INSTALLED") == "true" {
ffmpegCmdStr := fmt.Sprintf("ffmpeg -i %s/%s.guac.m4v %s/%s.mp4", tempFileDir, sessionID, tempFileDir, sessionID)
return exec.Command("/bin/bash", "-c", ffmpegCmdStr)

}

if runtime.GOOS == "windows" {
ffmpegCmdStr := fmt.Sprintf(`ffmpeg.exe -i %s\%s.guac.m4v %s\%s.mp4`, tempFileDir, sessionID, tempFileDir, sessionID)
return exec.Command("powershell", "-c", ffmpegCmdStr)
Expand Down
2 changes: 1 addition & 1 deletion server/api/logs/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (s logStore) PutIntoMinio(objectName, logfilepath, bucketName string) error
if err != nil {
return err
}
return os.Rename(logfilepath, newpath)
return utils.MoveFile(logfilepath, newpath)

}

Expand Down
26 changes: 26 additions & 0 deletions server/utils/filesystem.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package utils

import (
"fmt"
"io"
"os"
"runtime"

Expand All @@ -17,6 +19,30 @@ func CreateDirIfNotExist(dir string) {
}
}

func MoveFile(sourcePath, destPath string) error {
inputFile, err := os.Open(sourcePath)
if err != nil {
return fmt.Errorf("Couldn't open source file: %s", err)
}
outputFile, err := os.Create(destPath)
if err != nil {
inputFile.Close()
return fmt.Errorf("Couldn't open dest file: %s", err)
}
defer outputFile.Close()
_, err = io.Copy(outputFile, inputFile)
inputFile.Close()
if err != nil {
return fmt.Errorf("Writing to output file failed: %s", err)
}
// The copy was successful, so now delete the original file
err = os.Remove(sourcePath)
if err != nil {
return fmt.Errorf("Failed removing original file: %s", err)
}
return nil
}

func GetETCDir() string {
switch runtime.GOOS {
case "windows":
Expand Down

0 comments on commit 6bf41f1

Please sign in to comment.