Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a44e894
Comment out push and pull_request triggers in CI workflow
YosefKahlon Jun 15, 2025
810fde7
week7
YosefKahlon Jun 17, 2025
30e77cc
Add GitHub Actions CI workflow for Docker Compose Week 7
YosefKahlon Jun 17, 2025
b21c6e8
Add push trigger for week7 branch in CI workflow
YosefKahlon Jun 17, 2025
08d63c5
Comment out week7 branch trigger in CI workflow and update upload-art…
YosefKahlon Jun 17, 2025
1793e6d
Uncomment week7 branch trigger in CI workflow and ensure Docker Compo…
YosefKahlon Jun 17, 2025
e7c3a84
Refactor Docker Compose commands in CI workflow to specify file path
YosefKahlon Jun 17, 2025
f971971
Add step to retrieve running containers and use variable for backend …
YosefKahlon Jun 17, 2025
b7ea9fe
Update healthcheck start period to 60s for backend service
YosefKahlon Jun 17, 2025
d690a1d
Increase healthcheck retries from 3 to 5 for backend service
YosefKahlon Jun 17, 2025
b212119
Update healthcheck start period to 10s for backend service
YosefKahlon Jun 17, 2025
07ae50e
Update healthcheck interval to 10s and timeout to 5s for backend service
YosefKahlon Jun 17, 2025
9512a03
Add healthcheck configuration for db service in docker-compose
YosefKahlon Jun 17, 2025
36408b4
Ensure backend service depends on db service health status
YosefKahlon Jun 17, 2025
c12e5d6
..
YosefKahlon Jun 17, 2025
c25a4d7
Increase healthcheck start period for db service from 10s to 30s
YosefKahlon Jun 17, 2025
6f6b331
Add verbose output to backend service healthcheck command
YosefKahlon Jun 17, 2025
c694a0d
Comment out unused user routes and database retry logic in server and…
YosefKahlon Jun 17, 2025
67403e3
Refactor CI workflow and Docker setup; enable health checks for servi…
YosefKahlon Jun 17, 2025
38a93e1
Update Docker commands in CI workflow to use 'docker compose' syntax
YosefKahlon Jun 17, 2025
c80c414
Refactor CI workflow for end-to-end tests; streamline steps, enhance …
YosefKahlon Jun 17, 2025
8bdfb60
Refactor CI workflow; simplify Docker commands, enhance healthcheck l…
YosefKahlon Jun 17, 2025
e96b960
Fix working directory paths in CI workflow for consistency
YosefKahlon Jun 17, 2025
fe5fc67
Add health check for backend service in CI workflow
YosefKahlon Jun 17, 2025
3178d39
Refactor CI workflow and update documentation for Azure VM deployment…
YosefKahlon Jun 18, 2025
c630e45
Add workflow_dispatch trigger to CI for manual execution
YosefKahlon Jun 18, 2025
25c6bc9
Refactor Azure VM deployment steps in CI workflow; update SSH command…
YosefKahlon Jun 18, 2025
c3a8c97
Automate Azure VM deployment using GitHub Actions; add deployment ste…
YosefKahlon Jun 18, 2025
5b983e6
Update README.md to improve structure and clarity; remove outdated se…
YosefKahlon Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: CI Workflow

on:
push:
branches:
- week5
- main
pull_request:
branches:
- main
# push:
# branches:
# - week5
# - main
# pull_request:
# branches:
# - main
workflow_dispatch:

env:
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/ci_week7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: End-to-End Tests

on:
push:
branches: [week7]
workflow_dispatch:


jobs:
e2e:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker containers
run: docker compose build
working-directory: week7

- name: Start containers
run: docker compose up -d
working-directory: week7

- name: Wait for DB healthcheck
run: |
timeout=30
for i in $(seq 1 $timeout); do
status=$(docker inspect --format='{{.State.Health.Status}}' $(docker compose ps -q db))
echo "DB health: $status"
[ "$status" = "healthy" ] && break
sleep 1
done
working-directory: week7

- name: Wait for backend to become healthy
run: |
timeout=30
for i in $(seq 1 $timeout); do
status=$(docker inspect --format='{{.State.Health.Status}}' $(docker compose ps -q backend))
echo "Backend health: $status"
[ "$status" = "healthy" ] && break
sleep 1
done
working-directory: week7

- name: Test API endpoints
run: |
curl --fail http://localhost:3000/health
curl --fail http://localhost:3000/api/users
working-directory: week7

- name: Capture logs on failure
if: failure()
run: docker compose logs > full_logs.txt
working-directory: week7

- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: docker-compose-logs
path: week7/full_logs.txt

- name: Shut down containers
if: always()
run: docker compose down --volumes
working-directory: week7


deploy:
needs: e2e
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.AZURE_VM_KEY }}" > ~/.ssh/myDockerVM_key.pem
chmod 600 ~/.ssh/myDockerVM_key.pem

- name: Copy files to Azure VM (excluding frontend)
run: |
rsync -av --exclude=frontend -e "ssh -i ~/.ssh/myDockerVM_key.pem -o StrictHostKeyChecking=no" week7/ ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }}:~/week7/

- name: Deploy with Docker Compose on Azure VM
run: |
ssh -i ~/.ssh/myDockerVM_key.pem -o StrictHostKeyChecking=no ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }} '
cd ~/week7 && docker-compose up --build -d
'

- name: Check service health on Azure VM
run: |
ssh -i ~/.ssh/myDockerVM_key.pem -o StrictHostKeyChecking=no ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }} '
curl -f http://localhost:3000/health
'

- name: Shut down containers on Azure VM
if: always()
run: |
ssh -i ~/.ssh/myDockerVM_key.pem -o StrictHostKeyChecking=no ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }} '
cd ~/week7 && docker-compose down --volumes
'
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# DevOps & Linux Learning Repository

This repository contains my hands-on notes, scripts, and project work for learning DevOps, Linux, Docker, CI/CD, and cloud deployment.

# Part 1
* [Linux basic commands](./week1/Intro%20to%20DevOps%20and%20Linux.md)

# Part 2

* [Intro to Shell scripting](./week2_practice/Shell%20scripting.md)

* [Advanced Log Report Automation](./week2_Summary/Advanced%20Log%20Report%20Automation.md)

# Part 3
* [Networking & SSH](./week3_practice/Networking%20&%20SSH.md)

# Part 4

* [Advanced Git & GitHub](./week4/github_practice.md)

# Part 5

* [CI/CD with GitHub Action](./week5/CICD_with_GitHub_Actions.md)

* [Docker-Containers](./week6/Docker-Containers.md)


# Prat 6
* [Docker-Containers](./week6/Docker-Containers.md)
* [Docker Compose & Azure + VM ](./week7/Docker%20Compose%20&%20Azure+VM.md)
34 changes: 34 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@types/cors/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions node_modules/@types/cors/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions node_modules/@types/cors/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions node_modules/@types/cors/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading