Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
caa442a
added Ansible files
AlyAssem May 30, 2025
12bf597
updated github action for ansible provisioning
AlyAssem May 30, 2025
80f839b
naming --hot-fix
AlyAssem Jun 1, 2025
2c353f7
github action --hot-fix
AlyAssem Jun 1, 2025
419f7c4
github action --hot-fix
AlyAssem Jun 1, 2025
12f7c0a
test ssh connection in github action
AlyAssem Jun 1, 2025
e45b4df
test secret
AlyAssem Jun 1, 2025
184b43b
revert github action change
AlyAssem Jun 1, 2025
2c38148
debugging action
AlyAssem Jun 1, 2025
d7db73e
main.tf --hot-fix
AlyAssem Jun 1, 2025
508bd1a
debugging
AlyAssem Jun 1, 2025
0db2126
write private key into pem file before masking
AlyAssem Jun 1, 2025
93acb3b
trying with b64 private key
AlyAssem Jun 1, 2025
5802420
change ansible user
AlyAssem Jun 1, 2025
646b220
action --hot-fix
AlyAssem Jun 1, 2025
9f1ae11
change to ansible config and running verbose.
AlyAssem Jun 1, 2025
b7ede74
configuration fixes.
AlyAssem Jun 1, 2025
20c73dd
playbook fixes.
AlyAssem Jun 1, 2025
a51ef63
deployment compose fix.
AlyAssem Jun 1, 2025
54e36e0
fixes for playbook
AlyAssem Jun 1, 2025
4591cce
added prometheus and grafana to docker-compose.
AlyAssem Jul 14, 2025
de63890
added monitoring and 2 panels for mentorship-service.
AlyAssem Jul 14, 2025
4b0730e
added user-service monitoring.
AlyAssem Jul 16, 2025
7208323
added alerting for mentorship & user-service
AlyAssem Jul 16, 2025
b91866c
Merge branch 'main' into feature/setup-ansible-for-aws
AlyAssem Jul 18, 2025
73f23f1
Simple fixes to aws-ec2-deployment for production.
AlyAssem Jul 18, 2025
b521ac6
fixes and using env.production variable for traefik.
AlyAssem Jul 18, 2025
2ce647b
playbook --hot-fix
AlyAssem Jul 18, 2025
764821e
playbook fixes.
AlyAssem Jul 18, 2025
d6d7ab3
fix typo.
AlyAssem Jul 18, 2025
464f7e3
test adding env variables which are not secrets.
AlyAssem Jul 18, 2025
c0b0b5e
Create docker backend config files directory in EC2 instance.
AlyAssem Jul 18, 2025
f443508
remove build from compose.prod file
AlyAssem Jul 18, 2025
660c0ba
added gateway image.
AlyAssem Jul 18, 2025
1be30c8
added db init files to ansible playbook.
AlyAssem Jul 18, 2025
9c5989e
updated ec2 instance type.
AlyAssem Jul 18, 2025
ca26806
push github action changes.
AlyAssem Jul 19, 2025
43db31b
added jwt-key-generator script to ec2.
AlyAssem Jul 19, 2025
bbd69d4
remove unused step
AlyAssem Jul 19, 2025
89f14ca
typo --hot-fix
AlyAssem Jul 19, 2025
c5fe982
Fix ${user.home} path
Jul 19, 2025
d354c43
update volumes route for ec2.
AlyAssem Jul 19, 2025
e80b296
Merge branch 'feature/setup-ansible-for-aws' of github.com:AET-DevOps…
AlyAssem Jul 19, 2025
eb0c02a
fix for file route.
AlyAssem Jul 19, 2025
99659e7
fixes for production to ec2 compose
AlyAssem Jul 19, 2025
0fa91c4
refactor/renames and simple fixes
AlyAssem Jul 19, 2025
7035a9d
setup https
AlyAssem Jul 19, 2025
883a542
refactor/rename
AlyAssem Jul 19, 2025
d5f7f63
load deployment scripts.
AlyAssem Jul 20, 2025
d59c731
indentation fix.
AlyAssem Jul 20, 2025
fd6280e
fixes for waiting.
AlyAssem Jul 20, 2025
55c407a
load mock profiles json data
AlyAssem Jul 20, 2025
2730935
fix python f-string error.
AlyAssem Jul 20, 2025
9735859
remove create application that is not working currently.
AlyAssem Jul 20, 2025
0c69dc9
Merge remote-tracking branch 'origin/71-setup-monitoring-with-prometh…
AlyAssem Jul 20, 2025
15683d9
added monitoring to compose.aws.yml
AlyAssem Jul 20, 2025
40a66c0
copy monitoring directory into ec2.
AlyAssem Jul 20, 2025
f5f6422
create monitoring directory on ec2.
AlyAssem Jul 20, 2025
a689064
update mentor-service image tag.
AlyAssem Jul 20, 2025
dd2f33a
refactor/playbook.
AlyAssem Jul 20, 2025
4d17f4f
update monitoring route.
AlyAssem Jul 20, 2025
05cf693
test
AlyAssem Jul 20, 2025
d172a04
prometheus config update.
AlyAssem Jul 20, 2025
ec15bcf
update monitoring with traefik
AlyAssem Jul 20, 2025
c2f6f4e
Merge branch 'main' into feature/setup-ansible-for-aws
AlyAssem Jul 20, 2025
237b4e9
format fix.
AlyAssem Jul 20, 2025
0ad77f0
Merge branch 'feature/setup-ansible-for-aws' of github.com:AET-DevOps…
AlyAssem Jul 20, 2025
cdaddfd
remove monitoring from local compose.
AlyAssem Jul 20, 2025
b77f89f
update compose.yml to align with main using nginx.
AlyAssem Jul 20, 2025
4cf0645
use latest for mentorship-service
AlyAssem Jul 20, 2025
93780f4
update security config for mentorship-service
AlyAssem Jul 20, 2025
9eaf1e2
disable ssl verification for data seeding.
AlyAssem Jul 20, 2025
4a68fdb
fix security config
AlyAssem Jul 20, 2025
4e5462c
add genai, rating-service to compose
AlyAssem Jul 20, 2025
4ef1e93
Merge remote-tracking branch 'origin/main' into feature/setup-ansible…
Ahmad-Diab Jul 20, 2025
9573450
Revert "add genai, rating-service to compose"
Ahmad-Diab Jul 20, 2025
8754698
Add deployment script for aet kubernetes cluster
Ahmad-Diab Jul 20, 2025
1cd0391
Add rating service, remove AUTHORIZATION_ENABLED and add deploy_aws.py
Ahmad-Diab Jul 20, 2025
5babd42
Add port binding
Ahmad-Diab Jul 20, 2025
c8f55e6
use port 8310 to load deployment data
Ahmad-Diab Jul 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 61 additions & 4 deletions .github/workflows/aws-ec2-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Manual Aws Ec2 deployment
on:
workflow_dispatch:
inputs:
private_key:
description: 'aws ssh key in a pem file'
SSH_PRIVATE_KEY_B64:
description: "Base64-encoded private SSH key"
required: true
AWS_ACCESS_KEY_ID:
description: 'aws access key id'
Expand All @@ -15,6 +15,9 @@ on:
AWS_SESSION_TOKEN:
description: 'running aws session token'
required: true
GHCR_TOKEN:
description: 'Personal Access Token for the GHCR'
required: true

jobs:
deploy:
Expand All @@ -30,17 +33,25 @@ jobs:
echo "::add-mask::${{ github.event.inputs.AWS_ACCESS_KEY_ID }}"
echo "::add-mask::${{ github.event.inputs.AWS_SECRET_ACCESS_KEY }}"
echo "::add-mask::${{ github.event.inputs.AWS_SESSION_TOKEN }}"
echo "::add-mask::${{ github.event.inputs.GHCR_TOKEN }}"


- name: Write ssh key to infra/priv.pem
- name: Decode and write SSH private key
run: |
echo "${{ github.event.inputs.private_key }}" > infra/priv.pem
mkdir -p infra
echo "${{ github.event.inputs.SSH_PRIVATE_KEY_B64 }}" | base64 -d > infra/priv.pem
chmod 400 infra/priv.pem

- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.12.1

- name: Install Ansible
uses: alex-oleshkevich/setup-ansible@v1.0.1
with:
version: "11.6.0"

- name: Create EC2
env:
AWS_ACCESS_KEY_ID: ${{ github.event.inputs.AWS_ACCESS_KEY_ID }}
Expand All @@ -49,3 +60,49 @@ jobs:
run: |
cd infra
make deploy

- name: Wait for EC2 to be ready
run: |
cd infra
IP=$(terraform output -raw ip)
echo "$IP" > instance_ip.txt
echo "Waiting for SSH on $IP..."
for i in {1..5}; do
nc -z -v -w5 $IP 22 && echo "SSH is ready!" && exit 0
echo "Retry $i: SSH not up yet"
sleep 10
done
echo "SSH never became available"
exit 1

- name: Inject IP into Ansible inventory
run: |
cd infra
ip=$(cat instance_ip.txt)
sed -i "s|\${ip}|$ip|g" inventory.ini

# - name: Test ssh connection
# run: |
# echo "${{ github.event.inputs.private_key }}" > infra/priv.pem
# chmod 400 infra/priv.pem
# ssh -o StrictHostKeyChecking=no -i infra/priv.pem admin@$(cat instance_ip.txt) 'echo SSH connection successful'

- name: Test SSH connection with debugging
run: |
ls -la infra/
cd infra
IP=$(terraform output -raw ip)
echo "Testing SSH connection to $IP..."
echo "Key file permissions:"
ls -l priv.pem
echo "Key file content (first line):"
head -n 1 priv.pem
echo "Attempting SSH connection..."
ssh -v -o StrictHostKeyChecking=no -i priv.pem ubuntu@$IP 'echo "SSH connection successful!"'

- name: Provision EC2
run: |
cd infra
echo "cr_username: ${{ github.actor }}" >> token.yml
echo "token: ${{ github.event.inputs.GHCR_TOKEN }}" >> token.yml
make ansible
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ celerybeat.pid

# Environments
.secrets.env
.env
!docker/backend_config_files/.env
.venv
env/
venv/
Expand Down Expand Up @@ -376,4 +378,9 @@ sketch
### Vue ###
# gitignore template for Vue.js projects
#
# Recommended template: Node.gitignore
# Recommended template: Node.gitignore


token.yml
# Helm
values.yaml
121 changes: 0 additions & 121 deletions compose.prod.yml

This file was deleted.

2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ services:

volumes:
db_data:
ollama_data:
ollama_data:
8 changes: 7 additions & 1 deletion infra/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PLAYBOOK ?= playbook.yml

ssh:
chmod 400 priv.pem
ssh -i priv.pem admin@$(shell terraform output -raw ip)
Expand All @@ -8,5 +10,9 @@ init:
deploy: init
terraform apply -input=false --auto-approve

ansible:
ansible-playbook -i inventory.ini $(PLAYBOOK) -vvv

teardown:
terraform destroy -input=false --auto-approve
terraform destroy -input=false --auto-approve

3 changes: 3 additions & 0 deletions infra/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
inventory = hosts.ini
remote_user = admin
Loading
Loading