如何将SAPUI5 / OPENUI5部署到GCP App Engine而不是Compute Engine?

我已经使用SCP试用版完成了该应用程序,并希望将其部署在GCP App Engine上以降低成本。这可能吗?

我已经尝试部署.yaml文件,该文件在从SCP导出程序时会随之发生。

基本上,我只是希望使用Google Cloud Platform的App引擎进行部署。

GFHJTYHTR 回答:如何将SAPUI5 / OPENUI5部署到GCP App Engine而不是Compute Engine?

也许您可以尝试this。请小心,因为本教程有些旧。

编辑

正如您提到的,SAPUI5 / OPENUI5没有默认的运行时,但是您可以使用 Custom Runtimes in App Engine Flexible Environment 构建自定义的运行时环境。

  

如果您想使用Python,Java,Node.js,Go,Ruby,PHP,.NET的替代实现,或者以任何其他语言编写代码,则自定义运行时非常适合您。自定义运行时允许您定义新的运行时环境,其中可能包括其他组件,例如语言解释器或应用程序服务器。

就像内置的运行时一样,您需要在项目中添加一个app.yaml文件和一个Dockerfile。我使用此Quickstart和此GitHub repository构建了一个示例。

您需要稍微修改Dockerfileindex.js文件:

Dockerfile

FROM node:alpine

ARG ui5_version="1.69.1"
ARG ui5_filename="openui5-sdk-${ui5_version}.zip"
ARG ui5_url="https://github.com/SAP/openui5/releases/download/${ui5_version}/${ui5_filename}"

WORKDIR /home/node/app

## copy node sources
COPY . .

# install tmp. packages
RUN apk add --no-cache --virtual .sdk wget unzip python make g++

# download sdk
RUN wget ${ui5_url} --no-check-certificate -P /home/node/app

# unzip sdk
RUN unzip -o /home/node/app/${ui5_filename} -d /home/node/app/sdk

# delete sdk.zip
RUN rm /home/node/app/${ui5_filename}

# install node_modules
RUN yarn install --production

# delete tmp. packages
RUN apk del .sdk

# Here's the change for Dockerfile
# App engine expects the application listen on port 8080 
# so let's expose that port
EXPOSE 8080

# start server
ENV NODE_ENV=production
CMD [ "yarn","serve" ]

index.js

const path = require('path');
const fastify = require('fastify')();
const fastifyCors = require('fastify-cors');
const fastifyStatic = require('fastify-static');

// We define port 8080 as GAE expects the app listen on that port.
const port = 8080;
const address = '0.0.0.0';
const root = 'sdk';

(async () => {
    try {
        // cors
        fastify.register(fastifyCors);
        // static
        fastify.register(fastifyStatic,{
            root: path.join(__dirname,root),dotfiles: 'allow'
        });
        // listen
        await fastify.listen(port,address);
    } catch (err) {
        process.exit(1)
    }
})();

然后,创建app.yaml文件:

# We define our runtime as custom so GAE search for
# a Dockerfile.
runtime: custom
env: flex

最后,使用gcloud app deploy部署应用程序。

以此为起点,您可以尝试部署自己的OPENUI5应用。

本文链接:https://www.f2er.com/3136410.html

大家都在问