How to upload content to the ContentHub

The information below is also included in the user manual for firmware 8.0.

ContentHub

Integrated into MediaFast-enabled routers, ContentHub allows you to deliver web-pages and applications using the local storage on your router.
Users will be able to access news, articles, videos, and access your web app, without the need for internet access.

ContentHub Storage needs to be configured before content can be uploaded to the ContentHub.
Follow the link on the information panel to configure storage.


To access ContentHub, navigate to Network > ContentHub and check the Enable box.:


On an external server configure content (a website or application) that will be synced to the ContentHub; for example a html5 website.
To configure a website or application as content follow these steps.

Configure a website to be published from the ContentHub

This option allows you to sync a website to the Peplink router, this website will then be published with the specified domain from the router itself and makes the content available to the client via the HTTP/HTTPS protocol.
Only FTP sync is supported for this type of ContentHub content.
The content should be uploaded to an FTP server before you sync it with the ContentHub.
Click New Website, and the following configuration options will appear:


The Active checkbox toggles the activation of the content.
For type, select Website.

Options
Protocol HTTP,HTTPS or both
Domain/Path The ContenHub uses this as the domain name for client access (such as http://mytest.com).
Source Enter the server details that the content will be downloaded from. Enter your credentials under Username and Password.
Period This field determines how often the Router will search for updates to the source content.
Method Only applicable for application: Choose between sync or file upload
Bandwidth Limit Used to limit the bandwidth for each client to access the web server.

Click “Save & Apply Now” to activate the changes. Below is a screenshot after configuration:


The content will be synced based on the Period that is configured before.
If you want to trigger the sync manually, you can click image
The “Status” column shows the sync progress.
When the sync is completed, you’ll sees a summary as shown in the screenshot below:

To access the content, open a browser in MFA’s client and enter the domain configured before (such as http://mytest.com).

Configure an application to be published from the ContentHub

Mediafast Routers allow you to configure and publish an application from the router itself by using the supported framework

  • php - 5.6.40
  • node.js - 8.16.0
  • ruby - 2.6.3
  • python - 2.7.16
  • python3 - 3.7.3

First install the desired framework in “Package Manager” as below:

After installing the framework, you can select the type to “Application” and configure the website:

The setting is same as Website type and you can refer to the description in the above section
For the Application type, you need to pack your application as below:

  1. Implement two bash script files, start.sh and stop.sh in root folder, to start and stop your application. the Mediafast router will only execute start.sh and stop.sh when the corresponding website is enabled and disabled respectively.
  2. Compress your application files and the bash script to .tar.gz format.
  3. Upload this tar file to the router.
5 Likes

Is PHP also supported?
Are mentioned versions up to date?

1 Like

Hi Ciden,

The mentioned versions were not up to date, but they are now, and PHP is now supported as well!
The supported versions (up to date 2 October 2019) are:

  • php - 5.6.40
  • node.js - 8.16.0
  • ruby - 2.6.3
  • python - 2.7.16
  • python3 - 3.7.3
3 Likes

Hello Erik.

As a partner, we received the newsletter regarding content caching capabilities of the new BR1 classic. I do not see in specification for MAX BR1 regarding Media fast content as for HD2 and HD4.

You confirm this capability to deploy application inside ? Eric

Yes, it has the Edge Computing capability for installing Python applications onto the BR1 Classic (HW3).

3 Likes

I’m interested to understand what system functions are accessible to a Python script running in an application - for example:

  • Can the code host a WebSocket server accessible from a web page running on the device? Or from another device on the same VLAN?
  • Are the GPIO ports available to monitor (GPIO input) and control (GPIO output)?

Hoping there’s a specification I can read please?

3 Likes

Hey Wei Ming,

Hope you are well,

we are wondering if there are any example python scripts to show how it is expected to work. Especially the calls used in the start and stop scripts, info on how to then run the start stop scripts, and also the functionality that is accessible?

Thanks
James

1 Like

@WeiMing are there any documentation on how to use the contenthub for python-applications?

As @JonathanGroves and others said, there are examples or specifications on this.

Thanks,
Christian

@hasenburg Welcome to the forum. As described in the tutorial:

Or visually translated with an example:

1 Like

Can you share a php example?