okuda-seminar / Twitter-Clone

0 stars 0 forks source link

[Infra] Imprement Dockerfile for notifications service #356

Closed Rwatana closed 4 months ago

Rwatana commented 4 months ago

Issue Number

350

Implementation Summary

I imprement dockerfile to run notification service permanently and confirmed that the ingress service works properly.

Test

base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗ k get pod
NAME                                      READY   STATUS    RESTARTS   AGE
notifications-app-865d8d6bb7-rc74d        1/1     Running   0          5s
notifications-postgres-57d964699c-x9lxq   1/1     Running   0          2s
➜  base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗ curl -X POST localhost:80/api/notifications -d '{"text":"test", "tweet_id":"1234567"}'
➜  base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗ k logs notifications-app-865d8d6bb7-rc74d 
[notificationsapi] 16:54:20 HTTP "CreateTweetNotification" mounted on POST /api/notifications
[notificationsapi] 16:54:20 HTTP "./gen/http/openapi.json" mounted on GET /swagger.json
[notificationsapi] 16:54:20 HTTP server listening on "0.0.0.0:80"
[notificationsapi] 16:54:29 id=12O7Yf8- req=POST /api/notifications from=192.168.65.4
[notificationsapi] 16:54:29 notifications.CreateTweetNotification
[notificationsapi] 16:54:29 id=12O7Yf8- status=200 bytes=0 time=2.308708ms

Schedule

7/13

Rwatana commented 4 months ago

@nayuta-ai Please check my code.

ryuju0911 commented 4 months ago

app.Dockerfile is for development environment, not for building binary and running it. Please create another Dockerfile like this.

Rwatana commented 4 months ago

@nayuta-ai I have modified the changes and confirmed that the service works properly. Please check my code.

➜  base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗ curl -X POST localhost:80/api/notifications -d '{"text":"test", "tweet_id":"1234567"}'
➜  base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗ k logs notifications-app-66cd6ff8f9-ms7hz                                             
[notificationsapi] 16:00:00 HTTP "CreateTweetNotification" mounted on POST /api/notifications
[notificationsapi] 16:00:00 HTTP "./gen/http/openapi.json" mounted on GET /swagger.json
[notificationsapi] 16:00:00 HTTP server listening on "0.0.0.0:80"
[notificationsapi] 16:00:40 id=Eb4hgbi5 req=POST /api/notifications from=192.168.65.4
[notificationsapi] 16:00:40 notifications.CreateTweetNotification
[notificationsapi] 16:00:40 id=Eb4hgbi5 status=200 bytes=0 time=1.645459ms
➜  base git:(feature/#350_Imprement_Dockerfile_for_notifications_service) ✗