Merge branch 'develop' of github.com:Budibase/budibase into new-design-ui

This commit is contained in:
Andrew Kingston 2022-07-11 12:13:14 +01:00
commit e00c91c8a6
36 changed files with 164 additions and 210 deletions

View File

@ -7,7 +7,6 @@ on:
branches:
- master
- develop
- new-design-ui
pull_request:
branches:
- master
@ -60,19 +59,3 @@ jobs:
with:
install: false
command: yarn test:e2e:ci
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Upload to S3
if: github.ref == 'refs/heads/new-design-ui'
run: |
tar -czvf new_ui.tar.gz packages/server/builder/assets packages/server/builder/index.html
aws s3 cp new_ui.tar.gz s3://prod-budi-app-assets/beta:design_ui/
aws s3 cp packages/client/dist/budibase-client.js s3://prod-budi-app-assets/beta:design_ui/budibase-client.js
aws cloudfront create-invalidation --distribution-id E3ELKP4RCEHVLW --paths "/beta:design_ui/*"

View File

@ -0,0 +1,62 @@
name: Deploy Budibase Single Container Image to DockerHub
on:
push:
branches:
- "omnibus-action"
- "develop"
- "master"
- "main"
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref}}
BRANCH: ${{ github.event.pull_request.head.ref }}
CI: true
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
REGISTRY_URL: registry.hub.docker.com
jobs:
build:
name: "build"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Install Pro
run: yarn install:pro $BRANCH $BASE_BRANCH
- name: Run Yarn
run: yarn
- name: Run Yarn Bootstrap
run: yarn bootstrap
- name: Runt Yarn Lint
run: yarn lint
- name: Run Yarn Build
run: yarn build
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}
- name: Get the latest release version
id: version
run: |
release_version=$(cat lerna.json | jq -r '.version')
echo $release_version
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Tag and release Budibase service docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: budibase/budibase,budibase/budibase:v${{ env.RELEASE_VERSION }}
file: ./hosting/single/Dockerfile

1
.yarnrc Normal file
View File

@ -0,0 +1 @@
network-timeout 100000

View File

@ -122,10 +122,14 @@ spec:
value: {{ .Values.globals.automationMaxIterations | quote }}
- name: TENANT_FEATURE_FLAGS
value: {{ .Values.globals.tenantFeatureFlags | quote }}
{{ if .Values.globals.bbAdminUserEmail }}
- name: BB_ADMIN_USER_EMAIL
value: { { .Values.globals.bbAdminUserEmail | quote } }
{{ end }}
{{ if .Values.globals.bbAdminUserPassword }}
- name: BB_ADMIN_USER_PASSWORD
value: { { .Values.globals.bbAdminUserPassword | quote } }
{{ end }}
image: budibase/apps:{{ .Values.globals.appVersion }}
imagePullPolicy: Always

View File

@ -34,27 +34,32 @@ ENV \
ARCHITECTURE=amd \
BUDIBASE_ENVIRONMENT=PRODUCTION \
CLUSTER_PORT=80 \
COUCHDB_PASSWORD=budibase \
COUCHDB_USER=budibase \
COUCH_DB_URL=http://budibase:budibase@localhost:5984 \
# CUSTOM_DOMAIN=budi001.custom.com \
DEPLOYMENT_ENVIRONMENT=docker \
INTERNAL_API_KEY=budibase \
JWT_SECRET=testsecret \
MINIO_ACCESS_KEY=budibase \
MINIO_SECRET_KEY=budibase \
MINIO_URL=http://localhost:9000 \
POSTHOG_TOKEN=phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS \
REDIS_PASSWORD=budibase \
REDIS_URL=localhost:6379 \
SELF_HOSTED=1 \
TARGETBUILD=$TARGETBUILD \
WORKER_PORT=4002 \
WORKER_URL=http://localhost:4002
WORKER_URL=http://localhost:4002 \
APPS_URL=http://localhost:4001
# These secret env variables are generated by the runner at startup
# their values can be overriden by the user, they will be written
# to the .env file in the /data directory for use later on
# REDIS_PASSWORD=budibase \
# COUCHDB_PASSWORD=budibase \
# COUCHDB_USER=budibase \
# COUCH_DB_URL=http://budibase:budibase@localhost:5984 \
# INTERNAL_API_KEY=budibase \
# JWT_SECRET=testsecret \
# MINIO_ACCESS_KEY=budibase \
# MINIO_SECRET_KEY=budibase \
# install base dependencies
RUN apt-get update && \
apt-get install -y software-properties-common wget nginx && \
apt-get install -y software-properties-common wget nginx uuid-runtime && \
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
apt-get update
@ -66,8 +71,8 @@ RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh &
npm install --global yarn pm2
# setup nginx
ADD hosting/single/nginx.conf /etc/nginx
ADD hosting/single/nginx-default-site.conf /etc/nginx/sites-enabled/default
ADD hosting/single/nginx/nginx.conf /etc/nginx
ADD hosting/single/nginx/nginx-default-site.conf /etc/nginx/sites-enabled/default
RUN mkdir -p /var/log/nginx && \
touch /var/log/nginx/error.log && \
touch /var/run/nginx.pid
@ -86,13 +91,13 @@ RUN wget https://github.com/cloudant-labs/clouseau/releases/download/2.21.0/clou
WORKDIR /opt/clouseau
RUN mkdir ./bin
ADD hosting/single/clouseau ./bin/
ADD hosting/single/log4j.properties hosting/single/clouseau.ini ./
ADD hosting/single/clouseau/clouseau ./bin/
ADD hosting/single/clouseau/log4j.properties hosting/single/clouseau/clouseau.ini ./
RUN chmod +x ./bin/clouseau
# setup CouchDB
WORKDIR /opt/couchdb
ADD hosting/single/vm.args ./etc/
ADD hosting/single/couch/vm.args hosting/single/couch/local.ini ./etc/
# setup minio
WORKDIR /minio

View File

@ -7,7 +7,7 @@ name=clouseau@127.0.0.1
cookie=monster
; the path where you would like to store the search index files
dir=/opt/couchdb/data/search
dir=/data/search
; the number of search indexes that can be open simultaneously
max_indexes_open=500

View File

@ -0,0 +1,5 @@
; CouchDB Configuration Settings
[couchdb]
database_dir = /data/couch/dbs
view_index_dir = /data/couch/views

View File

@ -88,7 +88,4 @@ server {
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
}

View File

@ -1,6 +1,34 @@
#!/bin/bash
declare -a ENV_VARS=("COUCHDB_USER" "COUCHDB_PASSWORD" "MINIO_ACCESS_KEY" "MINIO_SECRET_KEY" "INTERNAL_API_KEY" "JWT_SECRET" "REDIS_PASSWORD")
if [ -f "/data/.env" ]; then
export $(cat /data/.env | xargs)
fi
# first randomise any unset environment variables
for ENV_VAR in "${ENV_VARS[@]}"
do
temp=$(eval "echo \$$ENV_VAR")
if [[ -z "${temp}" ]]; then
eval "export $ENV_VAR=$(uuidgen | sed -e 's/-//g')"
fi
done
if [[ -z "${COUCH_DB_URL}" ]]; then
export COUCH_DB_URL=http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984
fi
if [ ! -f "/data/.env" ]; then
touch /data/.env
for ENV_VAR in "${ENV_VARS[@]}"
do
temp=$(eval "echo \$$ENV_VAR")
echo "$ENV_VAR=$temp" >> /data/.env
done
fi
# make these directories in runner, incase of mount
mkdir -p /data/couch/dbs /data/couch/views
chown couchdb:couchdb /data/couch /data/couch/dbs /data/couch/views
redis-server --requirepass $REDIS_PASSWORD &
/opt/clouseau/bin/clouseau &
/minio/minio server /minio &
/minio/minio server /data/minio &
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
/etc/init.d/nginx restart
if [[ ! -z "${CUSTOM_DOMAIN}" ]]; then

View File

@ -1,4 +1,4 @@
#!/bin/bash
id=$(docker run -t -d -p 80:80 budibase:latest)
id=$(docker run -t -d -p 8080:80 budibase:latest)
docker exec -it $id bash
docker kill $id

View File

@ -1,5 +1,5 @@
{
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll"
},
"dependencies": {
"@budibase/types": "^1.0.220-alpha.0",
"@budibase/types": "^1.0.220-alpha.2",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",
"bcrypt": "5.0.1",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "^1.0.220-alpha.0",
"@budibase/string-templates": "^1.0.220-alpha.2",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -69,10 +69,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^1.0.220-alpha.0",
"@budibase/client": "^1.0.220-alpha.0",
"@budibase/frontend-core": "^1.0.220-alpha.0",
"@budibase/string-templates": "^1.0.220-alpha.0",
"@budibase/bbui": "^1.0.220-alpha.2",
"@budibase/client": "^1.0.220-alpha.2",
"@budibase/frontend-core": "^1.0.220-alpha.2",
"@budibase/string-templates": "^1.0.220-alpha.2",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -1,33 +0,0 @@
<script>
import { Modal, ModalContent, Button } from "@budibase/bbui"
import { admin } from "stores/portal"
let upgradeModal
const onConfirm = () => {
window.open(`${$admin.accountPortalUrl}/portal/install`, "_blank")
}
</script>
<div>
<Button
on:click={upgradeModal.show}
quiet
primary
size="M"
icon="DownloadFromCloud">Self-host Budibase</Button
>
</div>
<Modal bind:this={upgradeModal}>
<ModalContent
size="M"
{onConfirm}
title="Self-host Budibase"
confirmText="Self-host Budibase"
>
<span>
Self-host budibase for free to get unlimited apps and more - and it only
takes a few minutes!
</span>
</ModalContent>
</Modal>

View File

@ -1,14 +1,7 @@
<script>
import { store, automationStore } from "builderStore"
import { roles, flags } from "stores/backend"
import {
Icon,
Tabs,
Tab,
Heading,
notifications,
// Banner,
} from "@budibase/bbui"
import { Icon, Tabs, Tab, Heading, notifications } from "@budibase/bbui"
import RevertModal from "components/deploy/RevertModal.svelte"
import DeployNavigation from "components/deploy/DeployNavigation.svelte"
import { API } from "api"
@ -91,15 +84,6 @@
<div class="loading" />
{:then _}
<div class="root">
<!-- {#if betaAccess}
<Banner
extraButtonText="Try New UI (Beta)"
extraButtonAction={newDesignUi}
>
Try the <b>all new</b> budibase design interface. (Not recommended for existing
budibase apps)
</Banner>
{/if} -->
<div class="top-nav">
<div class="topleftnav">
<Icon

View File

@ -18,8 +18,6 @@
let versionModal
let updatingModal
let selfHostPath =
"https://docs.budibase.com/docs/hosting-methods#self-host-budibase"
$: updateAvailable = clientPackage.version !== $store.version
$: appUrl = `${window.origin}/app${app?.url}`
@ -86,24 +84,6 @@
</Body>
</Layout>
</span>
<span class="selfhost-section">
<Layout gap="XS" paddingY="XXL" paddingX="">
<Heading size="S">Self-host Budibase</Heading>
<Divider />
<Body>
Self-host Budibase for free to get unlimited apps and more - and it
only takes a few minutes!
<div class="page-action">
<Button
secondary
on:click={() => {
window.open(selfHostPath, "_blank")
}}>Self-host Budibase</Button
>
</div>
</Body>
</Layout>
</span>
</Layout>
<VersionModal bind:this={versionModal} hideIcon={true} />
<Modal bind:this={updatingModal} padding={false} width="600px">

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "^1.0.220-alpha.0",
"@budibase/frontend-core": "^1.0.220-alpha.0",
"@budibase/string-templates": "^1.0.220-alpha.0",
"@budibase/bbui": "^1.0.220-alpha.2",
"@budibase/frontend-core": "^1.0.220-alpha.2",
"@budibase/string-templates": "^1.0.220-alpha.2",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "^1.0.220-alpha.0",
"@budibase/bbui": "^1.0.220-alpha.2",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

1
packages/server/.yarnrc Normal file
View File

@ -0,0 +1 @@
network-timeout 100000

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -77,10 +77,10 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "^1.0.220-alpha.0",
"@budibase/client": "^1.0.220-alpha.0",
"@budibase/pro": "1.0.220-alpha.0",
"@budibase/string-templates": "^1.0.220-alpha.0",
"@budibase/backend-core": "^1.0.220-alpha.2",
"@budibase/client": "^1.0.220-alpha.2",
"@budibase/pro": "1.0.220-alpha.2",
"@budibase/string-templates": "^1.0.220-alpha.2",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",
@ -151,7 +151,7 @@
"@babel/core": "7.17.4",
"@babel/preset-env": "7.16.11",
"@budibase/standard-components": "^0.9.139",
"@budibase/types": "^1.0.220-alpha.0",
"@budibase/types": "^1.0.220-alpha.2",
"@jest/test-sequencer": "24.9.0",
"@types/apidoc": "0.50.0",
"@types/bson": "4.2.0",

View File

@ -229,11 +229,7 @@ export const fetchAppPackage = async (ctx: any) => {
application,
screens,
layouts,
clientLibPath: clientLibraryPath(
ctx.params.appId,
application.version,
ctx
),
clientLibPath: clientLibraryPath(ctx.params.appId, application.version),
}
}

View File

@ -3,12 +3,8 @@ const env = require("../../environment")
const { checkSlashesInUrl } = require("../../utilities")
const { request } = require("../../utilities/workerRequests")
const { clearLock } = require("../../utilities/redis")
const {
Replication,
getProdAppID,
dangerousGetDB,
} = require("@budibase/backend-core/db")
const { DocumentTypes, getRowParams } = require("../../db/utils")
const { Replication, getProdAppID } = require("@budibase/backend-core/db")
const { DocumentTypes } = require("../../db/utils")
const { app: appCache } = require("@budibase/backend-core/cache")
const { getProdAppDB, getAppDB } = require("@budibase/backend-core/context")
const { events } = require("@budibase/backend-core")
@ -137,50 +133,3 @@ exports.getBudibaseVersion = async ctx => {
}
await events.installation.versionChecked(version)
}
// TODO: remove as part of beta program
exports.checkBetaAccess = async ctx => {
// go to the cloud platform if running self hosted
if (env.SELF_HOSTED || !env.MULTI_TENANCY) {
let baseUrl = ""
if (env.ACCOUNT_PORTAL_URL) {
baseUrl = env.ACCOUNT_PORTAL_URL.replace("account.", "")
} else {
baseUrl = "https://budibase.app"
}
const response = await fetch(
`${baseUrl}/api/beta/access?email=${ctx.query.email}`
)
const json = await response.json()
ctx.body = json
return
}
const userToCheck = ctx.query.email
const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364"
const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15"
try {
const db = dangerousGetDB(BETA_USERS_DB)
const betaUsers = (
await db.allDocs(
getRowParams(BETA_USERS_TABLE, null, {
include_docs: true,
})
)
).rows.map(row => row.doc)
let access = false
for (let betaUser of betaUsers) {
if (betaUser["Email address"].trim() === userToCheck) {
access = true
break
}
}
ctx.body = { access }
} catch (err) {
console.error(err)
ctx.body = { access: false }
}
}

View File

@ -73,12 +73,7 @@ exports.toggleBetaUiFeature = async function (ctx) {
}
exports.serveBuilder = async function (ctx) {
// Temporary: New Design UI
const designUiCookie = ctx.cookies.get("beta:design_ui")
// TODO: get this from the tmp Dir that we downloaded from MinIO
const uiPath = designUiCookie ? "new_design_ui" : "builder"
let builderPath = resolve(TOP_LEVEL_PATH, uiPath)
const builderPath = resolve(TOP_LEVEL_PATH, "builder")
await send(ctx, ctx.file, { root: builderPath })
if (!ctx.file.includes("assets/")) {
await events.serve.servedBuilder()

View File

@ -22,6 +22,5 @@ router
.get("/api/dev/version", authorized(BUILDER), controller.getBudibaseVersion)
.delete("/api/dev/:appId/lock", authorized(BUILDER), controller.clearLock)
.post("/api/dev/:appId/revert", authorized(BUILDER), controller.revert)
.get("/api/beta/access", controller.checkBetaAccess)
module.exports = router

View File

@ -54,13 +54,8 @@ exports.objectStoreUrl = () => {
* @return {string} The URL to be inserted into appPackage response or server rendered
* app index file.
*/
exports.clientLibraryPath = (appId, version, ctx) => {
exports.clientLibraryPath = (appId, version) => {
if (env.isProd()) {
// TODO: remove - for beta testing UI
if (ctx && ctx.cookies.get("beta:design_ui")) {
return "https://cdn.budi.live/beta:design_ui/budibase-client.js"
}
let url = `${exports.objectStoreUrl()}/${sanitizeKey(
appId
)}/budibase-client.js`

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

1
packages/worker/.yarnrc Normal file
View File

@ -0,0 +1 @@
network-timeout 100000

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "1.0.220-alpha.0",
"version": "1.0.220-alpha.2",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -34,9 +34,9 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "^1.0.220-alpha.0",
"@budibase/pro": "1.0.220-alpha.0",
"@budibase/string-templates": "^1.0.220-alpha.0",
"@budibase/backend-core": "^1.0.220-alpha.2",
"@budibase/pro": "1.0.220-alpha.2",
"@budibase/string-templates": "^1.0.220-alpha.2",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",
@ -66,7 +66,7 @@
"server-destroy": "1.0.1"
},
"devDependencies": {
"@budibase/types": "^1.0.220-alpha.0",
"@budibase/types": "^1.0.220-alpha.2",
"@types/jest": "26.0.23",
"@types/koa": "2.13.4",
"@types/koa-router": "7.4.4",

View File

@ -60,11 +60,13 @@ export const adminUser = async (ctx: any) => {
tenantId,
}
try {
// always bust checklist beforehand, if an error occurs but can proceed, don't get
// stuck in a cycle
await cache.bustCache(cache.CacheKeys.CHECKLIST)
const finalUser = await users.save(user, {
hashPassword,
requirePassword,
})
await cache.bustCache(cache.CacheKeys.CHECKLIST)
// events
let account: CloudAccount | undefined