diff --git a/sample-applications/vehicle-dealership-sample-app/eks/backend-deployment.yaml b/sample-applications/vehicle-dealership-sample-app/eks/backend-deployment.yaml index b8fe8c99a..e67fb5ed5 100644 --- a/sample-applications/vehicle-dealership-sample-app/eks/backend-deployment.yaml +++ b/sample-applications/vehicle-dealership-sample-app/eks/backend-deployment.yaml @@ -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: diff --git a/sample-applications/vehicle-dealership-sample-app/eks/db-deployment.yaml b/sample-applications/vehicle-dealership-sample-app/eks/db-deployment.yaml index a17059ce1..aafef6a6d 100644 --- a/sample-applications/vehicle-dealership-sample-app/eks/db-deployment.yaml +++ b/sample-applications/vehicle-dealership-sample-app/eks/db-deployment.yaml @@ -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: diff --git a/sample-applications/vehicle-dealership-sample-app/local_script.sh b/sample-applications/vehicle-dealership-sample-app/local_script.sh index 88243da87..0f1625ffc 100644 --- a/sample-applications/vehicle-dealership-sample-app/local_script.sh +++ b/sample-applications/vehicle-dealership-sample-app/local_script.sh @@ -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 @@ -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 diff --git a/sample-applications/vehicle-dealership-sample-app/script.sh b/sample-applications/vehicle-dealership-sample-app/script.sh index 625f95469..6978b2243 100644 --- a/sample-applications/vehicle-dealership-sample-app/script.sh +++ b/sample-applications/vehicle-dealership-sample-app/script.sh @@ -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 diff --git a/sample-applications/vehicle-dealership-sample-app/scripts/deploy-eks.sh b/sample-applications/vehicle-dealership-sample-app/scripts/deploy-eks.sh index e8ed528e3..c9f7aae8a 100755 --- a/sample-applications/vehicle-dealership-sample-app/scripts/deploy-eks.sh +++ b/sample-applications/vehicle-dealership-sample-app/scripts/deploy-eks.sh @@ -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 \ No newline at end of file