diff --git a/.github/workflows/chat-server-ci-cd.yaml b/.github/workflows/chat-server-ci-cd.yaml index 9b75d6e..4b11fdf 100644 --- a/.github/workflows/chat-server-ci-cd.yaml +++ b/.github/workflows/chat-server-ci-cd.yaml @@ -32,6 +32,8 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Deploy the container with latest image uses: appleboy/ssh-action@v0.1.10 @@ -42,5 +44,5 @@ jobs: port: ${{ secrets.PORT }} command_timeout: 30m script: | - docker compose -f chat-server.yaml down + docker pull harisheoran/my-chat-system-server:main docker compose -f chat-server.yaml up -d diff --git a/chat-client/bin/api b/chat-client/bin/api new file mode 100755 index 0000000..e666f8f Binary files /dev/null and b/chat-client/bin/api differ diff --git a/chat-client/go.mod b/chat-client/go.mod new file mode 100644 index 0000000..371cc87 --- /dev/null +++ b/chat-client/go.mod @@ -0,0 +1,5 @@ +module github.com/harisheoran/my-chat-client + +go 1.23.3 + +require github.com/gorilla/mux v1.8.1 diff --git a/chat-client/go.sum b/chat-client/go.sum new file mode 100644 index 0000000..7128337 --- /dev/null +++ b/chat-client/go.sum @@ -0,0 +1,2 @@ +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= diff --git a/chat-client/main.go b/chat-client/main.go new file mode 100644 index 0000000..abde5c8 --- /dev/null +++ b/chat-client/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "html/template" + "log" + "net/http" + + "github.com/gorilla/mux" +) + +func main() { + mainRouter := mux.NewRouter() + + mainRouter.HandleFunc("/v1/health", healthHandler) + mainRouter.HandleFunc("/v1/chat", homeHandler) + mainRouter.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./ui/static")))) + + log.Println("client listening on port 5000") + err := http.ListenAndServe(":5000", mainRouter) + if err != nil { + log.Fatal("Unable to start the server", err) + } +} + +func healthHandler(w http.ResponseWriter, request *http.Request) { + fmt.Fprintf(w, "my-chat-system client health is OK!") +} + +func homeHandler(w http.ResponseWriter, request *http.Request) { + uiTemplates := "ui/main.html" + templates, err := template.ParseFiles(uiTemplates) + if err != nil { + log.Println("ERROR: parsing the template files", err) + } + templates.Execute(w, nil) + +} diff --git a/chat-client/tmp/build-errors.log b/chat-client/tmp/build-errors.log new file mode 100644 index 0000000..67fc100 --- /dev/null +++ b/chat-client/tmp/build-errors.log @@ -0,0 +1 @@ +exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1 \ No newline at end of file diff --git a/chat-client/ui/base.gohtml b/chat-client/ui/base.gohtml new file mode 100644 index 0000000..2c7b07d --- /dev/null +++ b/chat-client/ui/base.gohtml @@ -0,0 +1,211 @@ + + +
+ + +Common Room
+Hello, Are you there?
+Just now
+ 1 +Danny Smith
+Lorem ipsum dolor sit.
+5 mins ago
+Alex Steward
+Lorem ipsum dolor sit.
+Yesterday
+Ashley Olsen
+Lorem ipsum dolor sit.
+Yesterday
+Kate Moss
+Lorem ipsum dolor sit.
+Yesterday
+Lara Croft
+Lorem ipsum dolor sit.
+Yesterday
+Brad Pitt
+Lorem ipsum dolor sit.
+5 mins ago
+ +Brad Pitt
+12 mins ago
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut + labore et dolore magna aliqua. +
+Lara Croft
+13 mins ago
++ Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque + laudantium. +
+Brad Pitt
+10 mins ago
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut + labore et dolore magna aliqua. +
+