add hasura
This commit is contained in:
parent
e1198c42eb
commit
b4c6f80e1c
@ -698,7 +698,7 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
|
||||
const { workdir } = await createDirectories({ repository: type, buildId: id });
|
||||
const template: any = await parseAndFindServiceTemplates(service, workdir, true)
|
||||
const network = destinationDockerId && destinationDocker.network;
|
||||
|
||||
|
||||
const config = {};
|
||||
for (const service in template.services) {
|
||||
config[service] = {
|
||||
|
@ -14,8 +14,9 @@ export default [
|
||||
"image": "hasura/graphql-engine:$$core_version",
|
||||
"volumes": [],
|
||||
"environment": [
|
||||
"HASURA_GRAPHQL_METADATA_DATABASE_URL=$$secret_hasura_metadata_database_url",
|
||||
"HASURA_GRAPHQL_ADMIN_PASSWORD=$$secret_hasura_admin_password",
|
||||
"HASURA_GRAPHQL_ENABLE_CONSOLE=$$config_hasura_graphql_enable_console",
|
||||
"HASURA_GRAPHQL_METADATA_DATABASE_URL=$$secret_hasura_graphql_metadata_database_url",
|
||||
"HASURA_GRAPHQL_ADMIN_PASSWORD=$$secret_hasura_graphql_admin_password",
|
||||
],
|
||||
"ports": [
|
||||
"8080"
|
||||
@ -38,18 +39,28 @@ export default [
|
||||
},
|
||||
"variables": [
|
||||
{
|
||||
"id": "$$secret_hasura_metadata_database_url",
|
||||
"id": "$$config_hasura_graphql_enable_console",
|
||||
"name": "HASURA_GRAPHQL_ENABLE_CONSOLE",
|
||||
"label": "Enable Hasura Console",
|
||||
"defaultValue": "true",
|
||||
"description": "",
|
||||
},
|
||||
{
|
||||
"id": "$$secret_hasura_graphql_metadata_database_url",
|
||||
"name": "HASURA_GRAPHQL_METADATA_DATABASE_URL",
|
||||
"label": "Hasura Metadata Database URL",
|
||||
"defaultValue": "postgresql://$$config_postgres_user:$$secret_postgres_password@$$id-postgresql:5432/$$config_postgres_db",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "$$secret_hasura_admin_password",
|
||||
"id": "$$secret_hasura_graphql_admin_password",
|
||||
"name": "HASURA_GRAPHQL_ADMIN_PASSWORD",
|
||||
"label": "Hasura Admin Password",
|
||||
"defaultValue": "$$generate_password",
|
||||
"description": ""
|
||||
"description": "",
|
||||
"extras": {
|
||||
"isVisibleOnUI": true,
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "$$config_postgres_user",
|
||||
|
@ -468,10 +468,12 @@ export async function saveService(request: FastifyRequest<SaveService>, reply: F
|
||||
// data[type] = { update: update }
|
||||
// }
|
||||
for (const setting of serviceSetting) {
|
||||
const { id: settingId, value, changed = false } = setting
|
||||
if (setting.changed) {
|
||||
const { id: settingId, name, value, changed = false, isNew = false } = setting
|
||||
if (changed) {
|
||||
await prisma.serviceSetting.update({ where: { id: settingId }, data: { value } })
|
||||
|
||||
}
|
||||
if (isNew) {
|
||||
await prisma.serviceSetting.create({ data: { name, value, service: { connect: { id } } } })
|
||||
}
|
||||
}
|
||||
await prisma.service.update({
|
||||
|
@ -194,6 +194,8 @@
|
||||
onDestroy(() => {
|
||||
$status.application.initialLoading = true;
|
||||
$status.application.loading = false;
|
||||
$status.application.statuses = [];
|
||||
$status.application.overallStatus = 'stopped';
|
||||
$location = null;
|
||||
$isDeploymentEnabled = false;
|
||||
clearInterval(statusInterval);
|
||||
|
@ -157,6 +157,7 @@
|
||||
$status.service.initialLoading = true;
|
||||
$status.service.loading = false;
|
||||
$status.service.statuses = [];
|
||||
$status.service.overallStatus = 'stopped';
|
||||
$location = null;
|
||||
$isDeploymentEnabled = false;
|
||||
clearInterval(statusInterval);
|
||||
|
@ -72,6 +72,9 @@
|
||||
|
||||
async function handleSubmit(e: any) {
|
||||
const formData = new FormData(e.target);
|
||||
const settings = service.serviceSetting.map((setting: { name: string }) => setting.name);
|
||||
const baseCoolifySetting = ['name', 'fqdn', 'exposePort'];
|
||||
|
||||
for (let field of formData) {
|
||||
const [key, value] = field;
|
||||
service.serviceSetting = service.serviceSetting.map((setting: any) => {
|
||||
@ -81,6 +84,14 @@
|
||||
}
|
||||
return setting;
|
||||
});
|
||||
if (!settings.includes(key) && !baseCoolifySetting.includes(key)) {
|
||||
service.serviceSetting.push({
|
||||
id: service.id,
|
||||
name: key,
|
||||
value: value,
|
||||
isNew: true
|
||||
});
|
||||
}
|
||||
}
|
||||
if (loading.save) return;
|
||||
loading.save = true;
|
||||
@ -94,7 +105,11 @@
|
||||
// });
|
||||
await post(`/services/${id}`, { ...service });
|
||||
setLocation(service);
|
||||
|
||||
const reloadServices = await get(`/services/${id}`);
|
||||
service = reloadServices.service
|
||||
forceSave = false;
|
||||
|
||||
$isDeploymentEnabled = checkIfDeploymentEnabledServices($appSession.isAdmin, service);
|
||||
return addToast({
|
||||
message: 'Configuration saved.',
|
||||
@ -416,18 +431,33 @@
|
||||
value={getDomain(service.fqdn)}
|
||||
/>
|
||||
{:else if variable.defaultValue === 'true' || variable.defaultValue === 'false'}
|
||||
<select
|
||||
class="w-full font-normal"
|
||||
readonly={isDisabled}
|
||||
disabled={isDisabled}
|
||||
id={variable.name}
|
||||
name={variable.name}
|
||||
bind:value={variable.value}
|
||||
form="saveForm"
|
||||
>
|
||||
<option value="true">true</option>
|
||||
<option value="false"> false</option>
|
||||
</select>
|
||||
{#if variable.value === 'true' || variable.value === 'false'}
|
||||
<select
|
||||
class="w-full font-normal"
|
||||
readonly={isDisabled}
|
||||
disabled={isDisabled}
|
||||
id={variable.name}
|
||||
name={variable.name}
|
||||
bind:value={variable.value}
|
||||
form="saveForm"
|
||||
>
|
||||
<option value="true">true</option>
|
||||
<option value="false"> false</option>
|
||||
</select>
|
||||
{:else}
|
||||
<select
|
||||
class="w-full font-normal"
|
||||
readonly={isDisabled}
|
||||
disabled={isDisabled}
|
||||
id={variable.name}
|
||||
name={variable.name}
|
||||
bind:value={variable.defaultValue}
|
||||
form="saveForm"
|
||||
>
|
||||
<option value="true">true</option>
|
||||
<option value="false"> false</option>
|
||||
</select>
|
||||
{/if}
|
||||
{:else if variable.defaultValue === '$$generate_password' || variable.defaultValue === '$$generate_passphrase'}
|
||||
<CopyPasswordField
|
||||
isPasswordField
|
||||
|
Loading…
x
Reference in New Issue
Block a user