Skip to content

Commit

Permalink
updated eks
Browse files Browse the repository at this point in the history
  • Loading branch information
AsakerMohd committed Jan 29, 2024
1 parent bc27e6e commit 5e64cfd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ spec:
image: ${REPOSITORY_PREFIX}/pythonsampleapp/vehicle-inventory-service:latest
name: vehicle-inventory-backend
env:
- name: MYSQL_DATABASE
- name: POSTGRES_DATABASE
value: vehicle_inventory
- name: MYSQL_PASSWORD
value: ${MYSQL_PASSWORD}
- name: MYSQL_ROOT_PASSWORD
value: ${MYSQL_PASSWORD}
- name: MYSQL_USER
- name: POSTGRES_PASSWORD
value: ${POSTGRES_PASSWORD}
- name: POSTGRES_USER
value: djangouser
imagePullPolicy: Always
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,31 @@ spec:
spec:
containers:
- env:
- name: MYSQL_DATABASE
- name: POSTGRES_DATABASE
value: vehicle_inventory
- name: MYSQL_PASSWORD
value: ${MYSQL_PASSWORD}
- name: MYSQL_ROOT_PASSWORD
value: ${MYSQL_PASSWORD}
- name: MYSQL_USER
- name: POSTGRES_PASSWORD
value: ${POSTGRES_PASSWORD}
- name: POSTGRES_USER
value: djangouser
image: mysql:8.0
image: postgres:14.0
livenessProbe:
exec:
command:
- mysql
- -h
- localhost
- -u
- root
- -p${MYSQL_PASSWORD}
- -e
- SELECT 1
- pg_isready
- -d
- vehicle_inventory
- -U
- djangouser
failureThreshold: 10
timeoutSeconds: 20
name: vehicle-inventory-db
ports:
- containerPort: 3306
hostPort: 3306
- containerPort: 5432
hostPort: 5432
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /var/lib/mysql
- mountPath: /var/lib/postgres
name: data
restartPolicy: Always
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ rm VehicleInventoryApp/.env
rm ImageServiceApp/.env
rm .env

echo "POSTGRES_ROOT_PASSWORD=${password}" >> VehicleInventoryApp/.env
echo "POSTGRES_DATABASE=vehicle_inventory" >> VehicleInventoryApp/.env
echo "POSTGRES_USER=djangouser" >> VehicleInventoryApp/.env
echo "POSTGRES_PASSWORD=${password}" >> VehicleInventoryApp/.env
Expand All @@ -37,7 +36,6 @@ echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> ImageServiceApp/.env
echo "AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}" >> ImageServiceApp/.env
echo "S3_BUCKET=${s3_bucket}" >> ImageServiceApp/.env

echo "POSTGRES_ROOT_PASSWORD=${password}" >> .env
echo "POSTGRES_DATABASE=vehicle_inventory" >> .env
echo "POSTGRES_USER=djangouser" >> .env
echo "POSTGRES_PASSWORD=${password}" >> .env
Expand Down
7 changes: 3 additions & 4 deletions sample-applications/vehicle-dealership-sample-app/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ rm ImageServiceApp/.env
touch ImageServiceApp/.env

export REPOSITORY_PREFIX=${account}.dkr.ecr.$region.amazonaws.com
export MYSQL_ROOT_PASSWORD=${password}
export MYSQL_DATABASE=vehicle_inventory
export MYSQL_USER=djangouser
export MYSQL_PASSWORD=${password}
export POSTGRES_DATABASE=vehicle_inventory
export POSTGRES_USER=djangouser
export POSTGRES_PASSWORD=${password}
export S3_BUCKET=${s3_bucket}

docker-compose build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ then
else
for config in $(ls ./eks/*.yaml)
do
sed -e 's#\${REPOSITORY_PREFIX}'"#${REPOSITORY_PREFIX}#g" -e 's#\${MYSQL_PASSWORD}'"#${MYSQL_PASSWORD}#g" -e 's#\${S3_BUCKET}'"#${S3_BUCKET}#g" ${config} | kubectl ${OPERATION} -f -
sed -e 's#\${REPOSITORY_PREFIX}'"#${REPOSITORY_PREFIX}#g" -e 's#\${POSTGRES_PASSWORD}'"#${POSTGRES_PASSWORD}#g" -e 's#\${S3_BUCKET}'"#${S3_BUCKET}#g" ${config} | kubectl ${OPERATION} -f -
done

for config in $(ls ./eks/k8s-nginx-ingress/*.yaml)
do
sed -e 's#\${REPOSITORY_PREFIX}'"#${REPOSITORY_PREFIX}#g" -e 's#\${MYSQL_PASSWORD}'"#${MYSQL_PASSWORD}#g" -e 's#\${S3_BUCKET}'"#${S3_BUCKET}#g" ${config} | kubectl ${OPERATION} -f -
sed -e 's#\${REPOSITORY_PREFIX}'"#${REPOSITORY_PREFIX}#g" -e 's#\${POSTGRES_PASSWORD}'"#${POSTGRES_PASSWORD}#g" -e 's#\${S3_BUCKET}'"#${S3_BUCKET}#g" ${config} | kubectl ${OPERATION} -f -
done
fi

0 comments on commit 5e64cfd

Please sign in to comment.