Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
01ca850
client sdk local emulator
BilalG1 Mar 13, 2026
f8fcf9d
Squashed commit of the following:
mantrakp04 Mar 18, 2026
0010642
Refactor QEMU emulator setup and consolidate cloud-init configurations
mantrakp04 Mar 18, 2026
c2e4698
Refactor local emulator configuration management and remove obsolete …
mantrakp04 Mar 18, 2026
4508f24
Enhance Dockerfile for local emulator and server setup
mantrakp04 Mar 19, 2026
dec62a0
Refactor QEMU emulator build and snapshot handling
mantrakp04 Mar 19, 2026
580ff10
Refactor local emulator setup and consolidate services
mantrakp04 Mar 19, 2026
e3592bb
Add base image fingerprinting for QEMU snapshots
mantrakp04 Mar 19, 2026
5a729ec
Enhance configuration and permissions in local emulator setup
mantrakp04 Mar 19, 2026
c1a15ff
Enhance local emulator configuration and file management
mantrakp04 Mar 19, 2026
0496cd2
Add QEMU emulator build workflow and emulator command integration
mantrakp04 Mar 19, 2026
4a43a88
Update emulator configuration and enhance CLI functionality
mantrakp04 Mar 19, 2026
fe16a71
Merge branch 'dev' into emu-with-a-q
mantrakp04 Mar 19, 2026
5d98b44
Remove deprecated configuration files and streamline emulator CLI com…
mantrakp04 Mar 19, 2026
3321e5c
Update QEMU emulator scripts to improve KVM detection and service sta…
mantrakp04 Mar 19, 2026
8336d48
Refactor local emulator type handling and architecture detection
mantrakp04 Mar 19, 2026
298062a
Enhance local emulator configuration handling and file management
mantrakp04 Mar 19, 2026
25f8b1c
Gate server and admin emulator requests on credential init
BilalG1 Mar 19, 2026
578593a
Enhance QEMU emulator build workflow and local emulator configuration
mantrakp04 Mar 19, 2026
80ee1ab
Merge branch 'dev' into emu-with-a-q
mantrakp04 Mar 19, 2026
42bc125
Enhance setBranchConfigOverride for local emulator file handling
mantrakp04 Mar 19, 2026
4be8a82
Update QEMU emulator build workflow for improved performance and reli…
mantrakp04 Mar 19, 2026
f3514f8
Refactor QEMU emulator build and local emulator configuration
mantrakp04 Mar 20, 2026
d5d2a09
Increase EMULATOR_READY_TIMEOUT in QEMU emulator build workflow
mantrakp04 Mar 20, 2026
e509947
Enhance local emulator setup with environment generation and configur…
mantrakp04 Mar 20, 2026
ad2db19
Refactor local emulator configuration validation and enhance CLI tests
mantrakp04 Mar 20, 2026
a233e64
Update local emulator environment handling and documentation
mantrakp04 Mar 20, 2026
14f8164
Enhance local emulator project handling and configuration validation
mantrakp04 Mar 23, 2026
9d0f7c1
Refactor local emulator scripts and configuration management
mantrakp04 Mar 23, 2026
77d87fd
Refactor local emulator setup and enhance GitHub Actions workflow
mantrakp04 Mar 23, 2026
bef4aab
Enhance QEMU emulator build workflow and add documentation
mantrakp04 Mar 24, 2026
6d9d4e7
Merge branch 'dev' into emu-with-a-q
mantrakp04 Mar 24, 2026
771ed15
Update CLI tests for emulator commands
mantrakp04 Mar 24, 2026
bc1f951
local emulator allow localhost callback, add ssh debugging, fix file …
BilalG1 Mar 24, 2026
815320a
Merge branch 'client-sdk-local-emulator-support' into emulator-perms-…
BilalG1 Mar 24, 2026
7345567
emulator and client sdk changes
BilalG1 Mar 25, 2026
0907f50
fix emulator race conditions, update ports to 167xx, improve onboardi…
BilalG1 Mar 26, 2026
3cd32cc
Merge remote-tracking branch 'origin/emu-with-a-q' into emulator-perm…
BilalG1 Mar 26, 2026
de0a5da
lint / typecheck fixes
BilalG1 Mar 27, 2026
00390be
fix tests
BilalG1 Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
local emulator allow localhost callback, add ssh debugging, fix file …
…perms
  • Loading branch information
BilalG1 committed Mar 24, 2026
commit bc1f95124bef9f28b0720fa88a36a9712f275dfe
5 changes: 3 additions & 2 deletions apps/backend/src/lib/redirect-urls.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StackAssertionError, captureError } from "@stackframe/stack-shared/dist/utils/errors";
import { createUrlIfValid, isLocalhost, matchHostnamePattern } from "@stackframe/stack-shared/dist/utils/urls";
import { isLocalEmulatorEnabled } from "./local-emulator";
import { Tenancy } from "./tenancies";

/**
Expand Down Expand Up @@ -85,8 +86,8 @@ export function validateRedirectUrl(
const url = createUrlIfValid(urlOrString);
if (!url) return false;

// Check localhost permission
if (tenancy.config.domains.allowLocalhost && isLocalhost(url)) {
// Check localhost permission — always allow in local emulator mode
if ((tenancy.config.domains.allowLocalhost || isLocalEmulatorEnabled()) && isLocalhost(url)) {
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions docker/local-emulator/qemu/cloud-init/emulator/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ chpasswd:
stack:stack-emulator
expire: false

ssh_pwauth: false
ssh_pwauth: true

package_update: true
package_upgrade: false
Expand Down Expand Up @@ -163,8 +163,8 @@ write_files:
WantedBy=multi-user.target

runcmd:
- systemctl disable --now ssh || true
- systemctl mask ssh || true
- systemctl unmask ssh || true
- systemctl enable --now ssh || true
- bash /usr/local/bin/install-emulator-containers
- systemctl daemon-reload
- systemctl enable stack.service
Expand Down
3 changes: 3 additions & 0 deletions docker/local-emulator/qemu/run-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ build_qemu_cmd() {
netdev+=",hostfwd=tcp::${PORT_PREFIX}25-:8080"
netdev+=",hostfwd=tcp::${PORT_PREFIX}36-:8123"
netdev+=",hostfwd=tcp::${PORT_PREFIX}37-:9009"
# SSH
netdev+=",hostfwd=tcp::${PORT_PREFIX}22-:22"
# App services
netdev+=",hostfwd=tcp::${PORT_PREFIX}01-:${PORT_PREFIX}01"
netdev+=",hostfwd=tcp::${PORT_PREFIX}02-:${PORT_PREFIX}02"
Expand Down Expand Up @@ -362,6 +364,7 @@ cmd_status() {
print_service_status "MinIO" "${PORT_PREFIX}21" http /minio/health/live
print_service_status "QStash" "${PORT_PREFIX}25" http / 401
print_service_status "ClickHouse" "${PORT_PREFIX}36" http /ping
print_service_status "SSH" "${PORT_PREFIX}22" tcp
exit "$STATUS_FAILED"
}

Expand Down
19 changes: 17 additions & 2 deletions docker/server/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,27 @@ done

# ============= START BACKEND AND DASHBOARD =============

# When running inside the QEMU emulator with a 9p host mount, the guest kernel
# checks file permissions using guest UIDs. Files on the host are owned by the
# host user (e.g. UID 501) so the app processes must run as that UID to be able
# to read/write config files on the host filesystem (including in sticky-bit
# directories like /tmp).
HOST_MOUNT_ROOT="${STACK_LOCAL_EMULATOR_HOST_MOUNT_ROOT:-}"
RUN_AS=""
if [ -n "$HOST_MOUNT_ROOT" ] && [ -d "$HOST_MOUNT_ROOT" ]; then
HOST_UID=$(stat -c %u "$HOST_MOUNT_ROOT/etc" 2>/dev/null || echo "")
if [ -n "$HOST_UID" ] && [ "$HOST_UID" != "0" ]; then
useradd -u "$HOST_UID" -M -s /bin/false -d "$WORK_DIR" hostuser 2>/dev/null || true
RUN_AS="gosu $HOST_UID"
fi
fi

echo "Starting backend on port $BACKEND_PORT..."
cd "$WORK_DIR"
PORT=$BACKEND_PORT HOSTNAME=0.0.0.0 node apps/backend/server.js &
$RUN_AS env PORT=$BACKEND_PORT HOSTNAME=0.0.0.0 node apps/backend/server.js &

echo "Starting dashboard on port $DASHBOARD_PORT..."
PORT=$DASHBOARD_PORT HOSTNAME=0.0.0.0 node apps/dashboard/server.js &
$RUN_AS env PORT=$DASHBOARD_PORT HOSTNAME=0.0.0.0 node apps/dashboard/server.js &

# Wait for both to finish
wait -n