Skip to content

Commit 61e0bba

Browse files
authored
Merge pull request #28 from Gachon-Univ-Creative-Code-Innovation/fix/GUC-236-fix-with-cloud
Fix/guc 236 fix with cloud
2 parents f072631 + fbab7d9 commit 61e0bba

5 files changed

Lines changed: 24 additions & 10 deletions

File tree

k8s/github-service.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: github-service
5-
namespace: github-service
5+
namespace: github
6+
annotations:
7+
prometheus.io/scrape: "true"
8+
prometheus.io/path: "/metrics"
9+
prometheus.io/port: "4886"
610
spec:
711
replicas: 1
812
selector:
@@ -12,6 +16,10 @@ spec:
1216
metadata:
1317
labels:
1418
app: github-service
19+
annotations:
20+
prometheus.io/scrape: "true"
21+
prometheus.io/path: "/metrics"
22+
prometheus.io/port: "4886"
1523
spec:
1624
containers:
1725
- name: github-service
@@ -31,12 +39,12 @@ apiVersion: v1
3139
kind: Service
3240
metadata:
3341
name: github-service
34-
namespace: github-service
42+
namespace: github
3543
spec:
3644
selector:
3745
app: github-service
3846
ports:
3947
- protocol: TCP
40-
port: 4886
48+
port: 80
4149
targetPort: 4886
4250
type: ClusterIP

k8s/postgres.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ apiVersion: v1
22
kind: PersistentVolumeClaim
33
metadata:
44
name: postgres-pvc
5-
namespace: github-service
5+
namespace: github
66
spec:
77
accessModes:
88
- ReadWriteOnce
99
resources:
1010
requests:
1111
storage: 1Gi
12+
storageClassName: gp2
1213
---
1314
apiVersion: apps/v1
1415
kind: Deployment
1516
metadata:
1617
name: postgres
17-
namespace: github-service
18+
namespace: github
1819
spec:
1920
replicas: 1
2021
selector:
@@ -37,6 +38,8 @@ spec:
3738
value: "password"
3839
- name: POSTGRES_DB
3940
value: "careerDB"
41+
- name: PGDATA
42+
value: "/var/lib/postgresql/data/pgdata"
4043
volumeMounts:
4144
- name: postgres-storage
4245
mountPath: /var/lib/postgresql/data
@@ -49,7 +52,7 @@ apiVersion: v1
4952
kind: Service
5053
metadata:
5154
name: postgres
52-
namespace: github-service
55+
namespace: github
5356
spec:
5457
selector:
5558
app: postgres

k8s/올리기.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
kubectl create namespace github-service
1+
kubectl create namespace github
22

3-
kubectl create secret generic github-service-secret --from-file=.env -n github-service
3+
kubectl create secret generic github-service-secret --from-file=.env -n github
44

55
kubectl apply -f ./k8s/
66

7-
kubectl exec -it <postgreSQL pod> -n github-servic -- bash
7+
kubectl exec -it <postgreSQL pod> -n github -- bash
88
psql -U user -d careerDB
99

1010
create table public."README_Data" (

main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pydantic import BaseModel
55
import httpx
66
import tempfile
7+
from prometheus_fastapi_instrumentator import Instrumentator
78

89
from src.READMECreater.GithubFetcher import DownloadRepoFiles
910
from src.READMECreater.READMEGenerator import GenerateREADME
@@ -20,6 +21,7 @@
2021
from src.Utils.DBClient import ReadGithubFromUserID, ReadREADMEDB, ReadImageFromUserID
2122

2223
app = FastAPI(title="GitHub AI API")
24+
instrumentator = Instrumentator().instrument(app).expose(app)
2325

2426

2527
class RepoRequest(BaseModel):

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ pyjwt
1111
pybase64
1212
supabase
1313
httpx
14-
psycopg2-binary
14+
psycopg2-binary
15+
prometheus-fastapi-instrumentator

0 commit comments

Comments
 (0)