@geode/opengeodeweb-front 10.29.0-rc.4 → 10.29.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/stores/menu.js +1 -1
- package/package.json +1 -1
- package/server/api/app/run_cloud.js +3 -3
- package/server/utils/cloud.js +17 -50
package/app/stores/menu.js
CHANGED
|
@@ -83,7 +83,7 @@ const Section_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
|
83
83
|
|
|
84
84
|
const StructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
85
85
|
|
|
86
|
-
const ModelComponent_menu = [ModelStyleOptions];
|
|
86
|
+
const ModelComponent_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
87
87
|
|
|
88
88
|
const menusData = {
|
|
89
89
|
mesh: {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { GoogleAuth } from "google-auth-library";
|
|
|
6
6
|
import { ServicesClient } from "@google-cloud/run";
|
|
7
7
|
|
|
8
8
|
// Local imports
|
|
9
|
-
import {
|
|
9
|
+
import { artifactImage, requestConfig } from "@ogw_server/utils/cloud";
|
|
10
10
|
|
|
11
11
|
export default defineEventHandler(async (event) => {
|
|
12
12
|
try {
|
|
@@ -23,8 +23,8 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
|
|
24
24
|
});
|
|
25
25
|
const authClient = await auth.getClient();
|
|
26
|
-
const
|
|
27
|
-
const request = requestConfig(parent,
|
|
26
|
+
const image = await artifactImage(parent, authClient);
|
|
27
|
+
const request = requestConfig(parent, image, email, projectName);
|
|
28
28
|
console.log({ request });
|
|
29
29
|
const runClient = new ServicesClient({ authClient });
|
|
30
30
|
const [operation] = await runClient.createService(request);
|
package/server/utils/cloud.js
CHANGED
|
@@ -5,11 +5,16 @@ import { google } from "googleapis";
|
|
|
5
5
|
|
|
6
6
|
// Local imports
|
|
7
7
|
|
|
8
|
-
async function artifactImage(
|
|
8
|
+
async function artifactImage(parent, authClient) {
|
|
9
|
+
const projectName = process.env.PROJECT;
|
|
10
|
+
const registry = google.artifactregistry({
|
|
11
|
+
version: "v1",
|
|
12
|
+
auth: authClient,
|
|
13
|
+
});
|
|
9
14
|
const branch = process.env.NETLIFY_BRANCH;
|
|
10
15
|
const [_, projectId] = parent.split("/");
|
|
11
16
|
const repository = `${parent}/repositories/github/packages/`;
|
|
12
|
-
const name = `${repository}${
|
|
17
|
+
const name = `${repository}${projectName}/tags/${branch}`;
|
|
13
18
|
console.log({ name });
|
|
14
19
|
const response = await registry.projects.locations.repositories.packages.tags.get({
|
|
15
20
|
name,
|
|
@@ -17,24 +22,11 @@ async function artifactImage(registry, parent, repo) {
|
|
|
17
22
|
console.log({ response });
|
|
18
23
|
const digest = response.data.version.split("/").pop();
|
|
19
24
|
const artifactRegistry = `europe-west9-docker.pkg.dev/${projectId}/github`;
|
|
20
|
-
const image = `${artifactRegistry}/${
|
|
21
|
-
console.log("Found image for",
|
|
25
|
+
const image = `${artifactRegistry}/${projectName}@${digest}`;
|
|
26
|
+
console.log("Found image for", projectName, image);
|
|
22
27
|
return image;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
function artifactImages(parent, authClient) {
|
|
26
|
-
const projectName = process.env.PROJECT;
|
|
27
|
-
const registry = google.artifactregistry({
|
|
28
|
-
version: "v1",
|
|
29
|
-
auth: authClient,
|
|
30
|
-
});
|
|
31
|
-
return Promise.all([
|
|
32
|
-
artifactImage(registry, parent, "opengeodeweb-router"),
|
|
33
|
-
artifactImage(registry, parent, `${projectName}-back`),
|
|
34
|
-
artifactImage(registry, parent, `${projectName}-viewer`),
|
|
35
|
-
]);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
30
|
function sanitizeLabelValue(label) {
|
|
39
31
|
console.log("label", label);
|
|
40
32
|
const maxLabelLength = 63;
|
|
@@ -44,47 +36,32 @@ function sanitizeLabelValue(label) {
|
|
|
44
36
|
.slice(0, maxLabelLength);
|
|
45
37
|
}
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
function requestConfig(parent, routerImage, backImage, viewerImage, email, projectName) {
|
|
39
|
+
function requestConfig(parent, image, email, projectName) {
|
|
49
40
|
const resources = {
|
|
50
41
|
limits: {
|
|
51
42
|
cpu: "1000m",
|
|
52
43
|
memory: "1Gi",
|
|
53
44
|
},
|
|
54
45
|
};
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
const labels = {
|
|
47
|
+
user: sanitizeLabelValue(email),
|
|
48
|
+
project: sanitizeLabelValue(projectName),
|
|
58
49
|
};
|
|
59
50
|
return {
|
|
60
51
|
parent,
|
|
61
52
|
service: {
|
|
62
53
|
ingress: "INGRESS_TRAFFIC_ALL",
|
|
63
54
|
invokerIamDisabled: true,
|
|
64
|
-
labels
|
|
65
|
-
user: sanitizeLabelValue(email),
|
|
66
|
-
project: sanitizeLabelValue(projectName),
|
|
67
|
-
},
|
|
55
|
+
labels,
|
|
68
56
|
scaling: {
|
|
69
57
|
scalingMode: "MANUAL",
|
|
70
58
|
manualInstanceCount: 1,
|
|
71
59
|
},
|
|
72
60
|
template: {
|
|
73
|
-
labels
|
|
74
|
-
user: sanitizeLabelValue(email),
|
|
75
|
-
project: sanitizeLabelValue(projectId),
|
|
76
|
-
},
|
|
77
|
-
volumes: [
|
|
78
|
-
{
|
|
79
|
-
name: "project",
|
|
80
|
-
emptyDir: {
|
|
81
|
-
medium: "MEMORY",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
61
|
+
labels,
|
|
85
62
|
containers: [
|
|
86
63
|
{
|
|
87
|
-
image
|
|
64
|
+
image,
|
|
88
65
|
ports: [
|
|
89
66
|
{
|
|
90
67
|
containerPort: 80,
|
|
@@ -106,20 +83,10 @@ function requestConfig(parent, routerImage, backImage, viewerImage, email, proje
|
|
|
106
83
|
failureThreshold: 30,
|
|
107
84
|
},
|
|
108
85
|
},
|
|
109
|
-
{
|
|
110
|
-
image: backImage,
|
|
111
|
-
resources,
|
|
112
|
-
volumeMounts: [volumeMounts],
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
image: viewerImage,
|
|
116
|
-
resources,
|
|
117
|
-
volumeMounts: [volumeMounts],
|
|
118
|
-
},
|
|
119
86
|
],
|
|
120
87
|
},
|
|
121
88
|
},
|
|
122
89
|
};
|
|
123
90
|
}
|
|
124
91
|
|
|
125
|
-
export {
|
|
92
|
+
export { artifactImage, requestConfig };
|