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
|
# dotenv environment variables file
|
||||||
.env
|
.env
|
||||||
!hosting/.env
|
!hosting/.env
|
||||||
|
hosting/generated-envoy.dev.yaml
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
.cache
|
.cache
|
||||||
|
|
|
@ -27,7 +27,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
image: envoyproxy/envoy:v1.16-latest
|
image: envoyproxy/envoy:v1.16-latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./envoy.dev.yaml:/etc/envoy/envoy.yaml
|
- ./generated-envoy.dev.yaml:/etc/envoy/envoy.yaml
|
||||||
ports:
|
ports:
|
||||||
- "${MAIN_PORT}:10000"
|
- "${MAIN_PORT}:10000"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
@ -106,7 +106,7 @@ static_resources:
|
||||||
- endpoint:
|
- endpoint:
|
||||||
address:
|
address:
|
||||||
socket_address:
|
socket_address:
|
||||||
address: 172.17.0.1
|
address: {{ address }}
|
||||||
port_value: 4001
|
port_value: 4001
|
||||||
|
|
||||||
- name: builder-dev
|
- name: builder-dev
|
||||||
|
@ -120,6 +120,6 @@ static_resources:
|
||||||
- endpoint:
|
- endpoint:
|
||||||
address:
|
address:
|
||||||
socket_address:
|
socket_address:
|
||||||
address: 172.17.0.1
|
address: {{ address }}
|
||||||
port_value: 3000
|
port_value: 3000
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
"publishdev": "lerna run publishdev",
|
"publishdev": "lerna run publishdev",
|
||||||
"publishnpm": "yarn build && lerna publish --force-publish",
|
"publishnpm": "yarn build && lerna publish --force-publish",
|
||||||
"restore": "npm run clean && npm run bootstrap && npm run build",
|
"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",
|
"clean": "lerna clean",
|
||||||
"kill-port": "kill-port 4001",
|
"kill-port": "kill-port 4001",
|
||||||
"dev": "yarn run kill-port && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
"dev": "yarn run kill-port && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
const compose = require("docker-compose")
|
const compose = require("docker-compose")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
const fs = require("fs")
|
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.
|
// This script wraps docker-compose allowing you to manage your dev infrastructure with simple commands.
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
|
@ -17,6 +22,16 @@ const Commands = {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
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")
|
const envFilePath = path.join(process.cwd(), ".env")
|
||||||
if (fs.existsSync(envFilePath)) {
|
if (fs.existsSync(envFilePath)) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue