Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop a project under MacOS

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to carry out the project development under MacOS, I believe that many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Preface

First of all, we will introduce some of the more important concepts that appear below:

Function computing (Function Compute): function computing is an event-driven service. Through function calculation, users do not need to manage the operation of the server, but only need to write code and upload. The function calculation prepares the computing resources and runs the user code in an elastic way, while the user only needs to pay according to the resources consumed by the actual code. Function to calculate more information.

Fun: Fun is a tool for supporting Serverless application deployment, which can help you easily manage resources such as function computing, API gateways, log services, and so on. It assists you in developing, building, and deploying operations through a resource configuration file (template.yml). More documentation references for Fun.

Note: the technique introduced requires a Fun version greater than or equal to 2.10.2.

Dependent tool

This project is developed under MacOS, the tools involved are platform-independent, and should also be applicable to Linux and Windows desktop systems. Before starting this example, make sure that the following tools are installed correctly, updated to the latest version, and configured correctly.

Docker

Fun

Fcli

The Fun and Fcli tools rely on docker to simulate the local environment.

For MacOS users, you can use homebrew to install:

Brew cask install dockerbrew tap vangie/formulabrew install funbrew install fcli

For Windows and Linux user installation, please refer to:

Https://github.com/aliyun/fun/blob/master/docs/usage/installation.md

Https://github.com/aliyun/fcli/releases

After installation, remember to initialize the configuration by executing fun config first.

Note that if you have already installed fun, make sure the version of fun is above 2.10.2.

$fun-- version2.10.1 starts initialization quickly

Use the fun init command to quickly initialize this template project locally.

Fun init vangie/selenium-java-example installation depends on $fun install... Local testing

The test code ChromeDemo is as follows:

Public class ChromeDemo implements StreamRequestHandler {public void handleRequest (InputStream inputStream, OutputStream outputStream, Context context) throws IOException {System.setProperty ("webdriver.chrome.driver", "/ code/chromedriver"); ChromeOptions options = new ChromeOptions (); options.setBinary ("/ code/headless-chromium"); options.addArguments ("--disable-extensions") / / disabling extensions options.addArguments ("--disable-gpu"); / / applicable to windows os only options.addArguments ("--disable-dev-shm-usage"); / / overcome limited resource problems options.addArguments ("--no-sandbox"); / / Bypass OS security model options.addArguments ("--headless"); WebDriver driver = new ChromeDriver (options); driver.get ("https://ide.fc.aliyun.com");") OutputStream.write (("Page title is:" + driver.getTitle () + "\ n") .getBytes (); driver.quit () }} run $mvn package & & fun local invoke selenium...FC Invoke Start RequestId: 68c83b4c-b053-479c-9b0e-9503582ccb56handle user request is com.aliyun.fc.selenium.ChromeDemo::handleRequestcache is null starting ChromeDriver 2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881) on port 20652Only local connections are allowed.Mar 05 locally 2019 11:34:27 AM org.openqa.selenium.remote.ProtocolHandshake createSessionINFO: Detected dialect: OSSPage title is: cloud integrated development environment FC Invoke End RequestId: 68c83b4c-b053-479c-9b0e-9503582ccb56RequestId: 68c83b4c-b053-479c-9b0e-9503582ccb56 Billed Duration: 5265 ms Memory Size: 1998 MB Max Memory Used: 240MB deployment $mvn package & & fun deploy execution $fcli function invoke-s chrome-f selenium Page title is: cloud integrated development environment about file size

Because the compressed volume of chromedriver and headless-chromium is very close to 50MB, there is very little space for Jar, so another version with high compression ratio is made, which uses the brotli algorithm with higher compression ratio to compress, and the compressed size is 32.7MB. Then use initializer to decompress at runtime, and the decompression time is about 3.7s.

After reading the above, have you mastered the method of how to develop the project under MacOS? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report