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

The process of implementing Mobile Application package Distribution Service by Serverless

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is to share with you the process of implementing mobile application package distribution service by Serverless. The editor thought it was very practical, so I shared it with you to learn. The following information is about the steps of Serverless to implement the mobile application package distribution service.

Preparatory work:

1. Install nodecurl-o-https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bashnvm install 82. Install the fun tool npm install @ alicloud/fun-g

Some subcommands of the fun tool may use docker, so you need to install docker. For more information, please refer to the Fun installation tutorial.

3.apk package preparation

In this lab, we will use a sample apk package from which you can download qq-v2.apk.

Download qq-v2.apk and upload it to your own oss bucket

Get started:

1. Generate project skeleton from fun template

Use the fun init command to quickly initialize this template project locally and execute the command:

$fun init- n apk https://github.com/coco-super/package-distribution-service-for-serverlessstart cloning...Cloning into '.fun-init-cache-2fc2d680-eeff-11e9-a930-6fd4d1ac6506'...remote: Enumerating objects: 23, done.remote: Counting objects: 100% (23x23), done.remote: Compressing objects: 100% (16x16), done.remote: Total 23 (delta 0), reused 18 (delta 0), pack-reused 0Unpacking objects: 100% (23x23), done.finish clone.? Please input an oss bucket name? SunfeiyuStart rendering template...+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/.funignore+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/pom.xml+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/src+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/src/main+ / Users/ellison/simple-fc-uncompress -service-for-oss/apk/src/main/java+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/src/main/java/example+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/src/main/java/example/App.java+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/target+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/target/classes+ / Users/ellison/simple-fc -uncompress-service-for-oss/apk/target/classes/example+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/target/classes/example/App.class+ / Users/ellison/simple-fc-uncompress-service-for-oss/apk/template.ymlfinish rendering template.

Where-n represents the name of the project to be generated as a folder. The default value is fun-app. For more instructions on fun init command format options, please refer to the correct posture calculated by the Yunqi article development function-initialize the project with Fun Init.

After executing fun init, you will be prompted to enter a bucket of oss. Note that oss Bucket is unique in the world. If it is already occupied, please change to a new name or a created one (make sure that the region is consistent if it has already been created).

Ps: the input is the same as the oss bucket name mentioned in the apk package preparation. This example is: sunfeiyu

4. Compile

Execute the fun build command to compile under the root directory of the template project:

$fun build using template: template.ymlstart building function dependencies without dockerbuilding apk/apkrunning task flow MavenTaskFlowrunning task: MavenCompileTaskrunning task: MavenCopyDependenciesrunning task: CopyMavenArtifactsBuild SuccessBuilt artifacts: .fun / build/artifactsBuilt template: .fun / build/artifacts/template.ymlTips for next step==* Invoke Event Function: fun local invoke* Invoke Http Function: fun local start* Deploy Resources: fun deploy

The correct posture for the development function calculation-- build the function using Fun Build.

5. Service deployment

Execute fun deploy under the root of the template project to deploy to the cloud.

$fun deployusing template: .fun / build/artifacts/template.ymlusing region: cn-shanghaiusing accountId: * 8320using accessKeyId: * mTN4using timeout: 60Waiting for service apk to be deployed... Make sure role 'aliyunfcgeneratedrole-cn-shanghai-apk' is exist role' aliyunfcgeneratedrole-cn-shanghai-apk' is already exist attaching policies AliyunOSSFullAccess to role: aliyunfcgeneratedrole-cn-shanghai-apk attached policies AliyunOSSFullAccess to role: aliyunfcgeneratedrole-cn-shanghai-apk Waiting for function apk to be deployed... Waiting for packaging function apk code... The function apk has been packaged. A total of 15 files files were compressed and the final size was 3.13 MB function apk deploy successservice apk deploy success6. Execution function

There are two ways:

Log in to the cloud function computing console and execute it manually. Under the project root directory, the fun invoke apk command is called remotely: $fun invoke apkusing template: template.yml= FC invoke Logs begin = FC Invoke Start RequestId: 23f34cc4-0cd3-40e0-9a04-f6586cf29be62019-10-14 17template.yml= FC invoke Logs begin 06FC Invoke Start RequestId 35.971 [INFO] [23f34cc4-0cd3-40e0-9a04-f6586cf29be6] cmd: java-jar / code/walle-cli-all.jar put-c aliyun-fc / tmp/input.apk / tmp/output.apk2019-10-14 17M06C4 36.152 [INFO] [23f34cc4- 0cd3-40e0-9a04-f6586cf29be6] successful FC Invoke End RequestId: 23f34cc4-0cd3-40e0-9a04-f6586cf29be6Duration: 666.13 ms Billed Duration: 700 ms, Memory Size: 1024 MB, Max Memory Used: 254.55 MB= FC invoke Logs end = FC Invoke Result:Success to view the results

Log in to oss to see that a new apk package has been generated:

Download qq-v2-signed.apk from oss to your local location.

Check to see if channel information is written:

~ / Downloads ⍉ $java-jar / Users/ellison/Downloads/walle-cli-all.jar show qq-v2-signed.apk/Users/ellison/Downloads/qq-v2-signed.apk: {channel=aliyun-fc}

Channel information {channel=aliyun-fc} has been written, successful!

This is the end of the process of Serverless's implementation of mobile application package distribution service. I hope the above content can be of some help to you and 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.

Share To

Servers

Wechat

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

12
Report