Skip to content

Commit

Permalink
Merge pull request #20 from georgep1ckers/combine-run-and-delete-scripts
Browse files Browse the repository at this point in the history
combine run and delete scripts
  • Loading branch information
georgep1ckers authored Nov 1, 2023
2 parents 25631aa + 56d406b commit aebdfd2
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 51 deletions.
12 changes: 0 additions & 12 deletions database-delete.sh

This file was deleted.

13 changes: 0 additions & 13 deletions database-run.sh

This file was deleted.

31 changes: 31 additions & 0 deletions run-tracey.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Create db configmap
kubectl apply -f tracey-database/postgresql-configmap.yaml

# Create db persistant volume chain
kubectl apply -f tracey-database/postgresql-pvc.yaml

# Create db deployment
kubectl apply -f tracey-database/postgresql-deployment.yaml

# Create db service
kubectl apply -f tracey-database/postgresql-service.yaml

# Wait for the database to be ready
echo "Waiting for database to be ready..."
kubectl wait --for=condition=ready pod -l app=postgresql --timeout=300s

# Once the database is ready, deploy the services
echo "Database is ready. Deploying services..."

# Create tracey stock-controller deployment & service combined yaml
kubectl apply -f stock-controller.yaml

# Create tracey processor deployment & service combined yaml
kubectl apply -f order-processor.yaml

# Create tracey interface deployment yaml
kubectl apply -f warehouse-interface.yaml

echo "Services deployed."
34 changes: 34 additions & 0 deletions stop-tracey.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Delete stock-controller deployment and service
kubectl delete deployment stock-controller
kubectl delete service stock-controller

# Delete order-processor deployment and service
kubectl delete deployment order-processor
kubectl delete service order-processor

# Delete warehouse-interface deployment
kubectl delete deployment warehouse-interface

# Wait for the deletion of the deployments to complete
kubectl wait --for=delete pod -l app=stock-controller --timeout=300s
kubectl wait --for=delete pod -l app=order-processor --timeout=300s
kubectl wait --for=delete pod -l app=warehouse-interface --timeout=300s

# Once the deployments are deleted, delete the database items
echo "Service containers removed. Deleting database items..."

# Delete configmap
kubectl delete configmap postgresql-init

# Delete db service
kubectl delete service postgresql

# Delete db deployment
kubectl delete deployment postgresql

# Delete db persistent volume claim
kubectl delete pvc postgresql-pvc

echo "Database items deleted."
16 changes: 0 additions & 16 deletions tracey-delete.sh

This file was deleted.

10 changes: 0 additions & 10 deletions tracey-run.sh

This file was deleted.

0 comments on commit aebdfd2

Please sign in to comment.