diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index c4a6c669b3..5b7c266c1e 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -6,8 +6,11 @@ services: ports: - "${APP_PORT}:4002" environment: - SELF_HOSTED: 1 + SELF_HOSTED: 1 + CLOUD: 1 COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984 + WORKER_URL: http://worker-service:4003 + HOSTING_KEY: ${HOSTING_KEY} BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT} PORT: 4002 JWT_SECRET: ${JWT_SECRET} @@ -20,14 +23,13 @@ services: - "${WORKER_PORT}:4003" environment: SELF_HOSTED: 1, - DEPLOYMENT_API_KEY: ${WORKER_API_KEY} PORT: 4003 MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} RAW_MINIO_URL: http://minio-service:9000 COUCH_DB_USERNAME: ${COUCH_DB_USER} COUCH_DB_PASSWORD: ${COUCH_DB_PASSWORD} - RAW_COUCH_DB_URL: http://couchdb-service:5984 + COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984 SELF_HOST_KEY: ${HOSTING_KEY} depends_on: - minio-service diff --git a/hosting/hosting.properties b/hosting/hosting.properties index 2ef83543a4..ad047a3826 100644 --- a/hosting/hosting.properties +++ b/hosting/hosting.properties @@ -12,7 +12,6 @@ MINIO_ACCESS_KEY=budibase MINIO_SECRET_KEY=budibase COUCH_DB_PASSWORD=budibase COUCH_DB_USER=budibase -WORKER_API_KEY=budibase # This section contains variables that do not need to be altered under normal circumstances APP_PORT=4002 diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 501725f029..2082a3e49b 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -28,6 +28,7 @@ import { const INITIAL_FRONTEND_STATE = { apps: [], name: "", + url: "", description: "", layouts: [], screens: [], @@ -62,6 +63,7 @@ export const getFrontendStore = () => { libraries: pkg.application.componentLibraries, components, name: pkg.application.name, + url: pkg.application.url, description: pkg.application.description, appId: pkg.application._id, layouts, diff --git a/packages/builder/src/builderStore/store/hosting.js b/packages/builder/src/builderStore/store/hosting.js index 36067773b5..d265eeddff 100644 --- a/packages/builder/src/builderStore/store/hosting.js +++ b/packages/builder/src/builderStore/store/hosting.js @@ -1,13 +1,16 @@ import { writable } from "svelte/store" -import api from "../api" +import api, {get} from "../api" -const INITIAL_BACKEND_UI_STATE = { +const INITIAL_HOSTING_UI_STATE = { hostingInfo: {}, appUrl: "", + deployedApps: {}, + deployedAppNames: [], + deployedAppUrls: [], } export const getHostingStore = () => { - const store = writable({ ...INITIAL_BACKEND_UI_STATE }) + const store = writable({ ...INITIAL_HOSTING_UI_STATE }) store.actions = { fetch: async () => { const responses = await Promise.all([ @@ -33,6 +36,16 @@ export const getHostingStore = () => { return state }) }, + fetchDeployedApps: async () => { + let deployments = await (await get("/api/hosting/apps")).json() + store.update(state => { + state.deployedApps = deployments + state.deployedAppNames = Object.values(deployments).map(app => app.name) + state.deployedAppUrls = Object.values(deployments).map(app => app.url) + return state + }) + return deployments + } } return store } diff --git a/packages/builder/src/components/deploy/DeploymentHistory.svelte b/packages/builder/src/components/deploy/DeploymentHistory.svelte index fe95b1369f..e65ddf80cf 100644 --- a/packages/builder/src/components/deploy/DeploymentHistory.svelte +++ b/packages/builder/src/components/deploy/DeploymentHistory.svelte @@ -6,7 +6,7 @@ import api from "builderStore/api" import { notifier } from "builderStore/store/notifications" import CreateWebhookDeploymentModal from "./CreateWebhookDeploymentModal.svelte" - import { hostingStore } from "builderStore" + import { store, hostingStore } from "builderStore" const DeploymentStatus = { SUCCESS: "SUCCESS", @@ -36,7 +36,8 @@ let errorReason let poll let deployments = [] - let deploymentUrl = `${$hostingStore.appUrl}/${appId}` + let urlComponent = $hostingStore.hostingInfo.type === "self" ? $store.url : `/${appId}` + let deploymentUrl = `${$hostingStore.appUrl}${urlComponent}` const formatDate = (date, format) => Intl.DateTimeFormat("en-GB", DATE_OPTIONS[format]).format(date) diff --git a/packages/builder/src/components/settings/tabs/General.svelte b/packages/builder/src/components/settings/tabs/General.svelte index 809917f27d..3852f7dc8d 100644 --- a/packages/builder/src/components/settings/tabs/General.svelte +++ b/packages/builder/src/components/settings/tabs/General.svelte @@ -1,11 +1,20 @@
@@ -21,8 +68,18 @@ on:save={e => updateApplication({ name: e.detail })} thin edit - value={$store.name} + bind:value={$store.name} + bind:error={nameError} label="App Name" /> + {#if $hostingStore.hostingInfo.type === "self"} + updateApplication({ url: e.detail })} + thin + edit + bind:value={$store.url} + bind:error={urlError} + label="App URL" /> + {/if}