Attempting to use HBS to re-create the envoy file as needed in dev.
This commit is contained in:
parent
0d0c2cde32
commit
6c790206a8
|
@ -63,6 +63,7 @@ typings/
|
|||
# dotenv environment variables file
|
||||
.env
|
||||
!hosting/.env
|
||||
hosting/generated-envoy.dev.yaml
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
|
|
@ -27,7 +27,7 @@ services:
|
|||
restart: always
|
||||
image: envoyproxy/envoy:v1.16-latest
|
||||
volumes:
|
||||
- ./envoy.dev.yaml:/etc/envoy/envoy.yaml
|
||||
- ./generated-envoy.dev.yaml:/etc/envoy/envoy.yaml
|
||||
ports:
|
||||
- "${MAIN_PORT}:10000"
|
||||
depends_on:
|
||||
|
|
|
@ -106,7 +106,7 @@ static_resources:
|
|||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: 172.17.0.1
|
||||
address: {{ address }}
|
||||
port_value: 4001
|
||||
|
||||
- name: builder-dev
|
||||
|
@ -120,6 +120,6 @@ static_resources:
|
|||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: 172.17.0.1
|
||||
address: {{ address }}
|
||||
port_value: 3000
|
||||
|
|
@ -23,7 +23,9 @@
|
|||
"publishdev": "lerna run publishdev",
|
||||
"publishnpm": "yarn build && lerna publish --force-publish",
|
||||
"restore": "npm run clean && npm run bootstrap && npm run build",
|
||||
"nuke": "rimraf ~/.budibase && npm run restore && lerna run --parallel dev:stack:nuke",
|
||||
"nuke": "npm run nuke:packages && npm run nuke:docker",
|
||||
"nuke:packages": "npm run restore",
|
||||
"nuke:docker": "lerna run --parallel dev:stack:nuke",
|
||||
"clean": "lerna clean",
|
||||
"kill-port": "kill-port 4001",
|
||||
"dev": "yarn run kill-port && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
const compose = require("docker-compose")
|
||||
const path = require("path")
|
||||
const fs = require("fs")
|
||||
const { processStringSync } = require("@budibase/string-templates")
|
||||
|
||||
function isLinux() {
|
||||
return process.platform !== "darwin" && process.platform !== "win32"
|
||||
}
|
||||
|
||||
// This script wraps docker-compose allowing you to manage your dev infrastructure with simple commands.
|
||||
const CONFIG = {
|
||||
|
@ -17,6 +22,16 @@ const Commands = {
|
|||
}
|
||||
|
||||
async function init() {
|
||||
// generate envoy file, always do this incase it has changed
|
||||
const hostingPath = path.join(process.cwd(), "..", "..", "hosting")
|
||||
const envoyHbsPath = path.join(hostingPath, "envoy.dev.yaml.hbs")
|
||||
const envoyOutputPath = path.join(hostingPath, "generated-envoy.dev.yaml")
|
||||
const contents = fs.readFileSync(envoyHbsPath, "utf8")
|
||||
const config = {
|
||||
address: isLinux() ? "172.17.0.1" : "host.docker.internal",
|
||||
}
|
||||
fs.writeFileSync(envoyOutputPath, processStringSync(contents, config))
|
||||
|
||||
const envFilePath = path.join(process.cwd(), ".env")
|
||||
if (fs.existsSync(envFilePath)) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue