diff --git a/.github/workflows/deployApp.yaml b/.github/workflows/deployApp.yaml new file mode 100644 index 0000000..0ab489d --- /dev/null +++ b/.github/workflows/deployApp.yaml @@ -0,0 +1,41 @@ +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 + ' \ No newline at end of file diff --git a/README.md b/README.md index 93603cb..c6c1f40 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ Project for both SPA and SPE -Link to the [documentation (DOC).](https://marzolileo.github.io/Traffic-Management/) +Link to the [documentation (DOC).](https://fpirazz.github.io/Traffic-Management/)