In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to install om on tcb and make it practical to do the site version, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Install onemanager on tcb
First of all, download the code from http://github.com/qkqpttgf/OneManager-php, without uploading it to the cloudbase space, locally modify the $_ GET = $event ['queryString'] in the body of platform/tencentscf.php 's GetGlobalVariable ($event) {...} function to $_ GET = $event [' queryStringParameters'], so that parameters such as admin are passed correctly. However, the program still does not get the entry index.main_handler. If you directly use the new function at the cloudbase backend, you can only use index.man as the entry. You can modify the entry manually, but the program will not get the environment variables. We can customize it all using the cloudbase cli command line tool:
Cloudbase cli is a nodejs program. Log in to tcb login-key after local installation according to Tencent product documentation, fill in your users access keyid and keysecret, make a local directory to be uploaded, write the cloudbaserc.json of the following contents under this directory, and prepare the subdirectory: functions/myonemanager/ distributes the modified onemanager code above to the directory to be uploaded (you can also create a directory myonemanager Put both the om source code and cloudbaserc.json into the functions/myonemanager subdirectory, but the functionroot in the following cloudbaserc.json should be changed to.. /):
{"envId": "your environment", "functionRoot": "functions", "functions": [{"name": "myonemanager", "timeout": 6, "runtime": "Php7", "installDependency": true, "handler": "index.main_handler does not have to change the entrance with this", "envVariables": {"Region": "ap-shanghai" "SecretId": "your Tencent accesskeyid", "SecretKey": "your Tencent accesskeysecret", "admin": "you want to define the password for the backend. Plaintext "," sitename ":" station roll call, find an online base64 after transcoding Fill in the result "," hideFunctionalityFile ":" 1 "," disableChangeTheme ":" 1 "," passfile ":" password file name "," theme ":" topic name "," timezone ":" 8 "," disktag ":" disk name 1 | disk name 2 "," disk name 1 ":" {\ "Drive_custom\":\ "on\",\ "Drive_ver\":\ "CN\" \ "client_id\":\ "your azure app portal for onemanager client app id plaintext\",\ "client_secret\":\ "your azure app portal for onemanager client app secretbase64 plaintext find a base64 conversion result to fill in here\",\ "diskname\":\ "plaintext find a base64 conversion result to fill in this\",\ "domain_path\":\ "plaintext find a base64 conversion result to fill in here. It is in the form of domain name 1refresh_token / directory 1 | domain name 2 / directory 2.\ ",\" refresh_token\ ":\" see next manual acquisition method\ ",\" disk\ ": 9999999999}", "disk name 2": "{same disk 1 generation method}"}]}.
You can see that the parameter after disk name 1 is a string, but it itself is also a json. The way to convert json into a string for cloudbase identification is to escape all ". If you find it troublesome and really want to be convenient, you can build an onemanager directly on the normal non-cloudbase area or vps, register the disk, and then fill in the results on it. The above clientid and secretid, the normal installation of od is automatic, but in fact, you can also manually https://portal.azure.cn/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps to generate, I here is interconnection, new registration-> any organization directory account, multi-tenant-> redirect url:web, https://scfonedrive.github.io, here you can see clientid directly. Look at the left column, api permissions need not be set, certificate and password-> new client password, the term is permanent, you will see secret. As for refresh token, it can also be obtained manually from https://service-36wivxsc-1256127833.ap-hongkong.apigateway.myqcloud.com/release/scf_onedrive_filelistor. Token_expires, fill in 10 digits 9.
Cloudbaserc.json is ready, and finally cd to this directory, cloudbase functions:deploy, so that you get a completely manual and programmed installation mode, the background changes 256m to 128m, the trigger path / or / xx cannot be the end of / xx/, later deploy, prompt to overwrite directly to confirm.
More consideration of making onemanager a practical station.
As we know, the cloud function mainly deals with the transmission of api results. You cannot transfer a large amount of data here, so you can ensure that all the results of a http can be completed in the shortest ms. Otherwise, the cloud function will incur relatively high costs according to the number of calls, the duration of calls and the cloud function occupied by memory. Check the cloud function backend to ensure that each call in the 2ms is reasonable and normal. Therefore, the space of programs such as onedrive and managed onemanager (preferably in the same region, such as Century Interconnection with domestic space and international version of port space) is very important to improve the speed of calling. Some onedrive list programs support the separation of front and rear ends, and the cloud function pure backend only returns api results without front-end rendering. Api is fast (column files are fast), such as fodi.
Deal with static resource issues and custom templates:
Because od is a special program, it is located in the list of files on the network disk rather than the display of websites with resources, and every path under its working domain name, if not explicit? setup, is a file call, so its references to all js,css are external (if you find the page slow, change it to a faster cdn address). This is also so that one of the request/respon calls mentioned above can be called as soon as possible, so the templates of od is without static asserts. -therefore, it is not recommended to put the static template resource under the code theme, and then further process it according to whether it is a network disk file.
When it comes to od's templates, in fact, it is also the application of web template technology (the essence is to define a series of template variable blocks in the form of a combination of beginning and end, and then replace them). You can check out the existing template to write a nexmoe1.html, template body logic, such as the simplest nexmoe1.html, template body logic is usually like this: beginning icon processing block, managing related style, front-end style style block, external css and jss references, rendering omf The logical block of the md file (require a maked js and then render directly on the page according to md content). Column file and directory logic (in fact, including div logic block, js logic block), blaaaa.
Acceleration and cdn:
We know that the speed of the website is crucial. This is true not only for users but also for operators. In order to make a practical station, it must be equipped with cdn. For cdn acceleration, such as requiring files to be statically changed to index,html in directories where each url path is a directory name. Does onemanager have any support from relevant parties?
Od is cached. It is mainly accessed to the system temp directory in the backend space of the cloud function. In this way, there will be relatively less time for column files and directories. The program effect and experience will be the best. Od internally caches text files (including markdown) for 1800 seconds. For this process in common.php, look at the fetch files,render list main function, gethiddenpass (), and similar functions.
For md, it is mentioned above that it renders the content pulled from the server through client js on the client (if a large number of md websites are found to be slow, it is possible that the js is on slow cdn, another), while for html, it is downloaded directly like md and output is not subject to rendering, which is equivalent to deploying a static page.
It was originally generated on the client side. In fact, md can also be completed on the server side, such as downloading a php renderer mdparser.php, and then making changes in the corresponding headmd processing location in include 'mdparser.php';common.php in index.php:
$parser = new HyperDown\ Parser; $headmd = str_replace ('', $parser- > makeHtml (fetch_files (path_format (urldecode ($path). '/ head.md'),' /') ['content'] [' body']), $tmp [0]); $tmp = splitfirst ($html,''); $html = $tmp [0]; $tmp = splitfirst ($tmp [1],'')
Generating html on the server side and returning it as an api result slightly increases the api time, but the result is more reasonable. You can further save the rendered html result in index.html, a subdirectory of the corresponding md address in cache (instead of the original raw md content), and then next time fetch to this md address, directly fetch cache, and render directly as you do with html. Such "site-wide pseudo-static" is also useful for cdn.
You can also modify the logic of refreshcache. Od has a refreshcache, which first changes to the cache of the current directory on which directory to refresh. And only work in manual management mode, in fact, you can make it automatically static, browse to the corresponding md location to generate the corresponding index.html to the cache/md naming subdirectory. Then do an one-click md in the background to generate html to cache static buttons and functions. Or generate it into the storage of cloudbase. -there is already such a program, static website generator as a cloud function to generate static files to oss, cloud storage. Very much like an automated github page action.
On how to install om on tcb and make it practical to do the site version to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.