Merge pull request #1465 from Budibase/bugs/dev-fixes
Updates to simplify getting going with Budibase single stack development
This commit is contained in:
commit
8f7b417738
|
@ -92,6 +92,16 @@ then `cd ` into your local copy.
|
|||
|
||||
### 3. Install and Build
|
||||
|
||||
To develop the Budibase platform you'll need [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed.
|
||||
|
||||
#### Quick method
|
||||
|
||||
`yarn setup` will check that all necessary components are installed and setup the repo for usage.
|
||||
|
||||
#### Manual method
|
||||
|
||||
The following commands can be executed to manually get Budibase up and running (assuming Docker/Docker Compose has been installed).
|
||||
|
||||
`yarn` to install project dependencies
|
||||
|
||||
`yarn bootstrap` will install all budibase modules and symlink them together using lerna.
|
||||
|
@ -112,10 +122,17 @@ To run the budibase server and builder in dev mode (i.e. with live reloading):
|
|||
|
||||
1. Open a new console
|
||||
2. `yarn dev` (from root)
|
||||
3. Access the builder on http://localhost:4001/_builder/
|
||||
3. Access the builder on http://localhost:10000/builder
|
||||
|
||||
This will enable watch mode for both the builder app, server, client library and any component libraries.
|
||||
|
||||
### 5. Cleanup
|
||||
|
||||
If you wish to delete all the apps created in development and reset the environment then run the following:
|
||||
|
||||
1. `yarn nuke:docker` will wipe all the Budibase services
|
||||
2. `yarn dev` will restart all the services
|
||||
|
||||
## Data Storage
|
||||
|
||||
When you are running locally, budibase stores data on disk using [PouchDB](https://pouchdb.com/), as well as some JSON on local files. After setting up budibase, you can find all of this data in the `~/.budibase` directory.
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const os = require("os")
|
||||
const exec = require("child_process").exec
|
||||
const fs = require("fs")
|
||||
const platform = os.platform()
|
||||
|
||||
const windows = platform === "win32"
|
||||
const mac = platform === "darwin"
|
||||
const linux = platform === "linux"
|
||||
|
||||
function execute(command) {
|
||||
return new Promise(resolve => {
|
||||
exec(command, (err, stdout) => resolve(linux ? !!stdout : true))
|
||||
})
|
||||
}
|
||||
|
||||
async function commandExistsUnix(command) {
|
||||
const unixCmd = `command -v ${command} 2>/dev/null && { echo >&1 ${command}; exit 0; }`
|
||||
return execute(command)
|
||||
}
|
||||
|
||||
async function commandExistsWindows(command) {
|
||||
if (/[\x00-\x1f<>:"|?*]/.test(command)) {
|
||||
return false
|
||||
}
|
||||
return execute(`where ${command}`)
|
||||
}
|
||||
|
||||
function commandExists(command) {
|
||||
return windows ? commandExistsWindows(command) : commandExistsUnix(command)
|
||||
}
|
||||
|
||||
async function init() {
|
||||
const docker = commandExists("docker")
|
||||
const dockerCompose = commandExists("docker-compose")
|
||||
if (docker && dockerCompose) {
|
||||
console.log("Docker installed - continuing.")
|
||||
return
|
||||
}
|
||||
if (mac) {
|
||||
console.log(
|
||||
"Please install docker by visiting: https://docs.docker.com/docker-for-mac/install/"
|
||||
)
|
||||
} else if (windows) {
|
||||
console.log(
|
||||
"Please install docker by visiting: https://docs.docker.com/docker-for-windows/install/"
|
||||
)
|
||||
} else if (linux) {
|
||||
console.log("Beginning automated linux installation.")
|
||||
await execute(`./hosting/scripts/linux/get-docker.sh`)
|
||||
await execute(`./hosting/scripts/linux/get-docker-compose.sh`)
|
||||
} else {
|
||||
console.error(
|
||||
"Platform unknown - please look online for information about installing docker for our OS."
|
||||
)
|
||||
}
|
||||
console.log("Once installation complete please re-run the setup script.")
|
||||
process.exit(-1)
|
||||
}
|
||||
init()
|
|
@ -17,6 +17,7 @@
|
|||
"svelte": "^3.37.0"
|
||||
},
|
||||
"scripts": {
|
||||
"setup": "./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
|
||||
"bootstrap": "lerna link && lerna bootstrap",
|
||||
"build": "lerna run build",
|
||||
"initialise": "lerna run initialise",
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
<script>
|
||||
import { isActive, url, goto } from "@roxi/routify"
|
||||
import { onMount } from "svelte"
|
||||
import {
|
||||
ActionMenu,
|
||||
Checkbox,
|
||||
Body,
|
||||
MenuItem,
|
||||
Icon,
|
||||
Heading,
|
||||
Avatar,
|
||||
Search,
|
||||
Layout,
|
||||
ProgressCircle,
|
||||
SideNavigation as Navigation,
|
||||
SideNavigationItem as Item,
|
||||
} from "@budibase/bbui"
|
||||
import api from "builderStore/api"
|
||||
import { organisation, admin } from "stores/portal"
|
||||
import { admin } from "stores/portal"
|
||||
|
||||
const MESSAGES = {
|
||||
apps: "Create your first app",
|
||||
|
|
|
@ -67,4 +67,7 @@ for (let route of mainRoutes) {
|
|||
router.use(staticRoutes.routes())
|
||||
router.use(staticRoutes.allowedMethods())
|
||||
|
||||
// add a redirect for when hitting server directly
|
||||
router.redirect("/", "/builder")
|
||||
|
||||
module.exports = router
|
||||
|
|
|
@ -19,12 +19,14 @@ function request(ctx, request) {
|
|||
if (!request.headers) {
|
||||
request.headers = {}
|
||||
}
|
||||
if (request.body) {
|
||||
if (request.body && Object.keys(request.body).length > 0) {
|
||||
request.headers["Content-Type"] = "application/json"
|
||||
request.body =
|
||||
typeof request.body === "object"
|
||||
? JSON.stringify(request.body)
|
||||
: request.body
|
||||
} else {
|
||||
delete request.body
|
||||
}
|
||||
if (ctx.headers) {
|
||||
request.headers.cookie = ctx.headers.cookie
|
||||
|
|
Loading…
Reference in New Issue