Initial Commit, Everything is working fine

This commit is contained in:
Christian Risi 2024-11-19 20:53:55 +01:00
parent 3268f8186d
commit b0a765aff7
7 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,24 @@
{
// Displayed name
"name": "IoT-Simulator",
// Service name from compose file
"service": "iot-simulator",
// Compose-File
"dockerComposeFile": ["../../docker-compose.yaml"],
// The WorkspaceFolder inside container
"workspaceFolder": "/workspace/IoT-Simulator",
// Env in container
"containerEnv": {
}
}

View File

@ -0,0 +1,24 @@
{
// Displayed name
"name": "Leader-Service",
// Service name from compose file
"service": "leader-service",
// Compose-File
"dockerComposeFile": ["../../docker-compose.yaml"],
// The WorkspaceFolder inside container
"workspaceFolder": "/workspace/Leader-Service",
// Env in container
"containerEnv": {
}
}

View File

@ -0,0 +1,24 @@
{
// Displayed name
"name": "nginx-mediator",
// Service name from compose file
"service": "nginx-mediator",
// Compose-File
"dockerComposeFile": ["../../docker-compose.yaml"],
// The WorkspaceFolder inside container
"workspaceFolder": "/workspace/nginx",
// Env in container
"containerEnv": {
}
}

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "IoT-Simulator"]
path = IoT-Simulator
url = https://repositories.communitynotfound.work/PoliBa-Software-Architecture/IoT-Simulator.git
[submodule "Leader-Service"]
path = Leader-Service
url = https://repositories.communitynotfound.work/PoliBa-Software-Architecture/Leader-Service.git

1
Leader-Service Submodule

@ -0,0 +1 @@
Subproject commit d44865db427d26b9af8702238e649b93bea7a841

45
docker-compose.yaml Normal file
View File

@ -0,0 +1,45 @@
name: "IoT-Gatherer-Project"
services:
iot-simulator:
image: "swift:latest"
volumes:
- .:/workspace
hostname: iot-simulator.internal
networks:
iot-network:
ipv4_address: 10.0.0.15
command: sleep infinity
leader-service:
image: denoland/deno
volumes:
- .:/workspace
hostname: leader-service.internal
networks:
iot-network:
ipv4_address: 10.0.0.2
command: sleep infinity
nginx-mediator:
image: "nginx:latest"
volumes:
- .:/workspace
- ./nginx/proxy.conf:/etc/nginx/nginx.conf
hostname: nginx-mediator.internal
networks:
iot-network:
ipv4_address: 10.0.0.10
command: sleep infinity
networks:
iot-network:
ipam:
config:
- subnet: 10.0.0.0/8
ip_range: 10.0.0.0/16

33
nginx/proxy.conf Normal file
View File

@ -0,0 +1,33 @@
http {
# Leader-Service-Proxy
server {
# TODO: Change IP to a well defined one
listen *:80; # This is for testing purposes ONLY, to be changed to 443
server_name "nginx-mediator.internal";
location / {
proxy_pass "http://leader-service.internal";
proxy_pass_request_headers on;
proxy_pass_request_body on;
proxy_set_header X-Forwarded-For $sent_http_x_iot_ip; # X-IoT-IP
}
}
# IoT-Simulator Proxy
server {
listen *:80; # This is for testing purposes ONLY, to be changed to 443
location / {
proxy_pass "http://iot-simulator.internal";
proxy_pass_request_headers on;
proxy_pass_request_body on;
proxy_set_header X-Forwarded-Host $sent_http_x_iot_ip; # Set forwarded host to keep the original IP request
}
}
}