diff --git a/apps/cyberstorm-remix/README.md b/apps/cyberstorm-remix/README.md index 746182020..4224ae26a 100644 --- a/apps/cyberstorm-remix/README.md +++ b/apps/cyberstorm-remix/README.md @@ -30,8 +30,8 @@ The easiest way to run the full stack (Backend + Frontend) is using Docker. (If you have some pre-existing containers, please do `docker compose -f docker-compose.remix.development.yml down -v` and `docker compose -f docker-compose.remix.development.yml up -d --build`) 4. **Open Browser** - - **Frontend**: [http://new.localhost](http://new.localhost) - - **Backend**: [http://localhost](http://localhost) + - **Frontend**: [http://new.thunderstore.localhost](http://new.thunderstore.localhost) + - **Backend**: [http://thunderstore.localhost](http://thunderstore.localhost) ## Manual Setup diff --git a/apps/cyberstorm-remix/entrypoint.dev.sh b/apps/cyberstorm-remix/entrypoint.dev.sh index 8238c382f..626dee574 100644 --- a/apps/cyberstorm-remix/entrypoint.dev.sh +++ b/apps/cyberstorm-remix/entrypoint.dev.sh @@ -33,21 +33,21 @@ if [ -z "$(ls -A node_modules)" ] || [ ! -f node_modules/.bin/react-router ]; th su node -c "yarn install --frozen-lockfile --production=false" fi -# Map localhost to the backend nginx container IP so SSR API calls hit the backend -# without changing client-side env values. +# Map thunderstore.localhost to the backend nginx container IP so SSR API calls hit +# the backend without changing client-side env values. backend_nginx_ip=$(getent hosts nginx | awk '{print $1}') if [ -n "$backend_nginx_ip" ]; then - # Prepend to /etc/hosts to take precedence over the default loopback entry. + # Prepend to /etc/hosts so it takes precedence. # Make idempotent to avoid duplicate lines on restarts. - if ! grep -q "^${backend_nginx_ip}[[:space:]][[:space:]]*localhost\([[:space:]]\|$\)" /etc/hosts 2>/dev/null; then + if ! grep -q "^${backend_nginx_ip}[[:space:]][[:space:]]*thunderstore\.localhost\([[:space:]]\|$\)" /etc/hosts 2>/dev/null; then tmp_hosts=$(mktemp) { - printf "%s localhost\n" "$backend_nginx_ip" - # Drop existing localhost mappings so the new mapping is unambiguous. - # This keeps other host entries intact. - awk '!($0 ~ /(^|[[:space:]])localhost([[:space:]]|$)/)' /etc/hosts 2>/dev/null || true + printf "%s thunderstore.localhost\n" "$backend_nginx_ip" + # Drop existing thunderstore.localhost mappings so the new mapping is unambiguous. + # This keeps other host entries (including localhost) intact. + awk '!($0 ~ /(^|[[:space:]])thunderstore\.localhost([[:space:]]|$)/)' /etc/hosts 2>/dev/null || true } > "$tmp_hosts" - cat "$tmp_hosts" > /etc/hosts || printf "%s localhost\n" "$backend_nginx_ip" >> /etc/hosts + cat "$tmp_hosts" > /etc/hosts || printf "%s thunderstore.localhost\n" "$backend_nginx_ip" >> /etc/hosts rm -f "$tmp_hosts" fi fi diff --git a/docker-compose.remix.development.yml b/docker-compose.remix.development.yml index 1c793c0e1..e604acb39 100644 --- a/docker-compose.remix.development.yml +++ b/docker-compose.remix.development.yml @@ -6,7 +6,7 @@ x-rsync-common: &rsync-common - workspace_src:/workspace - thunderstore_nginx_conf:/etc/nginx/user-conf environment: - RSYNC_ARGS: "-a --delete --info=progress2 --exclude=.git --exclude=build-secrets --exclude=.npmrc --exclude=node_modules --exclude=.turbo --exclude=.cache --exclude=apps/cyberstorm-remix/build --exclude=apps/cyberstorm-remix/.react-router" + RSYNC_ARGS: "-a --delete --info=progress2 --exclude=.git --exclude=build-secrets --exclude=.npmrc --exclude=node_modules --exclude=.turbo --exclude=.cache --exclude=packages/*/dist --exclude=packages/*/dist/** --exclude=packages/*/types/dist --exclude=packages/*/types/dist/** --exclude=apps/cyberstorm-remix/build --exclude=apps/cyberstorm-remix/.react-router" SYNC_INTERVAL: "5" services: @@ -15,7 +15,7 @@ services: container_name: cyberstorm-remix-sync restart: "no" command: >- - /bin/sh -c "set -e; apk add --no-cache rsync; rsync $$RSYNC_ARGS /src/ /workspace/; tmp=/etc/nginx/user-conf/.new-localhost.conf.tmp; cp -f /src/tools/nginx/new-localhost.conf \"$$tmp\"; mv -f \"$$tmp\" /etc/nginx/user-conf/new-localhost.conf; echo sync complete" + /bin/sh -c "set -e; apk add --no-cache rsync; rsync $$RSYNC_ARGS /src/ /workspace/; tmp=/etc/nginx/user-conf/.new-thunderstore-localhost.conf.tmp; cp -f /src/tools/nginx/new-thunderstore-localhost.conf \"$$tmp\"; mv -f \"$$tmp\" /etc/nginx/user-conf/new-thunderstore-localhost.conf; echo sync complete" cyberstorm-remix-watch: <<: *rsync-common @@ -25,7 +25,7 @@ services: cyberstorm-remix-sync: condition: service_completed_successfully command: >- - /bin/sh -c "set -e; apk add --no-cache rsync; while true; do rsync $$RSYNC_ARGS /src/ /workspace/; tmp=/etc/nginx/user-conf/.new-localhost.conf.tmp; cp -f /src/tools/nginx/new-localhost.conf \"$$tmp\"; mv -f \"$$tmp\" /etc/nginx/user-conf/new-localhost.conf; sleep $$SYNC_INTERVAL; done" + /bin/sh -c "set -e; apk add --no-cache rsync; while true; do rsync $$RSYNC_ARGS /src/ /workspace/; tmp=/etc/nginx/user-conf/.new-thunderstore-localhost.conf.tmp; cp -f /src/tools/nginx/new-thunderstore-localhost.conf \"$$tmp\"; mv -f \"$$tmp\" /etc/nginx/user-conf/new-thunderstore-localhost.conf; sleep $$SYNC_INTERVAL; done" cyberstorm-remix: container_name: cyberstorm-remix @@ -51,13 +51,13 @@ services: - NPM_CONFIG_USERCONFIG=/run/secrets/npmrc - ENABLE_BROKEN_PAGES=True - VITE_DEVELOPMENT=True - - VITE_SITE_URL=http://localhost - - VITE_BETA_SITE_URL=http://new.localhost - - VITE_API_URL=http://localhost - - VITE_COOKIE_DOMAIN=.localhost - - VITE_AUTH_BASE_URL=http://localhost - - VITE_AUTH_RETURN_URL=http://new.localhost - - __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.localhost + - VITE_SITE_URL=http://thunderstore.localhost + - VITE_BETA_SITE_URL=http://new.thunderstore.localhost + - VITE_API_URL=http://thunderstore.localhost + - VITE_COOKIE_DOMAIN=.thunderstore.localhost + - VITE_AUTH_BASE_URL=http://thunderstore.localhost + - VITE_AUTH_RETURN_URL=http://new.thunderstore.localhost + - __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.thunderstore.localhost secrets: - npmrc diff --git a/tools/nginx/new-localhost.conf b/tools/nginx/new-thunderstore-localhost.conf similarity index 77% rename from tools/nginx/new-localhost.conf rename to tools/nginx/new-thunderstore-localhost.conf index e5ee93ea9..60c1e6463 100644 --- a/tools/nginx/new-localhost.conf +++ b/tools/nginx/new-thunderstore-localhost.conf @@ -5,13 +5,13 @@ map $http_upgrade $connection_upgrade { server { listen 80; - server_name new.localhost; + server_name new.thunderstore.localhost; # Resolve container DNS dynamically to avoid stale IPs. resolver 127.0.0.11 ipv6=off valid=30s; location / { - # Ensure requests to new.localhost are never served from the backend nginx proxy cache. + # Ensure requests to new.thunderstore.localhost are never served from the backend nginx proxy cache. proxy_cache off; proxy_cache_bypass 1; proxy_no_cache 1;