Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab8 #8

Merged
merged 21 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Lab 6 bonus task + crucial bug fixes in app_go
  • Loading branch information
kolayne committed Mar 9, 2024
commit e02c0830f5b7978dae17b9b315b06d337f7e913a
18 changes: 18 additions & 0 deletions ansible/playbooks/dev/app_go/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- name: Deploy go app
hosts: all
roles:
- name: "Deploy kolay0ne/app_go:lab6"
role: web_app
image_name: "kolay0ne/app_go"
image_tag: "lab6"
publish_ports:
- "5500:5000"
wipe: false
tags: [] # Run by default

- name: "Wipe kolay0ne/app_go:lab6"
role: web_app
image_name: "kolay0ne/app_go"
image_tag: "lab6"
wipe: true
tags: [never, wipe] # Only run on wipe
5 changes: 3 additions & 2 deletions app_go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ COPY go.mod *.go /usr/src/app/
RUN ["env", "CGO_ENABLED=0", "go", "build", "-o", "catfact_webapp", "."]


# Like `FROM scratch` but with SSL
FROM damdo/sscratch
FROM scratch
# Enable https requests from within the container
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

EXPOSE 5000

Expand Down
2 changes: 1 addition & 1 deletion app_go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
fact, err := catFact()
if err == nil {
w.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintf(w, fact)
_, _ = fmt.Fprintf(w, "%s", fact)
} else {
w.WriteHeader(http.StatusInternalServerError)
_, _ = fmt.Fprintf(w, "Failed to query a cat fact :(")
Expand Down
Loading