Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add hasura

Andras Bacsaib4c6f80e1ccb
diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts
index 2c1b5419e0..a52c71e897 100644
--- a/apps/api/src/lib/services/handlers.ts
+++ b/apps/api/src/lib/services/handlers.ts
@@ -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] = {
diff --git a/apps/api/src/lib/templates.ts b/apps/api/src/lib/templates.ts
index d175e6a0de..e2c995cd73 100644
--- a/apps/api/src/lib/templates.ts
+++ b/apps/api/src/lib/templates.ts
@@ -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",
diff --git a/apps/api/src/routes/api/v1/services/handlers.ts b/apps/api/src/routes/api/v1/services/handlers.ts
index f406ff5ce6..2e774a9b7e 100644
--- a/apps/api/src/routes/api/v1/services/handlers.ts
+++ b/apps/api/src/routes/api/v1/services/handlers.ts
@@ -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({
diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelte
index 40ad9677c0..77849f39de 100644
--- a/apps/ui/src/routes/applications/[id]/__layout.svelte
+++ b/apps/ui/src/routes/applications/[id]/__layout.svelte
@@ -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);
diff --git a/apps/ui/src/routes/services/[id]/__layout.svelte b/apps/ui/src/routes/services/[id]/__layout.svelte
index 944f3f9c23..708b2ab6f6 100644
--- a/apps/ui/src/routes/services/[id]/__layout.svelte
+++ b/apps/ui/src/routes/services/[id]/__layout.svelte
@@ -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);
diff --git a/apps/ui/src/routes/services/[id]/index.svelte b/apps/ui/src/routes/services/[id]/index.svelte
index 747deebf28..64d7ff97a0 100644
--- a/apps/ui/src/routes/services/[id]/index.svelte
+++ b/apps/ui/src/routes/services/[id]/index.svelte
@@ -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