Skip to content

Commit

Permalink
Merge pull request #41 from mxmueller/#356-Infrastruktur
Browse files Browse the repository at this point in the history
#356 infrastruktur
  • Loading branch information
Maytastico authored Sep 5, 2024
2 parents b13f55b + 4687153 commit a98012c
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 10 deletions.
4 changes: 2 additions & 2 deletions server/compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ services:
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
# - '21:21' # FTP

# Uncomment the next line if you uncomment anything in the section
# environment:
# Uncomment this if you want to change the location of
# the SQLite DB file within the container
# DB_SQLITE_FILE: "/data/database.sqlite"

# Uncomment this if IPv6 is not enabled on your host
# Uncomment this if IPv6 is not e nabled on your host
# DISABLE_IPV6: 'true'

volumes:
Expand Down
9 changes: 8 additions & 1 deletion server/compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ services:
required: false
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}" ]



redis_microservice:
build:
context: ./deployment/redis_microservice
dockerfile: Dockerfile
ports:
- "3004:5001"

volumes:
grafana_data:
influxdb_data:
Expand Down
15 changes: 8 additions & 7 deletions server/deployment/redis_microservice/RedisMircoservie.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import os


link = os.getenv("EMAIL_SMTP_SERVER")
port = os.getenv("EMAIL_SMTP_PORT")
password = os.getenv("EMAIL_SMTP_PASSWORD")


r = redis.Redis(host='redis', port=6379, db=0)
p = r.pubsub()
Expand All @@ -23,6 +27,7 @@

connected_clients = []


async def websocket_server(websocket, path):
connected_clients.append(websocket)
try:
Expand Down Expand Up @@ -65,7 +70,6 @@ def errorHandling(channel, data):
logging.error(beautifyLog(channel,data))
heading = f"Komponente {channel.replace('-logs', '')} hat einen fehler"
sendEmail(heading, data["message"])

if channel == "api-logs":
return
for item in publisherList:
Expand All @@ -76,20 +80,17 @@ def beautifyLog(channel, data):
return message

def sendEmail(subject, body):
link = os.getenv("EMAIL_SMTP_SERVER")
port = os.getenv("EMAIL_SMTP_PORT")
password = os.getenv("EMAIL_SMTP_PASSWORD")
senderEmail = 'blickbox@maytastix.de'
senderEmail = 'services@maytastix.de'
receiver_email = 'aronseidl17@gmail.com'
message = MIMEMultipart()
message["From"] = senderEmail
message["To"] = receiver_email
message["Subject"] = subject
message.attach(MIMEText(body, "plain"))
with smtplib.SMTP(link, port) as server:
with smtplib.SMTP(link, port) as server:
server.ehlo()
server.starttls()
server.login(senderEmail, password)
server.sendmail(senderEmail, receiver_email, message.as_string())


asyncio.run(redis_listener())
78 changes: 78 additions & 0 deletions server/prod/blickbox.maytastix.de
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

## For dashboard.example.com subdomain
server {
root /var/www/blickbox.maytastix.de;
index index.html;
server_name blickbox.maytastix.de;

location / {
proxy_pass http://localhost:3001/; # set this to the nextcloud port set in doccker-compose file
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

client_max_body_size 0;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";

access_log /var/log/nginx/valentin.access.log;
error_log /var/log/nginx/valentin.error.log;
}

location /api/ {
proxy_pass http://localhost:3002/; # set this to the nextcloud port set in doccker-compose file
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

client_max_body_size 0;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";

access_log /var/log/nginx/api.access.log;
error_log /var/log/nginx/api.error.log;
}

location /grafana/ {
proxy_pass http://localhost:3000/; # set this to the nextcloud port set in doccker-compose file
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

client_max_body_size 0;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";

access_log /var/log/nginx/graphana.access.log;
error_log /var/log/nginx/graphana.error.log;
}

location /logs/ {
proxy_pass http://localhost:3004/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/blickbox.maytastix.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/blickbox.maytastix.de/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = blickbox.maytastix.de) {
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
listen [::]:80;
server_name blickbox.maytastix.de;
return 404; # managed by Certbot


}

0 comments on commit a98012c

Please sign in to comment.