Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/terraform-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: AWS
url: "https://client.${{ steps.terraform.outputs.public_ip }}.nip.io"
url: "https://client.${{ steps.terraform.outputs.public_ip }}.sslip.io"

steps:
- name: Checkout Code
Expand Down Expand Up @@ -71,4 +71,4 @@ jobs:
echo "=== Testing SSH Connection ==="
ssh -i vockey.pem -o StrictHostKeyChecking=no ubuntu@${{ steps.terraform.outputs.public_ip }} "echo 'SSH connection successful'"
echo "=== Running Ansible Playbook ==="
ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_DEBUG=1 ansible-playbook -i inventory.yml playbooks/deploy.yml -vvv --extra-vars "ansible_host=${{ steps.terraform.outputs.public_ip }}" --start-at-task="Test connection"
ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_DEBUG=1 ansible-playbook -i inventory.yml playbooks/deploy.yml -vvv --extra-vars "ansible_host=${{ steps.terraform.outputs.public_ip }} EC2_PUBLIC_IP=${{ steps.terraform.outputs.public_ip }}" --start-at-task="Test connection"
108 changes: 82 additions & 26 deletions deployment/compose.aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ services:
client:
image: ghcr.io/aet-devops25/team-devoops/client:latest
environment:
- API_BASE_URL=https://api.${EC2_PUBLIC_IP}.nip.io
- API_BASE_URL=https://api.${EC2_PUBLIC_IP}.sslip.io
labels:
- traefik.enable=true
- traefik.http.routers.client.entrypoints=websecure
- traefik.http.routers.client.rule=Host(`client.${EC2_PUBLIC_IP}.nip.io`)
- traefik.http.routers.client.rule=Host(`client.${EC2_PUBLIC_IP}.sslip.io`)
- traefik.http.routers.client.tls.certresolver=letsencrypt
- traefik.http.services.client.loadbalancer.server.port=80
- traefik.http.middlewares.client-compress.compress=true
Expand All @@ -46,73 +46,129 @@ services:
gateway-service:
image: ghcr.io/aet-devops25/team-devoops/server/gateway:latest
container_name: gateway-service
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.gateway.entrypoints=websecure
- traefik.http.routers.gateway.rule=Host(`api.${EC2_PUBLIC_IP}.nip.io`)
- traefik.http.routers.gateway.rule=Host(`api.${EC2_PUBLIC_IP}.sslip.io`)
- traefik.http.routers.gateway.tls.certresolver=letsencrypt
- traefik.http.services.gateway.loadbalancer.server.port=8080
depends_on:
chat-service:
meetatmensa-matching:
condition: service_started
required: true
matching-service:
meetatmensa-user:
condition: service_started
required: true
user-service:
meetatmensa-genai:
condition: service_started
required: true
networks:
- backend

chat-service:
image: ghcr.io/aet-devops25/team-devoops/server/chat:latest
container_name: chat-service
labels:
- traefik.enable=true
- traefik.http.routers.chat.entrypoints=websecure
- traefik.http.routers.chat.rule=Host(`api.${EC2_PUBLIC_IP}.nip.io`) && PathPrefix(`/chat`)
- traefik.http.routers.chat.tls.certresolver=letsencrypt
- traefik.http.services.chat.loadbalancer.server.port=80
networks:
- backend

matching-service:

meetatmensa-matching:
image: ghcr.io/aet-devops25/team-devoops/server/matching:latest
container_name: matching-service
container_name: meetatmensa-matching
labels:
- traefik.enable=true
- traefik.http.routers.matching.entrypoints=websecure
- traefik.http.routers.matching.rule=Host(`api.${EC2_PUBLIC_IP}.nip.io`) && PathPrefix(`/matching`)
- traefik.http.routers.matching.rule=Host(`api.${EC2_PUBLIC_IP}.sslip.io`) && PathPrefix(`/matching`)
- traefik.http.routers.matching.tls.certresolver=letsencrypt
- traefik.http.services.matching.loadbalancer.server.port=80
depends_on:
- match-database
networks:
- backend

user-service:
meetatmensa-user:
image: ghcr.io/aet-devops25/team-devoops/server/user:latest
container_name: user-service
container_name: meetatmensa-user
labels:
- traefik.enable=true
- traefik.http.routers.user.entrypoints=websecure
- traefik.http.routers.user.rule=Host(`api.${EC2_PUBLIC_IP}.nip.io`) && PathPrefix(`/user`)
- traefik.http.routers.user.rule=Host(`api.${EC2_PUBLIC_IP}.sslip.io`) && PathPrefix(`/user`)
- traefik.http.routers.user.tls.certresolver=letsencrypt
- traefik.http.services.user.loadbalancer.server.port=80
depends_on:
- user-database
networks:
- backend

genai-service:
meetatmensa-genai:
image: ghcr.io/aet-devops25/team-devoops/genai:latest
container_name: genai-service
container_name: meetatmensa-genai
labels:
- traefik.enable=true
- traefik.http.routers.genai.entrypoints=websecure
- traefik.http.routers.genai.rule=Host(`api.${EC2_PUBLIC_IP}.nip.io`) && PathPrefix(`/genai`)
- traefik.http.routers.genai.rule=Host(`api.${EC2_PUBLIC_IP}.sslip.io`) && PathPrefix(`/genai`)
- traefik.http.routers.genai.tls.certresolver=letsencrypt
- traefik.http.services.genai.loadbalancer.server.port=80
networks:
- backend

match-database:
image: ghcr.io/aet-devops25/team-devoops/matchdb:latest
container_name: meetatmensa-matchdb
environment:
- MYSQL_ROOT_PASSWORD=root
volumes:
- matchdb_data:/var/lib/mysql
expose:
- "3306"
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
start_period: 30s
networks:
- backend

user-database:
image: ghcr.io/aet-devops25/team-devoops/userdb:latest
container_name: meetatmensa-userdb
environment:
- MYSQL_ROOT_PASSWORD=root
volumes:
- userdb_data:/var/lib/mysql
expose:
- "3306"
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
start_period: 30s
networks:
- backend

# Simple health check service
health-check:
image: curlimages/curl:latest
container_name: health-check
restart: unless-stopped
command: >
sh -c "
while true; do
echo 'Checking services...'
curl -f http://gateway-service:8080/ || echo 'Gateway down'
curl -f http://meetatmensa-matching:80/ || echo 'Matching down'
curl -f http://meetatmensa-user:80/ || echo 'User down'
sleep 30
done"
depends_on:
- gateway-service
- meetatmensa-matching
- meetatmensa-user
networks:
- backend

networks:
backend:
driver: bridge

volumes:
matchdb_data:
userdb_data:
4 changes: 2 additions & 2 deletions infrastructure/ansible/playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
dest: "{{ deployment_dir }}/compose.aws.yml"
mode: "0644"

- name: Create .env.prod file
- name: Create .env.prod file
template:
src: "{{ playbook_dir }}/../templates/env.prod.j2"
dest: "{{ app_dir }}/.env.prod"
Expand All @@ -105,4 +105,4 @@
remove_orphans: yes
environment:
DOCKER_BUILDKIT: 1
EC2_PUBLIC_IP: "{{ ansible_host }}"
EC2_PUBLIC_IP: "{{ ansible_host }}"
8 changes: 4 additions & 4 deletions infrastructure/ansible/templates/env.prod.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EC2_PUBLIC_IP={{ lookup('env', 'EC2_PUBLIC_IP') }}
CLIENT_HOST=client.{{ lookup('env', 'EC2_PUBLIC_IP') }}.nip.io
SERVER_HOST=api.{{ lookup('env', 'EC2_PUBLIC_IP') }}.nip.io
PUBLIC_API_URL=https://api.{{ lookup('env', 'EC2_PUBLIC_IP') }}.nip.io
EC2_PUBLIC_IP={{ EC2_PUBLIC_IP }}
CLIENT_HOST=client.{{ EC2_PUBLIC_IP }}.nip.io
SERVER_HOST=api.{{ EC2_PUBLIC_IP }}.nip.io
PUBLIC_API_URL=https://api.{{ EC2_PUBLIC_IP }}.nip.io
2 changes: 1 addition & 1 deletion infrastructure/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variable "ami_id" {
variable "instance_type" {
description = "Instance type for the EC2 instance"
type = string
default = "t2.micro"
default = "t3.small"
}

variable "aws_ec2_private_key" {
Expand Down
2 changes: 1 addition & 1 deletion server/gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spring:
- "http://127.0.0.1:8080"
- "https://app.meetatmensa.com"
- "http://app.meetatmensa.com"
- "https://client.34.193.74.92.nip.io"
- "https://client.54.204.29.206.sslip.io"
allowedMethods:
- GET
- POST
Expand Down