diff --git a/Makefile b/Makefile index 9742c56..0afe7e0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ # Makefile -# Image tag -TAG ?= beta +# Image version +VERSION ?= latest + +# Last commit ID +GIT_REV ?= $(shell git rev-parse --short HEAD) + +# Builder name +BUILDER_NAME ?= mediafusion-builder # Docker image name IMAGE_NAME = mediafusion @@ -9,18 +15,28 @@ IMAGE_NAME = mediafusion # Docker repository DOCKER_REPO = mhdzumair -# Docker image with tag -DOCKER_IMAGE = $(DOCKER_REPO)/$(IMAGE_NAME):$(TAG) +# Platforms to build for +PLATFORMS = linux/amd64,linux/arm64 + +# Docker image with version as tag +DOCKER_IMAGE = $(DOCKER_REPO)/$(IMAGE_NAME):$(VERSION) .PHONY: build tag push build: - docker build --build-arg GIT_REV=$(TAG) -t $(IMAGE_NAME):$(TAG) -f deployment/Dockerfile . - -tag: - docker tag $(IMAGE_NAME):$(TAG) $(DOCKER_IMAGE) + docker build --build-arg GIT_REV=$(GIT_REV) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . +build-multi: + @if ! docker buildx ls | grep -q $(BUILDER_NAME); then \ + echo "Creating new builder $(BUILDER_NAME)"; \ + docker buildx create --name $(BUILDER_NAME) --use; \ + else \ + echo "Using existing builder $(BUILDER_NAME)"; \ + docker buildx use $(BUILDER_NAME); \ + fi + docker buildx inspect --bootstrap + docker buildx build --platform $(PLATFORMS) --build-arg GIT_REV=$(GIT_REV) -t $(DOCKER_IMAGE) -f deployment/Dockerfile . --push push: docker push $(DOCKER_IMAGE) -all: build tag push \ No newline at end of file +all: build-multi diff --git a/api/scheduler.py b/api/scheduler.py new file mode 100644 index 0000000..b6c00eb --- /dev/null +++ b/api/scheduler.py @@ -0,0 +1,32 @@ +import asyncio +import logging + +from apscheduler.schedulers.asyncio import AsyncIOScheduler +from apscheduler.triggers.cron import CronTrigger + +from scrapers import tamil_blasters, tamilmv + +# Configure logging +logging.basicConfig( + level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" +) + +scheduler = AsyncIOScheduler() + +# Setup tamil blasters scraper +scheduler.add_job( + tamil_blasters.run_schedule_scrape, + CronTrigger(hour="*/6"), + name="tamil_blasters", +) + +# Setup tamilmv scraper +scheduler.add_job(tamilmv.run_schedule_scrape, CronTrigger(hour="*/3"), name="tamilmv") + +# Start the scheduler +scheduler.start() + +try: + asyncio.get_event_loop().run_forever() +except Exception as e: + logging.error(f"Error occurred: {e}") diff --git a/deployment/Dockerfile b/deployment/Dockerfile index b562cc1..4fadfbc 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,8 +1,5 @@ FROM python:3.11-slim-bullseye -ARG GIT_REV="dev" -ENV GIT_REV=$GIT_REV - WORKDIR /mediafusion # Install dependencies @@ -15,8 +12,11 @@ COPY ../Pipfile Pipfile.lock ./ RUN pipenv install --deploy --ignore-pipfile +ARG GIT_REV="dev" +ENV GIT_REV=$GIT_REV + # Copy the source code -COPY .. . +COPY . . # Expose the port EXPOSE 80 diff --git a/deployment/README.md b/deployment/README.md index 8d28c75..99bed0a 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -1,134 +1,44 @@ +# MediaFusion Deployment Guide 🚀 -# MediaFusion Local Deployment Guide 🚀 +Welcome to the deployment guide for MediaFusion! This document will help you navigate through the different deployment methods available for MediaFusion. Depending on your preference or environment constraints, you can choose between Kubernetes-based deployment or Docker Compose. -This guide provides instructions for deploying MediaFusion locally using Minikube, tailored for Windows, Linux, and macOS platforms. Follow these steps to set up MediaFusion on your local machine. +## Deployment Options 🛠️ -## Clone the Repository +MediaFusion supports multiple deployment strategies to cater to different infrastructure needs and preferences. You can deploy MediaFusion using: -```bash -git clone https://github.com/mhdzumair/MediaFusion -cd MediaFusion +- [Kubernetes](./k8s/README.md) (recommended for scalable and production environments) +- [Docker Compose](./docker-compose/README.md) (suitable for simple or local development environments) -# Switch to the development branch -git checkout develop -``` +Each method has its own set of instructions and configurations. Please follow the links above to access the detailed guide for each deployment strategy. -## Prerequisites +## Kubernetes Deployment 🌐 -Before you begin, ensure the following tools are installed on your system: +For those using Kubernetes, we provide a detailed guide for deploying MediaFusion with Minikube, which is ideal for local development and testing. The Kubernetes deployment guide includes instructions on setting up secrets, generating SSL certificates, and configuring services. -- **Minikube**: For local Kubernetes development. Install instructions are available in the [Minikube documentation](https://minikube.sigs.k8s.io/docs/start/). +👉 [Kubernetes Deployment Guide](./k8s/README.md) -- **kubectl**: The Kubernetes command-line tool. Installation guidelines can be found in the [Kubernetes documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl/). +## Docker Compose Deployment 🐳 -- **Python 3.11**: Required for mkcert & development. Follow the [Python documentation](https://www.python.org/downloads/) for installation instructions. +If you're looking for a quick and straightforward deployment, Docker Compose might be the right choice for you. Our Docker Compose guide outlines the steps for setting up MediaFusion on your local machine without the complexity of Kubernetes. -## Setting Up Secrets 🗝️ +👉 [Docker Compose Deployment Guide](./docker-compose/README.md) -MediaFusion requires certain secrets for operation. Use the following commands to create them: +## Prerequisites 📋 -```bash -# Generate a random 32-character string for the SECRET_KEY -SECRET_KEY=$(openssl rand -hex 16) +Before proceeding with any deployment method, make sure you have the required tools installed on your system: -# Generate a random API key for Prowlarr -PROWLARR_API_KEY=$(openssl rand -hex 16) +- Docker and Docker Compose for container management and orchestration. +- Kubernetes CLI (kubectl) if you are deploying with Kubernetes. +- Python 3.11 or higher, which is necessary for certain setup scripts and tools. -# If using Premiumize, fill in your OAuth client ID and secret. Otherwise, leave these empty. -PREMIUMIZE_OAUTH_CLIENT_ID="" -PREMIUMIZE_OAUTH_CLIENT_SECRET="" +## Configuration 📝 -kubectl create secret generic mediafusion-secrets \ - --from-literal=SECRET_KEY=$SECRET_KEY \ - --from-literal=PROWLARR_API_KEY=$PROWLARR_API_KEY \ - --from-literal=PREMIUMIZE_OAUTH_CLIENT_ID=$PREMIUMIZE_OAUTH_CLIENT_ID \ - --from-literal=PREMIUMIZE_OAUTH_CLIENT_SECRET=$PREMIUMIZE_OAUTH_CLIENT_SECRET -``` +Both deployment methods require you to configure environment variables that are crucial for the operation of MediaFusion. These variables include API keys, database URIs, and other sensitive information which should be kept secure. -### Updating Secrets +## Support and Contributions 💡 -To update existing secrets, use the following command: +Should you encounter any issues during deployment or have suggestions for improvement, please feel free to open an issue or pull request in our GitHub repository. -```bash -kubectl create secret generic mediafusion-secrets \ - --from-literal=SECRET_KEY=$SECRET_KEY \ - --from-literal=PROWLARR_API_KEY=$PROWLARR_API_KEY \ - --from-literal=PREMIUMIZE_OAUTH_CLIENT_ID=$PREMIUMIZE_OAUTH_CLIENT_ID \ - --from-literal=PREMIUMIZE_OAUTH_CLIENT_SECRET=$PREMIUMIZE_OAUTH_CLIENT_SECRET \ - --dry-run=client -o yaml | kubectl apply -f - -``` +We welcome contributions and feedback to make MediaFusion better for everyone! -## Install Required Addons - -### Ingress 🌐 - -```bash -minikube addons enable ingress -``` - -### Metrics Server 📊 - -Required for Horizontal Pod Autoscaler (HPA) functionality: - -```bash -minikube addons enable metrics-server -``` - -## Create SSL Certificate for Ingress 🔒 - -Generate and store a self-signed certificate: - -```bash -pip install mkcert -mkcert -install -mkcert "mediafusion.local" - -kubectl create secret tls mediafusion-tls \ - --cert=mediafusion.local.pem \ - --key=mediafusion.local-key.pem -``` - -## Configuring MediaFusion - -Edit the `deployment/local-deployment.yaml` to set the required environment variables: - -```yaml - - name: HOST_URL - value: "https://mediafusion.local" - - name: ENABLE_TAMILMV_SEARCH_SCRAPER - value: "false" - - name: PROWLARR_IMMEDIATE_MAX_PROCESS - value: "3" - - name: PROWLARR_SEARCH_INTERVAL_HOUR - value: "24" - - name: IS_SCRAP_FROM_TORRENTIO - value: "false" -``` - -## Deployment 🚢 - -Deploy MediaFusion to your local Kubernetes cluster: - -```bash -kubectl apply -f deployment/local-deployment.yaml -``` - -## Accessing MediaFusion 🌍 - -Add an entry to your system's hosts file to resolve `mediafusion.local` to the Minikube IP: - -### Windows - -Open PowerShell as Administrator: - -```powershell -Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "$(minikube ip) mediafusion.local" -``` - -### Linux/macOS - -```bash -echo "$(minikube ip) mediafusion.local" | sudo tee -a /etc/hosts -``` - -Now, you can access MediaFusion at [https://mediafusion.local](https://mediafusion.local) 🎉 +Happy Deploying! 🎉 diff --git a/deployment/docker-compose/.env-sample b/deployment/docker-compose/.env-sample new file mode 100644 index 0000000..c983405 --- /dev/null +++ b/deployment/docker-compose/.env-sample @@ -0,0 +1,11 @@ +HOST_URL="https://mediafusion.local" +MONGO_URI="mongodb://mongodb:27017/mediafusion" +REDIS_URL="redis://redis:6379" +PROWLARR_URL="http://prowlarr:9696" +PROWLARR_API_KEY= +PROWLARR_IMMEDIATE_MAX_PROCESS=5 +PROWLARR_IMMEDIATE_MAX_PROCESS_TIME=15 +PROWLARR_SEARCH_INTERVAL_HOUR="24" +IS_SCRAP_FROM_TORRENTIO="false" +ENABLE_RATE_LIMIT="false" +ENABLE_TAMILMV_SEARCH_SCRAPER="false" diff --git a/deployment/docker-compose/README.md b/deployment/docker-compose/README.md new file mode 100644 index 0000000..2eba938 --- /dev/null +++ b/deployment/docker-compose/README.md @@ -0,0 +1,112 @@ +# MediaFusion Local Deployment Guide For Docker Compose 🐳 + +This guide outlines the steps for deploying MediaFusion locally using Docker Compose. It is an alternative to Kubernetes-based deployment for users who prefer a simpler setup or have constraints running Kubernetes on their machines. + +## Clone the Repository 📋 + +```bash +git clone https://github.com/mhdzumair/MediaFusion +cd MediaFusion + +# goto deployment/docker-compose +cd deployment/docker-compose +``` + +## Prerequisites 🛠️ + +Ensure the following tools are installed: + +- **Docker**: For containerization. [Installation guide](https://docs.docker.com/get-docker/). +- **Docker Compose**: For multi-container Docker applications. [Installation guide](https://docs.docker.com/compose/install/). +- **Python 3.11**: For mkcert & development. [Installation guide](https://www.python.org/downloads/). + +## Configuration 📝 + +Rename `.env-sample` to `.env` and update the variables. + + +```bash +cp .env-sample .env +# Generate and update SECRET_KEY in the .env file +echo SECRET_KEY=$(openssl rand -hex 16) >> .env + +# Update .env with your Premiumize credentials if available +echo PREMIUMIZE_OAUTH_CLIENT_ID=your_client_id >> .env +echo PREMIUMIZE_OAUTH_CLIENT_SECRET=your_client_secret >> .env + +# Open the .env file to verify the values +nano .env +``` + +## Generate Self-Signed SSL Certificate 🔐 + +Generate a self-signed SSL certificate for local HTTPS: + +```bash +pip install mkcert +mkcert -install +mkcert "mediafusion.local" +``` + +## Prowlarr Configuration 🔄 + +Configure Prowlarr manually to retrieve the API token and set up indexers. + +1. Start Prowlarr container: + ```bash + docker-compose -f docker-compose.yml up prowlarr + ``` +2. Retrieve the Prowlarr API token from the settings page at [http://127.0.0.1:9696/settings/general](http://127.0.0.1:9696/settings/general) and update the `.env` file. +3. Configure indexers like TheRARBG, Torlock, etc., through Prowlarr's UI. or alternatively, you can use the following command to add indexers: + ```bash + # Open a new terminal window and run the following commands + # Replace YOUR_PROWLARR_API_KEY with the API token obtained from Prowlarr + export PROWLARR_API_KEY="YOUR_PROWLARR_API_KEY" + until curl -o prowlarr-indexers.json https://raw.githubusercontent.com/mhdzumair/MediaFusion/main/resources/json/prowlarr-indexers.json; do + echo "Failed to download indexers file. Retrying..."; + sleep 3; + done; + jq -c '.[]' prowlarr-indexers.json | while read indexer; do + echo "Adding indexer named: $(echo $indexer | jq -r '.name')"; + curl -H "Content-Type: application/json" -H "X-API-KEY: $PROWLARR_API_KEY" -X POST http://localhost:9696/api/v1/indexer -d "$indexer"; + done; + echo "Indexers setup complete."; + ``` +4. Stop the Prowlarr container by pressing `Ctrl+C` in the terminal window where it was started. + +## Deployment 🚢 + +Deploy MediaFusion using Docker Compose: + +```bash +docker-compose -f docker-compose.yml up -d +``` + +> Note: If you have lower than armv8-2 architecture, you may not be able to run the mongodb container. In that case, you can use MongoDB Atlas Cluster. + +### Configuring MongoDB Atlas Cluster (Optional) (Not needed for local deployment) 🌐 +If you want to use MongoDB atlas Cluster instead of local MongoDB, follow the documentation [here](/deployment/mongo/README.md). + +- Replace the `MONGO_URI` in the `.env` file with the connection string you copied from the previous step. +- Remove the `mongodb` container and `depends_on` from the `docker-compose.yml` file. + + +## Accessing MediaFusion 🌍 + +Update your system's hosts file to resolve `mediafusion.local` to `127.0.0.1`: + +### Windows + +Open PowerShell as Administrator: + +```powershell +Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1 mediafusion.local" +``` + +### Linux/macOS + +```bash +echo "127.0.0.1 mediafusion.local" | sudo tee -a /etc/hosts +``` + +Now, access MediaFusion at [https://mediafusion.local](https://mediafusion.local) 🎉 diff --git a/deployment/docker-compose/docker-compose.yml b/deployment/docker-compose/docker-compose.yml new file mode 100644 index 0000000..29f64a3 --- /dev/null +++ b/deployment/docker-compose/docker-compose.yml @@ -0,0 +1,72 @@ +version: '3.8' + +services: + mediafusion: + image: mhdzumair/mediafusion:beta + ports: + - "80:80" + env_file: + - .env + depends_on: + - mongodb + - redis + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/health"] + interval: 1m + timeout: 10s + retries: 5 + start_period: 10s + + nginx: + image: nginx:alpine + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + - ./mediafusion.local.pem:/etc/ssl/certs/mediafusion.local.pem + - ./mediafusion.local-key.pem:/etc/ssl/private/mediafusion.local-key.pem + ports: + - "443:443" + depends_on: + - mediafusion + + mongodb: + image: mongo + volumes: + - mongo-data:/data/db + ports: + - "27017:27017" + + redis: + image: redis:latest + ports: + - "6379:6379" + + dramatiq-worker: + image: mhdzumair/mediafusion:beta + command: ["pipenv", "run", "dramatiq-gevent", "api.task"] + env_file: + - .env + depends_on: + - mongodb + + prowlarr: + image: ghcr.io/hotio/prowlarr:latest + environment: + PUID: "1000" + PGID: "1000" + UMASK: "002" + ports: + - "9696:9696" + volumes: + - prowlar-config:/config + + scraper: + image: mhdzumair/mediafusion:beta + command: ["pipenv", "run", "python", "-m", "api.scheduler"] + env_file: + - .env + depends_on: + - mongodb + +volumes: + mongo-data: + prowlar-config: diff --git a/deployment/docker-compose/nginx.conf b/deployment/docker-compose/nginx.conf new file mode 100644 index 0000000..206d41b --- /dev/null +++ b/deployment/docker-compose/nginx.conf @@ -0,0 +1,32 @@ +user nginx; +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 443 ssl; + server_name mediafusion.local; + + ssl_certificate /etc/ssl/certs/mediafusion.local.pem; + ssl_certificate_key /etc/ssl/private/mediafusion.local-key.pem; + + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; + + location / { + proxy_pass http://mediafusion:80; + 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; + } + } +} diff --git a/deployment/k8s/README.md b/deployment/k8s/README.md new file mode 100644 index 0000000..1b3abca --- /dev/null +++ b/deployment/k8s/README.md @@ -0,0 +1,141 @@ + +# MediaFusion Local Deployment Guide For Kubernetes 🚀 + +This guide provides instructions for deploying MediaFusion locally using Minikube, tailored for Windows, Linux, and macOS platforms. Follow these steps to set up MediaFusion on your local machine. + +## Clone the Repository + +```bash +git clone https://github.com/mhdzumair/MediaFusion +cd MediaFusion +``` + +## Prerequisites + +Before you begin, ensure the following tools are installed on your system: + +- **Minikube**: For local Kubernetes development. Install instructions are available in the [Minikube documentation](https://minikube.sigs.k8s.io/docs/start/). + +- **kubectl**: The Kubernetes command-line tool. Installation guidelines can be found in the [Kubernetes documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl/). + +- **Python 3.11**: Required for mkcert & development. Follow the [Python documentation](https://www.python.org/downloads/) for installation instructions. + +## Setting Up Secrets 🗝️ + +MediaFusion requires certain secrets for operation. Use the following commands to create them: + +```bash +# Generate a random 32-character string for the SECRET_KEY +SECRET_KEY=$(openssl rand -hex 16) + +# Generate a random API key for Prowlarr +PROWLARR_API_KEY=$(openssl rand -hex 16) + +# If using Premiumize, fill in your OAuth client ID and secret. Otherwise, leave these empty. +PREMIUMIZE_OAUTH_CLIENT_ID="" +PREMIUMIZE_OAUTH_CLIENT_SECRET="" + +kubectl create secret generic mediafusion-secrets \ + --from-literal=SECRET_KEY=$SECRET_KEY \ + --from-literal=PROWLARR_API_KEY=$PROWLARR_API_KEY \ + --from-literal=PREMIUMIZE_OAUTH_CLIENT_ID=$PREMIUMIZE_OAUTH_CLIENT_ID \ + --from-literal=PREMIUMIZE_OAUTH_CLIENT_SECRET=$PREMIUMIZE_OAUTH_CLIENT_SECRET +``` + +### Updating Secrets + +To update existing secrets, use the following command: + +```bash +kubectl create secret generic mediafusion-secrets \ + --from-literal=SECRET_KEY=$SECRET_KEY \ + --from-literal=PROWLARR_API_KEY=$PROWLARR_API_KEY \ + --from-literal=PREMIUMIZE_OAUTH_CLIENT_ID=$PREMIUMIZE_OAUTH_CLIENT_ID \ + --from-literal=PREMIUMIZE_OAUTH_CLIENT_SECRET=$PREMIUMIZE_OAUTH_CLIENT_SECRET \ + --dry-run=client -o yaml | kubectl apply -f - +``` + +## Install Required Addons + +### Ingress 🌐 + +```bash +minikube addons enable ingress +``` + +### Metrics Server 📊 + +Required for Horizontal Pod Autoscaler (HPA) functionality: + +```bash +minikube addons enable metrics-server +``` + +## Create SSL Certificate for Ingress 🔒 + +Generate and store a self-signed certificate: + +```bash +pip install mkcert +mkcert -install +mkcert "mediafusion.local" + +kubectl create secret tls mediafusion-tls \ + --cert=mediafusion.local.pem \ + --key=mediafusion.local-key.pem +``` + +## Configuring MediaFusion 🛠️ + +Edit the `deployment/local-deployment.yaml` to set the required environment variables: + +```yaml + - name: HOST_URL + value: "https://mediafusion.local" + - name: ENABLE_TAMILMV_SEARCH_SCRAPER + value: "false" + - name: PROWLARR_IMMEDIATE_MAX_PROCESS + value: "3" + - name: PROWLARR_SEARCH_INTERVAL_HOUR + value: "24" + - name: IS_SCRAP_FROM_TORRENTIO + value: "false" +``` + +> Note: If you have lower than armv8-2 architecture, you may not be able to run the mongodb container. In that case, you can use MongoDB Atlas Cluster. + + +### Configuring MongoDB Atlas Cluster (Optional) (Not needed for local deployment) 🌐 +If you want to use MongoDB atlas Cluster instead of local MongoDB, follow the documentation [here](/deployment/mongo/README.md). + +- Replace the `MONGO_URI` in the `deployment/local-deployment.yaml` file with the connection string you copied from the previous step. +- Set `mongodb-deployment` replica to 0 in the `deployment/local-deployment.yaml` file. + + +## Deployment 🚢 + +Deploy MediaFusion to your local Kubernetes cluster: + +```bash +kubectl apply -f deployment/local-deployment.yaml +``` + +## Accessing MediaFusion 🌍 + +Add an entry to your system's hosts file to resolve `mediafusion.local` to the Minikube IP: + +### Windows + +Open PowerShell as Administrator: + +```powershell +Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "$(minikube ip) mediafusion.local" +``` + +### Linux/macOS + +```bash +echo "$(minikube ip) mediafusion.local" | sudo tee -a /etc/hosts +``` + +Now, you can access MediaFusion at [https://mediafusion.local](https://mediafusion.local) 🎉 diff --git a/deployment/deployment.yaml b/deployment/k8s/deployment.yaml similarity index 95% rename from deployment/deployment.yaml rename to deployment/k8s/deployment.yaml index bc1fbe0..514da22 100644 --- a/deployment/deployment.yaml +++ b/deployment/k8s/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: mediafusion-deployment spec: - replicas: 11 + replicas: 6 selector: matchLabels: app: mediafusion @@ -19,8 +19,7 @@ spec: spec: containers: - name: mediafusion - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always + image: mhdzumair/mediafusion:v3.7.1 ports: - containerPort: 80 resources: @@ -87,7 +86,7 @@ kind: Deployment metadata: name: dramatiq-worker-deployment spec: - replicas: 3 + replicas: 5 selector: matchLabels: app: dramatiq-worker @@ -98,9 +97,8 @@ spec: spec: containers: - name: dramatiq-worker - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always - command: ["pipenv", "run", "dramatiq", "api.task"] + image: mhdzumair/mediafusion:v3.7.1 + command: ["pipenv", "run", "dramatiq-gevent", "api.task"] env: - name: MONGO_URI valueFrom: @@ -124,10 +122,10 @@ spec: key: REDIS_URL resources: requests: - memory: "300Mi" + memory: "500Mi" cpu: "200m" limits: - memory: "800Mi" + memory: "1Gi" cpu: "200m" --- @@ -218,7 +216,7 @@ spec: sleep 5; done; echo "Prowlarr is ready, setting up indexers..."; - until curl -o prowlarr-indexers.json https://raw.githubusercontent.com/mhdzumair/MediaFusion/develop/resources/json/prowlarr-indexers.json; do + until curl -o prowlarr-indexers.json https://raw.githubusercontent.com/mhdzumair/MediaFusion/main/resources/json/prowlarr-indexers.json; do echo "Failed to download indexers file. Retrying..."; sleep 3; done; @@ -380,8 +378,7 @@ spec: spec: containers: - name: tamil-blasters-scraper - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always + image: mhdzumair/mediafusion:v3.7.1 command: ["pipenv", "run", "python3", "-m", "scrapers.tamil_blasters", "--all"] resources: requests: @@ -416,8 +413,7 @@ spec: spec: containers: - name: tamilmv-scraper - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always + image: mhdzumair/mediafusion:v3.7.1 command: ["pipenv", "run", "python3", "-m", "scrapers.tamilmv", "--all"] resources: requests: diff --git a/deployment/local-deployment.yaml b/deployment/k8s/local-deployment.yaml similarity index 96% rename from deployment/local-deployment.yaml rename to deployment/k8s/local-deployment.yaml index 61d7877..34432f2 100644 --- a/deployment/local-deployment.yaml +++ b/deployment/k8s/local-deployment.yaml @@ -10,7 +10,7 @@ spec: strategy: type: RollingUpdate rollingUpdate: - maxUnavailable: 1 + maxUnavailable: 0 maxSurge: 1 template: metadata: @@ -19,8 +19,7 @@ spec: spec: containers: - name: mediafusion - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always + image: mhdzumair/mediafusion:v3.7.1 ports: - containerPort: 80 resources: @@ -123,9 +122,8 @@ spec: spec: containers: - name: dramatiq-worker - image: mhdzumair/mediafusion:beta - imagePullPolicy: Always - command: ["pipenv", "run", "dramatiq", "api.task"] + image: mhdzumair/mediafusion:v3.7.1 + command: ["pipenv", "run", "dramatiq-gevent", "api.task"] env: - name: MONGO_URI value: "mongodb://mongodb-service:27017/mediafusion" @@ -141,10 +139,10 @@ spec: key: PROWLARR_API_KEY resources: requests: - memory: "300Mi" + memory: "500Mi" cpu: "200m" limits: - memory: "800Mi" + memory: "1Gi" cpu: "200m" --- @@ -235,7 +233,7 @@ spec: sleep 5; done; echo "Prowlarr is ready, setting up indexers..."; - until curl -o prowlarr-indexers.json https://raw.githubusercontent.com/mhdzumair/MediaFusion/develop/resources/json/prowlarr-indexers.json; do + until curl -o prowlarr-indexers.json https://raw.githubusercontent.com/mhdzumair/MediaFusion/main/resources/json/prowlarr-indexers.json; do echo "Failed to download indexers file. Retrying..."; sleep 3; done; diff --git a/deployment/mongo/README.md b/deployment/mongo/README.md new file mode 100644 index 0000000..8937d86 --- /dev/null +++ b/deployment/mongo/README.md @@ -0,0 +1,48 @@ + +# Setting up a Free MongoDB Atlas Cluster + +This guide will walk you through setting up a free MongoDB Atlas cluster which can be used as a database for your applications. + +## Step 1: Sign Up or Log In to MongoDB Atlas + +Go to the [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) website and sign up or log in to your account. + +## Step 2: Create a New Project + +- After logging in, create a new project by clicking the "Create a New Project" button. + ![Create a New Project](mongo-ss1.png) +- Give your project a name and add any members if you're working as part of a team. + +## Step 3: Create a Free Cluster + + +- Inside your new project, click the "Create" button to create a new cluster. + ![Build a Cluster](mongo-ss2.png) +- Choose the "Free" cluster tier which provides you with 512 MB of storage. + ![Cluster Tier](mongo-ss3.png) +- Select your cloud provider and the region closest to your application users for optimal performance. +- Click "Create" to provision your free cluster. + +## Step 4: Configure Database Access + +- Navigate to the "Database Access" section under the "Security" menu on the left-hand side. + ![Database Access](mongo-ss4.png) +- Add a new database user with a username and a secure password. Remember these credentials as you'll use them to connect to your database. + +## Step 5: Configure Network Access +- Go to the "Network Access" section under the "Security" menu. + ![Network Access](mongo-ss5.png) +- Click "Add IP Address" and either add your current IP address or allow access from anywhere "0.0.0.0/0" (not recommended. Know what you're doing). + +## Step 6: Connect to Your Database + +- Once your cluster is provisioned, click the "Connect" button next to your cluster. + ![Connect to Your Database](mongo-ss6.png) +- In case if you're not setting up IP Whitelist and DB User, you can see the below screen. + ![Connect Your Application](mongo-ss7.png) +- Select the "Drivers" + ![Choose Your Driver](mongo-ss8.png) +- Choose Python as your driver. + ![Choose Python Driver](mongo-ss9.png) +- Copy the provided connection string and replace `` with the password of the database user you created. + ![Connection String](mongo-ss10.png) diff --git a/deployment/mongo/mongo-ss1.png b/deployment/mongo/mongo-ss1.png new file mode 100644 index 0000000..0892a53 Binary files /dev/null and b/deployment/mongo/mongo-ss1.png differ diff --git a/deployment/mongo/mongo-ss2.png b/deployment/mongo/mongo-ss2.png new file mode 100644 index 0000000..701dcb1 Binary files /dev/null and b/deployment/mongo/mongo-ss2.png differ diff --git a/deployment/mongo/mongo-ss3.png b/deployment/mongo/mongo-ss3.png new file mode 100644 index 0000000..6e7c302 Binary files /dev/null and b/deployment/mongo/mongo-ss3.png differ diff --git a/deployment/mongo/mongo-ss4.png b/deployment/mongo/mongo-ss4.png new file mode 100644 index 0000000..dd463e8 Binary files /dev/null and b/deployment/mongo/mongo-ss4.png differ diff --git a/deployment/mongo/mongo-ss5.png b/deployment/mongo/mongo-ss5.png new file mode 100644 index 0000000..a741a99 Binary files /dev/null and b/deployment/mongo/mongo-ss5.png differ diff --git a/deployment/mongo/mongo-ss6.png b/deployment/mongo/mongo-ss6.png new file mode 100644 index 0000000..7d745be Binary files /dev/null and b/deployment/mongo/mongo-ss6.png differ diff --git a/deployment/mongo/mongo-ss7.png b/deployment/mongo/mongo-ss7.png new file mode 100644 index 0000000..3c3ce06 Binary files /dev/null and b/deployment/mongo/mongo-ss7.png differ diff --git a/deployment/mongo/mongo-ss8.png b/deployment/mongo/mongo-ss8.png new file mode 100644 index 0000000..17f57b7 Binary files /dev/null and b/deployment/mongo/mongo-ss8.png differ diff --git a/deployment/mongo/mongo-ss9.png b/deployment/mongo/mongo-ss9.png new file mode 100644 index 0000000..8663fae Binary files /dev/null and b/deployment/mongo/mongo-ss9.png differ diff --git a/resources/manifest.json b/resources/manifest.json index e7b7e65..794347b 100644 --- a/resources/manifest.json +++ b/resources/manifest.json @@ -1,6 +1,6 @@ { "id": "mhdzumair.addons.mediafusion", - "version": "3.7.0", + "version": "3.7.1", "name": "Media Fusion", "contactEmail": "mhdzumair@gmail", "description": "Universal Stremio Add-on for Movies, Series & Live TV. Source: https://github.com/mhdzumair/MediaFusion",