Pheix – Artistic 2.0 license compliant, Rakulang driven content management system with data storing on Ethereum blockchain. It is extremely lightweight, fast & scalable.
Modern Pheix is the CMS for Web3.0 oriented projects. The system basics are: decentralized modules, security and storing the content in different target storages: regular databases, private and public ethereum networks.
As the private β-release has shown, Pheix had the generic render time problem. We were wasting ~5 seconds while rendering content on server-side with Template::Mustache. Suggested improvements:
👉 https://narkhov.pro/pheix-public-beta-release-suggestions.html
And finally public β-release has the next major breaking changes:
Traditionally the beta version is published once all scheduled major features have been implemented and released. As with any program beta release, now you have got the access to new features, so you are likely to try Pheix as less stable, but closer to final version. The major Pheix beta release improvements are related to content rendering performance, blockchain support and overall design.
As with any program beta release, now you have early access to new features and able to test them and give your feedback. It's very valuable for the future development.
Pheix private β-release has supported private ethereum PoA networks, ~100% coverage tests and representation layer basic implementation. The network setup and instructions were published and you could run your own test net or get access to our private network for testings.
But:
👉 The general benefit of headless architecture: you can make your access much more secure with presentation and administration layers on different ethereum nodes.
A templating engine basically provides tools for effective metadata interpolation inside static files (templates). At web application runtime, the engine parses and replaces variables with actual content values.
I have done the humble research, where Template::Mustache, Template6 and HTML::Template were compared. Also there were a few tricky techniques with grammars, regular expressions and XML trees.
👉 Raku web templating engines: boost up the parsing performance
Before:
Render time: 1.85553481 sec.
So, if the web application works as the classic CGI instance (no caching, no available workers, no proxies — every run is from the scratch), the request will be rendered at least in 2 seconds (network latency + duty cycle + templating [+ server resource throttling]). Actually this time may be more than 10 seconds (a few parallel clients case) — absolutely bad.
After:
Render time: 0.00972673 sec.
Private β-release used legacy CGI approach. It means: on every request we start Pheix instance proccess, create and initialize all objects, prepeare everything for the usual run (read configs, try blockchain nodes, fetch templates).
Migration to FastCGI requires much more strict objects and data management:
First run:
Every next run (approximately):
Introduce Riot JavaScript components library for rendering content with JS in browser, it's based on REST API and in future will lead Pheix to true headless CMS.
Embedded API debugger is available at https://pheix.org/api-debug.
You can try the sample request:
{
"token": "94a08da1fecbb6e8b46990538c7b50b2",
"method": "GET",
"route": "/",
"httpstat": "200",
"message": ""
}
Response for the sample request:
{
"msg": "/ fetch is successful",
"render": "0.0123497",
"status": 1,
"content": {
"component_render": "0.0120643",
"component": "SGVsbG8sIHdvcmxkISBJJ20gd29ya2luZyA7LSk=",
"tparams": {
"tmpl_paragraph": "Hello, world! I'm working ;-)",
"tmpl_pageheader": "Welcome to Pheix!",
"tmpl_decaptcha": "6211230981",
"tmpl_modcode": "",
"tmpl_update_full": "24 March, 2021",
"tmpl_debug": "",
"tmpl_rakudo_ver": "Rakudo compiler v2020.05.1, Raku 6.d",
"tmpl_extrametas": "",
"tmpl_env_vars": [],
"tmpl_modname": "Pheix::View::Pages"
}
}
}
Try it: https://plnkr.co/edit/bh3mGY1oXbm9h6VU
As you see from request, backend sends content template as component in base64 and variables to be rendered as tparams collection.
More details about Riot JavaScript components library: https://riot.js.org/
Görli Testnet is the first proof-of-authority cross-client testnet, synching Parity Ethereum, Geth, Nethermind, Hyperledger Besu, and EthereumJS. We use Infura.io node as gateway for Görli Testnet — the Infura API suite provides instant access over HTTPS and WebSockets to the Ethereum networks.
Pheix config for Görli Testnet:
{
"type": "1",
"path": "conf/system/abi",
"strg": "PheixDatabase",
"extn": "abi",
"prtl": "https://",
"host": "goerli.infura.io",
"port": "443/v3/<infura-api-token>",
"hash": "0xd47613544f54dd26afe3edcae19e87c788b3ac321df0562244645d21af76b399",
"user": "",
"pass": "",
"data": "undefined"
},
List of related transactions is available via https://goerli.etherscan.io/
Pinned post: https://pheix.org/embedded/pinned-post
Transaction: 0x97e92abe8de919f6…
Pheix addons/modules are installing as regular Raku modules and need to be set up in Pheix global configuration file as the dependencies.
Pheix is based on concept of hybrid CMS. On one hand, it works as a legacy CMS while global templates rendering, on other — content for each page is fetching via async API requests and this is the case of headless CMS.
Sample addon module: Pheix::Addons::Embedded::User
Let's consider the DAS module configuration. Routes are specified as:
Pheix uses Router::Right module as routing engine.
Router::Right is well-documented, you can find docs, examples, best-practices and demo routes on wiki pages.
{
"routes":{
"das":{
"route":{
"path":"/das",
"hdlr":{ "default":"das_index", "/api":"das_index_api" }
}
},
"upload":{
"route":{
"path":"/das/upload",
"hdlr":{ "default":"das_upload", "/api":"das_upload_api" }
}
},
"browsefile":{
"route":{
"path":"/das/{fileid:<\d>+}",
"hdlr":{ "default":"das_browsefile", "/api":"das_browsefile_api" }
}
}
}
}
Eventually to integrate any features to Pheix you should implement them, cover them with the route related API calls and wrap into the new class.
Your class also should have a few specific methods required by Pheix:
method init_json_config returns Pheix::Model::JSОN;
method get(:$ctrl!) returns Pheix::Addons::Embedded::User;
method get_class returns Str;
method get_name returns Str;
method get_sm returns List;
method fill_seodata(:%matchctrl!) returns Hash;
Pheix embedded skin now has night mode. Yep, geeks like to dig web sites after midnight 😄.
Release Candidate 1 😇
There will be next general breaking changes:
I have done the compression efficiency investigation and finally compared LZW::Revolnet and Compress::Bzip2: the last one provides 3x better compression rate. Great boost up for the blockchain performance.
This step requires:
The next important update is related to Pheix distributive.
Now Pheix includes everything you needed for deployment: generic module, start up script, web resources, configuration files, etc… I'm planning to split up a distro to Pheix raku module as the generic entity and Pheix deployment stuff as the dependency or addon.
Pheix RC1 UI will be extended with naive implementation of administration layer. Actually the big deal is to add this layer as Ethereum node interface, in this case we will got such node features as authorization and access level model out of the box.
On other hand, this idea is required available private Ethereum node or full implementation of transaction signing at Net::Ethereum.
So, this is still the point of discussion 🧐
DAS (Digital Audio Server) backend is driven by Pheix, the details were discussed at Perl development room at FOSDEM2021. There are a few interesting tricks and hacks related to digital signal processing, native calls from Raku applications and Pheix integrations.
In general audio backend handles requests from clients, routes them to audio engine and performs the responses. DAS relies on JUCE, Raku and Pheix.
I would like to invite you to Pheix development process — code review, forks and merge requests are very welcome:
https://gitlab.com/pheix/dcms-raku
https://gitlab.com/pheix/net-ethereum-perl6/
https://gitlab.com/pheix/router-right-perl6/
If you like any ideas or concepts presented in this talk — let's get in touch and discuss or just donate at: https://pheix.org/#donate