feat: host publicly
This commit is contained in:
parent
29f29358fd
commit
3e1afb82c8
1 changed files with 22 additions and 9 deletions
31
run-dev.sh
31
run-dev.sh
|
|
@ -35,6 +35,7 @@ Options:
|
||||||
-k, --kill Kill existing instance and exit
|
-k, --kill Kill existing instance and exit
|
||||||
-s, --status Check if an instance is running
|
-s, --status Check if an instance is running
|
||||||
-r, --release Build and run in release mode
|
-r, --release Build and run in release mode
|
||||||
|
--public Bind to 0.0.0.0 instead of 127.0.0.1
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
$0 # Build and run both
|
$0 # Build and run both
|
||||||
|
|
@ -70,17 +71,19 @@ print_server_info() {
|
||||||
local mode="$1"
|
local mode="$1"
|
||||||
local build_type="Debug"
|
local build_type="Debug"
|
||||||
[ "$RELEASE" = "true" ] && build_type="Release"
|
[ "$RELEASE" = "true" ] && build_type="Release"
|
||||||
|
local bind_addr="127.0.0.1"
|
||||||
|
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
|
||||||
echo ""
|
echo ""
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo " Chattyness Development ($mode - $build_type)"
|
echo " Chattyness Development ($mode - $build_type)"
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo ""
|
echo ""
|
||||||
if run_owner; then
|
if run_owner; then
|
||||||
echo " Owner Admin: http://127.0.0.1:$OWNER_PORT"
|
echo " Owner Admin: http://$bind_addr:$OWNER_PORT"
|
||||||
fi
|
fi
|
||||||
if run_app; then
|
if run_app; then
|
||||||
echo " User App: http://127.0.0.1:$APP_PORT"
|
echo " User App: http://$bind_addr:$APP_PORT"
|
||||||
echo " Realm Admin: http://127.0.0.1:$APP_PORT/admin"
|
echo " Realm Admin: http://$bind_addr:$APP_PORT/admin"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
if [ "$TARGET" = "both" ]; then
|
if [ "$TARGET" = "both" ]; then
|
||||||
|
|
@ -225,6 +228,9 @@ do_watch() {
|
||||||
local release_flag=""
|
local release_flag=""
|
||||||
[ "$RELEASE" = "true" ] && release_flag="--release"
|
[ "$RELEASE" = "true" ] && release_flag="--release"
|
||||||
|
|
||||||
|
local bind_addr="127.0.0.1"
|
||||||
|
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
|
||||||
|
|
||||||
# Build owner first to create CSS (needed if user app needs admin CSS)
|
# Build owner first to create CSS (needed if user app needs admin CSS)
|
||||||
if run_owner; then
|
if run_owner; then
|
||||||
echo "Building owner app first (for admin CSS)..."
|
echo "Building owner app first (for admin CSS)..."
|
||||||
|
|
@ -234,12 +240,12 @@ do_watch() {
|
||||||
|
|
||||||
# Start watch processes
|
# Start watch processes
|
||||||
if run_owner; then
|
if run_owner; then
|
||||||
cargo leptos watch -p chattyness-owner $release_flag &
|
HOST="$bind_addr" cargo leptos watch -p chattyness-owner $release_flag &
|
||||||
OWNER_PID=$!
|
OWNER_PID=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if run_app; then
|
if run_app; then
|
||||||
cargo leptos watch -p chattyness-app --split $release_flag &
|
HOST="$bind_addr" cargo leptos watch -p chattyness-app --split $release_flag &
|
||||||
APP_PID=$!
|
APP_PID=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -279,15 +285,18 @@ do_build() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start servers
|
# Start servers
|
||||||
|
local bind_addr="127.0.0.1"
|
||||||
|
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
|
||||||
|
|
||||||
if run_owner; then
|
if run_owner; then
|
||||||
echo "Starting Owner Server on :$OWNER_PORT..."
|
echo "Starting Owner Server on $bind_addr:$OWNER_PORT..."
|
||||||
./target/$target_dir/chattyness-owner &
|
HOST="$bind_addr" ./target/$target_dir/chattyness-owner &
|
||||||
OWNER_PID=$!
|
OWNER_PID=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if run_app; then
|
if run_app; then
|
||||||
echo "Starting App Server on :$APP_PORT..."
|
echo "Starting App Server on $bind_addr:$APP_PORT..."
|
||||||
./target/$target_dir/chattyness-app &
|
HOST="$bind_addr" ./target/$target_dir/chattyness-app &
|
||||||
APP_PID=$!
|
APP_PID=$!
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -306,6 +315,7 @@ FORCE="false"
|
||||||
KILL_EXISTING="false"
|
KILL_EXISTING="false"
|
||||||
CHECK_STATUS="false"
|
CHECK_STATUS="false"
|
||||||
RELEASE="false"
|
RELEASE="false"
|
||||||
|
PUBLIC="false"
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case $arg in
|
case $arg in
|
||||||
|
|
@ -333,6 +343,9 @@ for arg in "$@"; do
|
||||||
-r | --release)
|
-r | --release)
|
||||||
RELEASE="true"
|
RELEASE="true"
|
||||||
;;
|
;;
|
||||||
|
--public)
|
||||||
|
PUBLIC="true"
|
||||||
|
;;
|
||||||
--help | -h)
|
--help | -h)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue