Reorganised the webservers (temp for now) and docker-compose.yml now works

This commit is contained in:
2025-01-21 00:29:07 +00:00
parent 76991f0b39
commit 043effb6db
71 changed files with 147 additions and 130 deletions

View File

@@ -1,2 +0,0 @@
FLASK_APP=core.blueprints.__init__
FLASK_DEBUG=True

View File

@@ -5,6 +5,7 @@ services:
context: ./nginx
ports:
- "1935:1935" # RTMP
- "8080:8080"
depends_on:
- flask
networks:
@@ -12,7 +13,7 @@ services:
flask:
build:
context: ./core
context: ./web_server
ports:
- "5000:5000"
networks:

View File

@@ -1,26 +1,7 @@
FROM ubuntu:22.04
FROM tiangolo/nginx-rtmp
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpcre3 libpcre3-dev \
libssl-dev \
zlib1g-dev \
wget git
# Download and build NGINX with RTMP
RUN wget http://nginx.org/download/nginx-1.25.2.tar.gz && \
tar -xzvf nginx-1.25.2.tar.gz && \
git clone https://github.com/arut/nginx-rtmp-module.git && \
cd nginx-1.25.2 && \
./configure --add-module=../nginx-rtmp-module --with-http_ssl_module && \
make && make install
# Copy custom NGINX configuration
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 1935 8080
# Expose RTMP and HTTP ports
EXPOSE 1935
# Start NGINX
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
# Start the Nginx server
CMD [ "nginx", "-g", "daemon off;" ]

View File

@@ -1,12 +1,43 @@
worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
listen 1935; # RTMP listen port
application live {
live on;
record off;
# HLS Configuration (optional)
hls on; # Enable HLS conversion
hls_path /tmp/hls; # Path to store HLS files (use an absolute path)
hls_nested on;
hls_fragment 5s; # Duration of each HLS segment
hls_playlist_length 30s; # Length of HLS playlist (total duration)
}
}
}
http {
# Enable HLS
server {
listen 8080;
location /hls/ {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
autoindex on; # Enable directory indexing
}
}
}

2
web_server/.flaskenv Normal file
View File

@@ -0,0 +1,2 @@
FLASK_APP=blueprints.__init__
FLASK_DEBUG=True

View File

@@ -1,7 +1,7 @@
FROM python:3.10
# Set working directory
WORKDIR /core
# Set the working directory
WORKDIR /web_server
# Install dependencies
COPY requirements.txt requirements.txt
@@ -10,8 +10,12 @@ RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set environment variables
ENV FLASK_APP=blueprints.__init__
ENV FLASK_DEBUG=True
# Expose Flask's port
EXPOSE 5000
# Start the Flask app
CMD ["python", "app.py"]
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]

Binary file not shown.

View File

@@ -1,9 +1,9 @@
from flask import Flask
from flask_session import Session
from core.blueprints.utils import logged_in_user
from blueprints.utils import logged_in_user
def create_app():
app = Flask(__name__, template_folder="../../ui/templates/", static_folder="../../ui/static")
app = Flask(__name__, template_folder="../ui/templates/", static_folder="../ui/static/")
app.config["SECRET_KEY"] = ""
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
@@ -12,9 +12,9 @@ def create_app():
app.before_request(logged_in_user)
with app.app_context():
from core.blueprints.authentication import auth_bp
from core.blueprints.main import main_bp
from core.blueprints.stripe import stripe_bp
from blueprints.authentication import auth_bp
from blueprints.main import main_bp
from blueprints.stripe import stripe_bp
app.register_blueprint(auth_bp)
app.register_blueprint(main_bp)

Binary file not shown.

View File

@@ -1,8 +1,8 @@
from flask import Blueprint, render_template, session, request, url_for, redirect, g
from werkzeug.security import generate_password_hash, check_password_hash
from core.forms import SignupForm, LoginForm
from forms import SignupForm, LoginForm
from database.database import Database
from core.blueprints.utils import login_required
from blueprints.utils import login_required
auth_bp = Blueprint("auth", __name__)

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB