-
Notifications
You must be signed in to change notification settings - Fork 714
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
how do i use a postgres database instance on aws ? #15
Comments
Postgress deployment
postgressService.yaml
secret.yaml
Now also change the backendDeployment.yaml so that you can connect to postgress
|
Thank you for this solution I am grateful, 🙏🏼 , I later found out that I
want to deploy my application of a java back-end and front-end angular js
with terraform, Jenkins docker and kubernetes on AWS, please can you
explain how the three tier application would look like?
Thank you 😊 in advance
…On Tue, 16 Jan 2024, 6:33 am anishbista60, ***@***.***> wrote:
Postgress deployment
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: workshop
name: postgresql
spec:
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: postgres:latest
ports:
- containerPort: 5432
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "500m"
env:
- name: POSTGRES_DB
value: mydatabase
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-sec
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-sec
key: password
postgressService.yaml
apiVersion: v1
kind: Service
metadata:
namespace: workshop
name: postgresql-svc
spec:
selector:
app: postgresql
ports:
- name: postgresql-svc
protocol: TCP
port: 5432
targetPort: 5432
secret.yaml
apiVersion: v1
kind: Secret
metadata:
namespace: workshop
name: postgres-sec
type: Opaque
data:
password: cGFzc3dvcmQxMjM= # password123 base64 encoded
username: YWRtaW4= # admin base64 encoded
Now also change the below backendDeployment.yaml so that you can connect
to postgress
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: workshop
labels:
role: api
env: demo
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 25%
selector:
matchLabels:
role: api
template:
metadata:
labels:
role: api
spec:
containers:
- name: api
image: public.ecr.aws/w8u5e4v2/workshop-backend:v1
imagePullPolicy: Always
env:
- name: DATABASE_URL
value: ***@***.***:5432/mydatabase
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-sec
key: username
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-sec
key: password
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /ok
port: 8080
initialDelaySeconds: 2
periodSeconds: 5
readinessProbe:
httpGet:
path: /ok
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4COXFHH4YC5ZNBXYTS3KDYOYGKJAVCNFSM6AAAAABB3YY422VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGA4TONRQGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do i use a postgres database instance on aws that is running instaead of mongodb here? https://github.com/AmanPathak-DevOps/TWSThreeTierAppChallenge/tree/main/k8s_manifests/mongo
The text was updated successfully, but these errors were encountered: