Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 131e3e2

Browse files
AdrinlolNikolayS
authored andcommitted
1 parent 978edf9 commit 131e3e2

File tree

40 files changed

+1208
-903
lines changed

40 files changed

+1208
-903
lines changed

‎ui/cspell.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@
186186
"pgnode",
187187
"pgbackrest",
188188
"vitabaks",
189-
"distro"
189+
"distro",
190+
"pgaudit",
191+
"pgrouting",
192+
"timescaledb",
193+
"citus",
194+
"pgvector",
195+
"partman",
196+
"fstype"
190197
]
191198
}

‎ui/packages/platform/src/api/configs/launchDeploy.ts‎

Lines changed: 74 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import {
2+
DEBUG_API_SERVER,
3+
sePackageTag,
4+
} from 'components/DbLabInstanceForm/utils'
15
import { simpleInstallRequest } from 'helpers/simpleInstallRequest'
2-
import { initialState } from 'components/DbLabInstanceForm/reducer'
3-
import { DEBUG_API_SERVER, sePackageTag } from 'components/DbLabInstanceForm/utils'
6+
import { useCloudProviderProps } from 'hooks/useCloudProvider'
47

58
const API_SERVER = process.env.REACT_APP_API_SERVER
69

@@ -23,7 +26,7 @@ export const launchDeploy = async ({
2326
cloudImage,
2427
launchType,
2528
}: {
26-
state: typeofinitialState
29+
state: useCloudProviderProps['initialState']
2730
orgKey: string
2831
userID?: number
2932
extraEnvs: {
@@ -32,6 +35,26 @@ export const launchDeploy = async ({
3235
cloudImage: string
3336
launchType: 'cluster' | 'instance'
3437
}) => {
38+
const instanceExtraVars = [
39+
`provision=${state.provider}`,
40+
`server_name=${state.name}`,
41+
`platform_project_name=${state.name}`,
42+
`server_type=${state.instanceType.native_name}`,
43+
`server_image=${cloudImage}`,
44+
`server_location=${state.location.native_code}`,
45+
`volume_size=${state.storage}`,
46+
`dblab_engine_version=${state.tag}`,
47+
`zpool_datasets_number=${state.snapshots}`,
48+
`dblab_engine_verification_token=${state.verificationToken}`,
49+
`platform_org_key=${orgKey}`,
50+
]
51+
52+
const instanceOptionalVars = [
53+
state.publicKeys && `ssh_public_keys="${state.publicKeys}"`,
54+
API_SERVER === DEBUG_API_SERVER &&
55+
`platform_url=https://v2.postgres.ai/api/general`,
56+
].filter(Boolean)
57+
3558
const instanceBody = {
3659
playbook: 'deploy_dle.yml',
3760
provision: state.provider,
@@ -42,29 +65,56 @@ export const launchDeploy = async ({
4265
location: state.location.native_code,
4366
},
4467
image: `postgresai/dle-se-ansible:${sePackageTag}`,
45-
extraVars: [
46-
`provision=${state.provider}`,
47-
`server_name=${state.name}`,
48-
`platform_project_name=${state.name}`,
49-
`server_type=${state.instanceType.native_name}`,
50-
`server_image=${cloudImage}`,
51-
`server_location=${state.location.native_code}`,
52-
`volume_size=${state.storage}`,
53-
`dblab_engine_version=${state.tag}`,
54-
`zpool_datasets_number=${state.snapshots}`,
55-
`dblab_engine_verification_token=${state.verificationToken}`,
56-
`platform_org_key=${orgKey}`,
57-
...(state.publicKeys
58-
? // eslint-disable-next-line no-useless-escape
59-
[`ssh_public_keys=\"${state.publicKeys}\"`]
60-
: []),
61-
...(API_SERVER === DEBUG_API_SERVER
62-
? [`platform_url=https://v2.postgres.ai/api/general`]
63-
: []),
64-
],
68+
extraVars: [...instanceExtraVars, ...instanceOptionalVars],
6569
extraEnvs: formatExtraEnvs(extraEnvs),
6670
}
6771

72+
const user = state.provider === 'aws' ? 'ubuntu' : 'root'
73+
74+
const extraVars = [
75+
`ansible_user=${user}`,
76+
`provision=${state.provider}`,
77+
`servers_count=${state.numberOfInstances}`,
78+
`server_type=${state.instanceType.native_name}`,
79+
`server_image=${cloudImage}`,
80+
`server_location=${state.location.native_code}`,
81+
`volume_size=${state.storage}`,
82+
`postgresql_version=${state.version}`,
83+
`database_public_access=${state.database_public_access}`,
84+
`with_haproxy_load_balancing=${state.with_haproxy_load_balancing}`,
85+
`pgbouncer_install=${state.pgbouncer_install}`,
86+
`pg_data_mount_fstype=${state.fileSystem}`,
87+
`synchronous_mode=${state.synchronous_mode}`,
88+
`netdata_install=${state.netdata_install}`,
89+
`patroni_cluster_name=${state.name}`,
90+
`platform_org_key=${orgKey}`,
91+
]
92+
93+
const optionalVars = [
94+
state.synchronous_mode &&
95+
`synchronous_node_count=${state.synchronous_node_count}`,
96+
state.pg_repack && `enable_pg_repack=${state.pg_repack}`,
97+
state.pg_cron && `enable_pg_cron=${state.pg_cron}`,
98+
state.pgaudit && `enable_pgaudit=${state.pgaudit}`,
99+
state.version !== 10 &&
100+
state.pgvector &&
101+
`enable_pgvector=${state.pgvector}`,
102+
state.postgis && `enable_postgis=${state.postgis}`,
103+
state.pgrouting && `enable_pgrouting=${state.pgrouting}`,
104+
state.version !== 10 &&
105+
state.version !== 11 &&
106+
state.timescaledb &&
107+
`enable_timescaledb=${state.timescaledb}`,
108+
state.version !== 10 && state.citus && `enable_citus=${state.citus}`,
109+
state.pg_partman && `enable_pg_partman=${state.pg_partman}`,
110+
state.pg_stat_kcache && `enable_pg_stat_kcache=${state.pg_stat_kcache}`,
111+
state.pg_wait_sampling &&
112+
`enable_pg_wait_sampling=${state.pg_wait_sampling}`,
113+
state.publicKeys && `ssh_public_keys="${state.publicKeys}"`,
114+
API_SERVER === DEBUG_API_SERVER &&
115+
`platform_url=https://v2.postgres.ai/api/general`,
116+
].filter(Boolean)
117+
68118
const clusterBody = {
69119
playbook: 'deploy_pgcluster.yml',
70120
provision: state.provider,
@@ -75,32 +125,7 @@ export const launchDeploy = async ({
75125
location: state.location.native_code,
76126
},
77127
image: 'vitabaks/postgresql_cluster:cloud',
78-
extraVars: [
79-
`ansible_user=${state.provider === "aws" ? 'ubuntu' : 'root'}`,
80-
`provision=${state.provider}`,
81-
`servers_count=${state.numberOfInstances}`,
82-
`server_type=${state.instanceType.native_name}`,
83-
`server_image=${cloudImage}`,
84-
`server_location=${state.location.native_code}`,
85-
`volume_size=${state.storage}`,
86-
`postgresql_version=${state.version}`,
87-
`database_public_access=${state.database_public_access}`,
88-
`database_public_access=${state.database_public_access}`,
89-
`with_haproxy_load_balancing=${state.with_haproxy_load_balancing}`,
90-
`pgbouncer_install=${state.pgbouncer_install}`,
91-
`synchronous_mode=${state.synchronous_mode}`,
92-
...(state.synchronous_mode ? [`synchronous_node_count=${state.synchronous_node_count}`] : []),
93-
`netdata_install=${state.netdata_install}`,
94-
`patroni_cluster_name=${state.name}`,
95-
`platform_org_key=${orgKey}`,
96-
...(state.publicKeys
97-
? // eslint-disable-next-line no-useless-escape
98-
[`ssh_public_keys=\"${state.publicKeys}\"`]
99-
: []),
100-
...(API_SERVER === DEBUG_API_SERVER
101-
? [`platform_url=https://v2.postgres.ai/api/general`]
102-
: []),
103-
],
128+
extraVars: [...extraVars, ...optionalVars],
104129
extraEnvs: formatExtraEnvs(extraEnvs),
105130
}
106131

‎ui/packages/platform/src/components/AddDbLabInstanceFormWrapper/AddDbLabInstanceFormWrapper.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { makeStyles } from '@material-ui/core'
22
import { styles } from '@postgres.ai/shared/styles/styles'
33
import AddDbLabInstanceForm from 'components/AddDbLabInstanceFormWrapper/AddDblabInstanceForm'
4+
import { OrgPermissions } from 'components/types'
45
import { RouteComponentProps } from 'react-router'
56

67
export interface DbLabInstanceFormProps {
78
edit?: boolean
89
orgId: number
910
project: string | undefined
1011
history: RouteComponentProps['history']
11-
orgPermissions: {
12-
dblabInstanceCreate?: boolean
13-
}
12+
orgPermissions: OrgPermissions
1413
}
1514

1615
export const AddDbLabInstanceFormWrapper = (props: DbLabInstanceFormProps) => {

‎ui/packages/platform/src/components/DbLabInstanceForm/DbLabFormSteps/AnsibleInstance.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1+
import { Button, makeStyles } from '@material-ui/core'
12
import { Box } from '@mui/material'
23
import { useEffect, useState } from 'react'
3-
import { makeStyles, Button } from '@material-ui/core'
44

5-
import { Spinner } from '@postgres.ai/shared/components/Spinner'
65
import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub'
6+
import { Spinner } from '@postgres.ai/shared/components/Spinner'
77
import { SyntaxHighlight } from '@postgres.ai/shared/components/SyntaxHighlight'
88

9-
import { getOrgKeys } from 'api/cloud/getOrgKeys'
109
import { getCloudImages } from 'api/cloud/getCloudImages'
10+
import { getOrgKeys } from 'api/cloud/getOrgKeys'
1111

12+
import { InstanceFormCreation } from 'components/DbLabInstanceForm/DbLabFormSteps/InstanceFormCreation'
1213
import {
1314
getGcpAccountContents,
1415
getNetworkSubnet,
15-
getPlaybookCommandWithoutDocker,
16+
getPlaybookCommand,
1617
} from 'components/DbLabInstanceForm/utils'
1718
import {
1819
cloneRepositoryCommand,
1920
getAnsibleInstallationCommand,
2021
} from 'components/DbLabInstanceInstallForm/utils'
21-
import { InstanceFormCreation } from 'components/DbLabInstanceForm/DbLabFormSteps/InstanceFormCreation'
2222

23-
import { initialState } from '../reducer'
2423
import {
2524
cloneClusterRepositoryCommand,
26-
getClusterPlaybookCommandWithoutDocker,
25+
getClusterPlaybookCommand,
2726
} from 'components/PostgresClusterForm/utils'
27+
import { useCloudProviderProps } from 'hooks/useCloudProvider'
2828

2929
export const formStyles = makeStyles({
3030
marginTop: {
@@ -128,7 +128,7 @@ export const AnsibleInstance = ({
128128
setFormStep,
129129
}: {
130130
cluster?: boolean
131-
state: typeofinitialState
131+
state: useCloudProviderProps["initialState"]
132132
orgId: number
133133
goBack: () => void
134134
goBackToForm: () => void
@@ -280,12 +280,12 @@ export const AnsibleInstance = ({
280280
<SyntaxHighlight
281281
content={
282282
cluster
283-
? getClusterPlaybookCommandWithoutDocker(
283+
? getClusterPlaybookCommand(
284284
state,
285285
cloudImages[0],
286286
orgKey,
287287
)
288-
: getPlaybookCommandWithoutDocker(state, cloudImages[0], orgKey)
288+
: getPlaybookCommand(state, cloudImages[0], orgKey,false)
289289
}
290290
/>
291291
{getNetworkSubnet(state.provider, classes)}

‎ui/packages/platform/src/components/DbLabInstanceForm/DbLabFormSteps/DockerInstance.tsx‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1+
import { Button } from '@material-ui/core'
12
import { Box } from '@mui/material'
23
import { useEffect, useState } from 'react'
3-
import { Button } from '@material-ui/core'
44

5-
import { Spinner } from '@postgres.ai/shared/components/Spinner'
65
import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub'
6+
import { Spinner } from '@postgres.ai/shared/components/Spinner'
77
import { SyntaxHighlight } from '@postgres.ai/shared/components/SyntaxHighlight'
88

9-
import { getOrgKeys } from 'api/cloud/getOrgKeys'
109
import { getCloudImages } from 'api/cloud/getCloudImages'
10+
import { getOrgKeys } from 'api/cloud/getOrgKeys'
1111

12-
import {
13-
getNetworkSubnet,
14-
getGcpAccountContents,
15-
getPlaybookCommand,
16-
} from 'components/DbLabInstanceForm/utils'
1712
import {
1813
InstanceDocumentation,
1914
formStyles,
2015
} from 'components/DbLabInstanceForm/DbLabFormSteps/AnsibleInstance'
2116
import { InstanceFormCreation } from 'components/DbLabInstanceForm/DbLabFormSteps/InstanceFormCreation'
17+
import {
18+
getGcpAccountContents,
19+
getNetworkSubnet,
20+
getPlaybookCommand,
21+
} from 'components/DbLabInstanceForm/utils'
2222

23-
import { initialState } from '../reducer'
2423
import { getClusterPlaybookCommand } from 'components/PostgresClusterForm/utils'
24+
import { useCloudProviderProps } from 'hooks/useCloudProvider'
2525

2626
export const DockerInstance = ({
2727
cluster,
@@ -32,7 +32,7 @@ export const DockerInstance = ({
3232
formStep,
3333
setFormStep,
3434
}: {
35-
state: typeofinitialState
35+
state: useCloudProviderProps['initialState']
3636
cluster?: boolean
3737
orgId: number
3838
goBack: () => void
@@ -150,8 +150,8 @@ export const DockerInstance = ({
150150
<SyntaxHighlight
151151
content={
152152
cluster
153-
? getClusterPlaybookCommand(state, cloudImages[0], orgKey)
154-
: getPlaybookCommand(state, cloudImages[0], orgKey)
153+
? getClusterPlaybookCommand(state, cloudImages[0], orgKey,true)
154+
: getPlaybookCommand(state, cloudImages[0], orgKey,true)
155155
}
156156
/>
157157
{getNetworkSubnet(state.provider, classes)}

‎ui/packages/platform/src/components/DbLabInstanceForm/DbLabFormSteps/SimpleInstance.tsx‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { Box } from '@mui/material'
21
import { Button, TextField } from '@material-ui/core'
2+
import { Box } from '@mui/material'
33
import { useCallback, useEffect, useState } from 'react'
44

5-
import { Spinner } from '@postgres.ai/shared/components/Spinner'
65
import { ErrorStub } from '@postgres.ai/shared/components/ErrorStub'
6+
import { Spinner } from '@postgres.ai/shared/components/Spinner'
77
import { SyntaxHighlight } from '@postgres.ai/shared/components/SyntaxHighlight'
8-
import { formStyles } from 'components/DbLabInstanceForm/DbLabFormSteps/AnsibleInstance'
98
import { ResponseMessage } from '@postgres.ai/shared/pages/Configuration/ResponseMessage'
9+
import { formStyles } from 'components/DbLabInstanceForm/DbLabFormSteps/AnsibleInstance'
1010
import { InstanceFormCreation } from 'components/DbLabInstanceForm/DbLabFormSteps/InstanceFormCreation'
1111

12-
import { initialState } from '../reducer'
13-
import { cloudProviderName } from '../utils'
12+
import { useWsScroll } from '@postgres.ai/shared/pages/Logs/hooks/useWsScroll'
13+
import { getCloudImages } from 'api/cloud/getCloudImages'
1414
import { getOrgKeys } from 'api/cloud/getOrgKeys'
15-
import { establishConnection } from './streamLogs'
15+
import { getTaskState } from 'api/configs/getTaskState'
1616
import { launchDeploy } from 'api/configs/launchDeploy'
17-
import { getCloudImages } from 'api/cloud/getCloudImages'
1817
import { regenerateCode } from 'api/configs/regenerateCode'
19-
import { useWsScroll } from '@postgres.ai/shared/pages/Logs/hooks/useWsScroll'
20-
import { getTaskState } from 'api/configs/getTaskState'
18+
import { useCloudProviderProps } from 'hooks/useCloudProvider'
19+
import { cloudProviderName } from '../utils'
20+
import { establishConnection } from './streamLogs'
2121

2222
const SimpleInstanceDocumentation = ({
2323
state,
@@ -30,7 +30,7 @@ const SimpleInstanceDocumentation = ({
3030
isLoading: boolean
3131
documentation: string
3232
secondStep: JSX.Element
33-
state: typeofinitialState
33+
state: useCloudProviderProps['initialState']
3434
handleDeploy: (e: React.FormEvent<HTMLFormElement>) => void
3535
deployingState: {
3636
status: string
@@ -121,7 +121,7 @@ export const SimpleInstance = ({
121121
setFormStep,
122122
}: {
123123
cluster?: boolean
124-
state: typeofinitialState
124+
state: useCloudProviderProps['initialState']
125125
orgId: number
126126
userID?: number
127127
goBackToForm: () => void
@@ -349,6 +349,7 @@ export const SimpleInstance = ({
349349
},
350350
[
351351
state,
352+
cluster,
352353
extraEnvs,
353354
orgKey,
354355
cloudImages,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /