Merge pull request #7 from DanySK/patch-1 #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Application to AWS EC2 Instance | |
on: | |
push: | |
branches: | |
- prepDeploy | |
- main | |
jobs: | |
Deploy: | |
name: Deploy to EC2 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build & Deploy | |
env: | |
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
HOSTNAME: ${{secrets.SSH_HOST}} | |
USER_NAME: ${{secrets.USER_NAME}} | |
run: | | |
echo "$PRIVATE_KEY" > ./private_key && chmod 600 ./private_key | |
cat ./private_key | |
ssh -o StrictHostKeyChecking=no -i ./private_key ${USER_NAME}@${HOSTNAME} ' | |
# Now we have got the access of EC2 and we will start the deploy . | |
kubectl delete --all svc | |
kubectl delete --all deploy | |
kubectl delete --all pods | |
sudo docker container delete vue-app | |
minikube start | |
cd my-dashboard/ | |
sudo docker pull leomarzoli/traffic_management_system:latest | |
kubectl apply -f intersection-agents-deployment.yaml,intersection-agents-service.yaml,spring-db-app-deployment.yaml,spring-db-app-service.yaml,user-db-deployment.yaml,user-db-service.yaml | |
docker run -it --rm --add-host=host.docker.internal:host-gateway -d -p 8080:80 --name vue-app leomarzoli/traffic_management_system:latest | |
minikube tunnel -c | |
' |