Add scripts for running Zed2 collab environment
./script/zed-local now looks for "--zed2" flag in its args and runs Zed2 binaries instead of zed1. 'foreman start' can be launched with '-f Procfile.zed2" argument to launch zed2 collab server.
This commit is contained in:
parent
f01a04a8e0
commit
0b67983ddf
2 changed files with 10 additions and 3 deletions
4
Procfile.zed2
Normal file
4
Procfile.zed2
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
web: cd ../zed.dev && PORT=3000 npm run dev
|
||||||
|
collab: cd crates/collab2 && RUST_LOG=${RUST_LOG:-warn,collab=info} cargo run serve
|
||||||
|
livekit: livekit-server --dev
|
||||||
|
postgrest: postgrest crates/collab2/admin_api.conf
|
|
@ -4,6 +4,7 @@ const {spawn, execFileSync} = require('child_process')
|
||||||
|
|
||||||
const RESOLUTION_REGEX = /(\d+) x (\d+)/
|
const RESOLUTION_REGEX = /(\d+) x (\d+)/
|
||||||
const DIGIT_FLAG_REGEX = /^--?(\d+)$/
|
const DIGIT_FLAG_REGEX = /^--?(\d+)$/
|
||||||
|
const ZED_2_MODE = "--zed2"
|
||||||
|
|
||||||
const args = process.argv.slice(2)
|
const args = process.argv.slice(2)
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ if (digitMatch) {
|
||||||
instanceCount = parseInt(digitMatch[1])
|
instanceCount = parseInt(digitMatch[1])
|
||||||
args.shift()
|
args.shift()
|
||||||
}
|
}
|
||||||
|
const isZed2 = args.some(arg => arg === ZED_2_MODE);
|
||||||
if (instanceCount > 4) {
|
if (instanceCount > 4) {
|
||||||
throw new Error('Cannot spawn more than 4 instances')
|
throw new Error('Cannot spawn more than 4 instances')
|
||||||
}
|
}
|
||||||
|
@ -70,11 +72,12 @@ const positions = [
|
||||||
`${instanceWidth},${instanceHeight}`
|
`${instanceWidth},${instanceHeight}`
|
||||||
]
|
]
|
||||||
|
|
||||||
execFileSync('cargo', ['build'], {stdio: 'inherit'})
|
const buildArgs = isZed2 ? ["build", "-p", "zed2"] : ["build"]
|
||||||
|
const zedBinary = isZed2 ? "target/debug/Zed2" : "target/debug/Zed"
|
||||||
|
execFileSync('cargo', buildArgs, { stdio: 'inherit' })
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
for (let i = 0; i < instanceCount; i++) {
|
for (let i = 0; i < instanceCount; i++) {
|
||||||
spawn('target/debug/Zed', i == 0 ? args : [], {
|
spawn(zedBinary, i == 0 ? args : [], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: {
|
env: {
|
||||||
ZED_IMPERSONATE: users[i],
|
ZED_IMPERSONATE: users[i],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue