castbox is a powerful, customizable, and open-source media server that allows anyone to create and deploy their own media platform, similar to YouTube. The system is entirely independent of any specific platform, requiring only an internet connection. Designed with flexibility and privacy in mind, castbox empowers individuals and businesses to host, share, and manage their media content with complete control.
castbox is built on the principles of open-source software, ensuring transparency, security, and the ability for anyone to customize and improve the platform. By leveraging the power of the community, castbox stays up-to-date and reliable, making it accessible to all.
castbox does not rely on any specific platform. This independence means that users can tailor the system to their exact needs, without being constrained by external rules or limitations.
castbox doubles as an advertising system that anyone can customize for themselves. It can be tailored to individual needs, making it suitable for both personal and business use.
The platform supports the generation of QR codes for videos. These QR codes can be scanned to play the video instantly, making it easier to share content with others.
castbox places no restrictions on the size or volume of information you can host. The only limit is the capacity of your hardware, making it a scalable solution for growing businesses.
One of the standout features of castbox is its focus on privacy. Unlike other platforms, where you cannot be sure if deleted content is truly erased from the servers, castbox gives you complete control over your data. When you own the entire platform, you can be confident that your privacy is protected.
No Installation Required
Ease of Deployment: Portable software doesn’t require installation, making it quicker and simpler to deploy on servers or desktops. This is especially useful for environments where you don’t want to alter system configurations or deal with lengthy installation processes. No Need for Admin Privileges: Many portable applications can run without requiring administrator rights, which is beneficial for users with limited permissions on corporate or shared machines (e.g., standard users on a desktop).
Portability Across Devices
Use on Multiple Machines: Portable software can be run directly from a USB drive or external storage, allowing the user to take their applications with them and run them on different desktops or servers without needing to install anything on those machines. Consistency Across Platforms: When using portable software, the configuration, settings, and data are typically stored in the same directory as the application, ensuring a consistent user experience across different machines.
Reduced System Clutter
No Registry or System Changes: Since portable apps don’t require installation, they avoid making changes to the system registry or other configuration files, preventing unnecessary bloat or potential conflicts with other software. Easy Cleanup: After using the portable software, you can simply remove it from the device without leaving behind unnecessary files or registry entries. This makes them ideal for environments where keeping the system clean and tidy is important.
Improved Security
No Trace Left Behind: Portable apps can leave minimal or no trace on the host system. This is particularly important in environments where you may want to ensure privacy or prevent any lingering data from being left on shared machines or public servers. Reduced Risk of Malware: Since portable software is self-contained and doesn’t require installation, it reduces the risk of malware or unwanted software being embedded in the system during installation.
Convenience for IT and System Administrators
Easy Troubleshooting and Testing: System administrators or IT staff can use portable applications for troubleshooting or testing purposes without needing to install additional software on a system. This makes them highly useful for diagnostic tasks, system maintenance, or running specific tools temporarily. Minimal Configuration Overhead: Since portable applications don’t modify system settings or configurations, there’s less risk of affecting other software or the overall system setup.
Faster Setup and Deployment in Servers
Quick Setup for Temporary Needs: For temporary server needs or ad-hoc tasks, portable applications allow for quick setup and usage. Whether you’re working on a temporary server or doing a one-time task on a server, portable apps can be up and running in moments. Server-Specific Usage: When servers are dedicated to particular tasks and you don't want to install additional software permanently, portable software is a lightweight alternative that can fulfill temporary or occasional requirements.
Reduced Resource Consumption
Lightweight Operations: Portable software often runs with a smaller memory footprint and less system overhead compared to full installations, which might require background services, complex installers, or registry maintenance. This can make them ideal for low-resource environments or when minimizing system load is important. No Background Services: Unlike many installed applications that run background services or processes, portable software typically does not add additional load to the system when not in use.
Simplified Backup and Recovery
Easy Backup: Since portable software and its data are contained in a single directory, it’s easy to back up and restore. You can simply copy the application folder to another device or storage medium, without worrying about complex dependencies or system configurations. No Dependency Issues: Portable software is usually self-contained, which means it typically doesn’t rely on external libraries, system configurations, or dependencies installed on the host machine. This simplifies recovery if something goes wrong.
Compatibility Across Different Operating Systems
Cross-Platform Support: Some portable applications are designed to work on different operating systems (Windows, Linux, macOS), and can be used seamlessly across diverse environments. This can be beneficial for users working in mixed-OS environments, such as virtual machines or multi-OS server setups.
Reduced IT Maintenance
Less Maintenance Overhead: Since portable applications don’t modify system files or the registry, there’s less need for IT teams to worry about updates, patches, or troubleshooting installations on a device or server. Maintenance tasks are limited to managing the portable application itself. Easy to Distribute: IT administrators can distribute and update portable software easily by simply providing the updated executable or file, without needing to go through complex installation processes on each individual server or desktop.
Enhanced Privacy and Data Control
Self-contained Data: Many portable apps allow you to store user settings and data locally within the app’s directory, so all data is kept alongside the application itself, ensuring that it can be easily transported and used elsewhere. This is particularly important for users who need to ensure privacy or keep data isolated from the host machine. No Residual Data: When the application is removed, the data is typically removed as well, reducing the risk of leaving sensitive information behind.
Ideal for Secure Environments
Reduced Risk of Installation Errors: In secure environments where installation of software is tightly controlled (e.g., in government or corporate settings), portable software allows users to run necessary tools without needing to go through the standard software installation procedures or requesting administrative privileges.
Advantages of SSHFS Over PostgreSQL (For Mounting Files):
File-Based Storage vs Structured Data:
Use Case: SSHFS is useful when you need to mount and access remote file systems and interact with files as if they were part of the local filesystem. If your application needs to store files (e.g., documents, images, videos, logs) or manipulate file-based data, SSHFS is a natural choice. Advantage: If your application involves working directly with files (reading, writing, editing), using SSHFS to mount a remote file system will provide direct file access, whereas PostgreSQL would require additional handling of BLOBs (Binary Large Objects) or external file storage solutions.
Ease of Use (File System Interface):
Use Case: SSHFS allows you to mount remote directories directly onto the local filesystem, meaning you can access remote files just like local files. You don’t need to configure any specialized APIs or queries to read or write files. Advantage: For systems where you need to work with raw files (e.g., plain text, images, backups, or logs), SSHFS makes interacting with remote files easy and transparent. With PostgreSQL, you would need to design a schema to handle file data (e.g., as BLOBs), which can be more complex for simple file access scenarios.
Performance for File Operations:
Use Case: SSHFS allows you to work with remote files in a very intuitive way by mounting the filesystem and accessing it as if it's local. For basic file operations (copying, editing, deleting), this can be more efficient. Advantage: File-based operations (reading, writing, and manipulating files) are optimized in a file system interface like SSHFS, and tend to be more performant compared to handling file-like data within a relational database like PostgreSQL. For instance, using PostgreSQL to store files as BLOBs or using external references to file systems is more overhead-intensive than directly interacting with the file system via SSHFS.
Simplicity for File Access:
Use Case: If your application needs access to a simple file storage system that is accessible remotely, SSHFS provides a straightforward solution without the need for complex database setups. Advantage: Mounting a remote filesystem using SSHFS requires minimal configuration, whereas setting up PostgreSQL to handle files or unstructured data requires schema design, database management, and additional logic to efficiently handle file retrieval and storage.
Backup and Recovery:
Use Case: If you're simply storing files remotely and need a simple backup solution, SSHFS is easier to manage in this context because you're directly interacting with a file system. Advantage: Backups of mounted filesystems with SSHFS are essentially the same as backing up local files — simple tools like rsync or tar can be used to back up files. For PostgreSQL, backup and recovery of large amounts of binary data or files stored as BLOBs require more complex operations.
Transparent Remote Access:
Use Case: SSHFS allows you to transparently mount a remote file system, and once the file system is mounted, you can interact with it like a local file system. Advantage: Remote file access becomes transparent and doesn't require any application-specific code to manage file storage or retrieval. With PostgreSQL, you would need to interact with the database using SQL queries to retrieve or store file data, which can add complexity if the goal is just file access.
No Database Management Overhead:
Use Case: For use cases where the system simply needs to mount a remote file system and not interact with structured data (e.g., metadata), SSHFS has an advantage over setting up and maintaining a database system like PostgreSQL. Advantage: Using a database involves not only managing database schemas, indexes, and queries, but also requires ongoing maintenance (such as tuning, security patches, backups, and scaling). SSHFS, by contrast, is much simpler for file-based use cases and does not require database administration skills or resources.
Low-Cost Solution for File Sharing:
Use Case: SSHFS can be used as an inexpensive solution for file sharing between remote systems or for a server-to-server connection where the file system needs to be mounted remotely. Advantage: If the primary requirement is to share files over the network, SSHFS provides a low-cost solution, especially for scenarios where file storage management isn't central to the application. PostgreSQL would introduce unnecessary complexity and overhead for simple file sharing or access.
host_dir DirectoryUpload your video files to the host_dir directory of your castbox application. Ensure that the filenames match the ones you will reference in your routes.
Define a route for each video in your Flask application. For example:
@app.route('/video/jadi')
def jadi():
filename = "jadi.mp4"
# Check if file exists before serving
if os.path.exists(os.path.join(VIDEO_DIRECTORY, filename)):
return send_from_directory(VIDEO_DIRECTORY, filename)
else:
abort(404) # Return 404 if file not found
# Add additional routes for other videos as needed
In your HTML templates, add a <div> for each video. This example uses Bootstrap for styling:
<div class="col-md-4 mb-4">
<div class="card">
<a href="/video/eric_raymond">
<img src="../static/Raymond.png" class="card-img-top" alt="Eric S. Raymond Video Thumbnail">
</a>
<div class="card-body">
<h5 class="card-title">Eric S. Raymond - The Cathedral and the Bazaar</h5>
<p class="card-text">Uploaded 2 weeks ago</p>
</div>
</div>
</div>
<!-- Add additional <div> blocks for other videos -->
Clone the Repository:
git clone https://github.com/kooshayeganeh/castbox.git
cd castbox
Install Dependencies: Use pip to install the required dependencies.
pip install -r requirements.txt
Install and Configure Nginx:
sudo zypper install nginx
Edit the Nginx configuration file located at /etc/nginx/nginx.conf or create a new configuration file in /etc/nginx/conf.d/. Use the following sample configuration to optimize performance:
server {
listen 80;
server_name localhost;
# Static files location
location /static/ {
alias /home/koosha/w/castbox/app/static/;
expires 30d;
access_log off;
}
# Dynamic content
location / {
proxy_pass http://127.0.0.1:5005;
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;
}
}
Configure Caching:
Create or edit a configuration file in /etc/nginx/conf.d/:
server {
listen 80;
server_name your_domain_or_ip;
location / {
root /path/to/your/media;
try_files $uri $uri/ =404;
access_log /var/log/nginx/media_access.log;
error_log /var/log/nginx/media_error.log;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
expires 30d;
access_log off;
}
location ~ \.mp4$ {
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 5m;
}
}
Test and Restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
Configure openSUSE Linux:
Update System Packages:
sudo zypper refresh
sudo zypper update
Tune System Performance:
Edit /etc/sysctl.conf to apply system performance tweaks:
sudo nano /etc/sysctl.conf
Add the following lines:
net.core.somaxconn = 1024
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
Apply the changes:
sudo sysctl -p
Optimize Disk I/O:
Edit /etc/default/grub:
sudo nano /etc/default/grub
Add or modify:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
Update GRUB and reboot:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot
Configure Firewall: Using iptables:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -j DROP
sudo iptables-save > /etc/iptables/rules.v4
Using nftables:
sudo zypper install nftables
Create or edit the nftables configuration file:
sudo nano /etc/nftables.conf
Add the following rules:
table ip filter {
chain input {
type filter hook input priority 0; policy drop;
tcp dport { 80, 443 } accept
ct state established,related accept
}
}
Apply the nftables configuration:
sudo nft -f /etc/nftables.conf
Monitor System Performance:
sudo zyp
per install sysstat sar -u 1 3
7. **Run the Application**:
```bash
flask run
To remove castbox, you can delete the repository and clean up dependencies:
Stop the Application:
pkill -f 'flask'
Remove the Repository:
rm -rf castbox
Uninstall Dependencies:
pip uninstall -r requirements.txt
Remove Nginx Configuration:
sudo rm /etc/nginx/conf.d/your_media.conf
sudo systemctl restart nginx
Remove System Configurations: For iptables:
sudo iptables -F
sudo iptables-save > /etc/iptables/rules.v4
For nftables:
sudo nft flush ruleset
Clean Up:
sudo zypper remove sysstat
sudo zypper install ffmpeg
Varnish Cache: Use Varnish Cache as a reverse proxy to cache static content like video files, reducing the load on your web server.
sudo zypper install varnish
Configure Varnish to handle large files efficiently by tweaking its storage settings.
Kernel Tuning: Adjust kernel parameters to improve network throughput and file handling. Example settings in /etc/sysctl.conf:
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
Disk I/O: Use faster storage solutions like SSDs or NVMe drives for storing video files.
Contributions to castbox are welcome! Please submit a pull request or open an issue on our GitHub repository. We appreciate any feedback or improvements you can provide.
castbox is licensed under the MIT License.
For any questions or support, please reach out to Koosha Yeganeh at [email protected].
Thank you for using KYGNus castbox!
Content type
Image
Digest
sha256:0f7e9341e…
Size
472 MB
Last updated
12 months ago
docker pull kygnus/castbox