Skip to content

Commit 53a20d1

Browse files
committed
Update README and configuration for thunderstore.localhost integration
- Changed frontend and backend URLs in README to use thunderstore.localhost - Updated entrypoint script to map thunderstore.localhost to backend nginx IP - Modified docker-compose to sync new-thunderstore-localhost.conf - Added new-thunderstore-localhost.conf for Nginx configuration
1 parent a6eae79 commit 53a20d1

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

apps/cyberstorm-remix/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ The easiest way to run the full stack (Backend + Frontend) is using Docker.
3030
(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`)
3131

3232
4. **Open Browser**
33-
- **Frontend**: [http://new.localhost](http://new.localhost)
34-
- **Backend**: [http://localhost](http://localhost)
33+
- **Frontend**: [http://new.thunderstore.localhost](http://new.thunderstore.localhost)
34+
- **Backend**: [http://thunderstore.localhost](http://thunderstore.localhost)
3535

3636
## Manual Setup
3737

apps/cyberstorm-remix/entrypoint.dev.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ if [ -z "$(ls -A node_modules)" ] || [ ! -f node_modules/.bin/react-router ]; th
3333
su node -c "yarn install --frozen-lockfile --production=false"
3434
fi
3535

36-
# Map localhost to the backend nginx container IP so SSR API calls hit the backend
37-
# without changing client-side env values.
36+
# Map thunderstore.localhost to the backend nginx container IP so SSR API calls hit
37+
# the backend without changing client-side env values.
3838
backend_nginx_ip=$(getent hosts nginx | awk '{print $1}')
3939
if [ -n "$backend_nginx_ip" ]; then
40-
# Prepend to /etc/hosts to take precedence over the default loopback entry.
40+
# Prepend to /etc/hosts so it takes precedence.
4141
# Make idempotent to avoid duplicate lines on restarts.
42-
if ! grep -q "^${backend_nginx_ip}[[:space:]][[:space:]]*localhost\([[:space:]]\|$\)" /etc/hosts 2>/dev/null; then
42+
if ! grep -q "^${backend_nginx_ip}[[:space:]][[:space:]]*thunderstore\.localhost\([[:space:]]\|$\)" /etc/hosts 2>/dev/null; then
4343
tmp_hosts=$(mktemp)
4444
{
45-
printf "%s localhost\n" "$backend_nginx_ip"
46-
# Drop existing localhost mappings so the new mapping is unambiguous.
47-
# This keeps other host entries intact.
48-
awk '!($0 ~ /(^|[[:space:]])localhost([[:space:]]|$)/)' /etc/hosts 2>/dev/null || true
45+
printf "%s thunderstore.localhost\n" "$backend_nginx_ip"
46+
# Drop existing thunderstore.localhost mappings so the new mapping is unambiguous.
47+
# This keeps other host entries (including localhost) intact.
48+
awk '!($0 ~ /(^|[[:space:]])thunderstore\.localhost([[:space:]]|$)/)' /etc/hosts 2>/dev/null || true
4949
} > "$tmp_hosts"
50-
cat "$tmp_hosts" > /etc/hosts || printf "%s localhost\n" "$backend_nginx_ip" >> /etc/hosts
50+
cat "$tmp_hosts" > /etc/hosts || printf "%s thunderstore.localhost\n" "$backend_nginx_ip" >> /etc/hosts
5151
rm -f "$tmp_hosts"
5252
fi
5353
fi

docker-compose.remix.development.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ x-rsync-common: &rsync-common
66
- workspace_src:/workspace
77
- thunderstore_nginx_conf:/etc/nginx/user-conf
88
environment:
9-
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"
9+
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"
1010
SYNC_INTERVAL: "5"
1111

1212
services:
@@ -15,7 +15,7 @@ services:
1515
container_name: cyberstorm-remix-sync
1616
restart: "no"
1717
command: >-
18-
/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"
18+
/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"
1919
2020
cyberstorm-remix-watch:
2121
<<: *rsync-common
@@ -25,7 +25,7 @@ services:
2525
cyberstorm-remix-sync:
2626
condition: service_completed_successfully
2727
command: >-
28-
/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"
28+
/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"
2929
3030
cyberstorm-remix:
3131
container_name: cyberstorm-remix
@@ -51,13 +51,13 @@ services:
5151
- NPM_CONFIG_USERCONFIG=/run/secrets/npmrc
5252
- ENABLE_BROKEN_PAGES=True
5353
- VITE_DEVELOPMENT=True
54-
- VITE_SITE_URL=http://localhost
55-
- VITE_BETA_SITE_URL=http://new.localhost
56-
- VITE_API_URL=http://localhost
57-
- VITE_COOKIE_DOMAIN=.localhost
58-
- VITE_AUTH_BASE_URL=http://localhost
59-
- VITE_AUTH_RETURN_URL=http://new.localhost
60-
- __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.localhost
54+
- VITE_SITE_URL=http://thunderstore.localhost
55+
- VITE_BETA_SITE_URL=http://new.thunderstore.localhost
56+
- VITE_API_URL=http://thunderstore.localhost
57+
- VITE_COOKIE_DOMAIN=.thunderstore.localhost
58+
- VITE_AUTH_BASE_URL=http://thunderstore.localhost
59+
- VITE_AUTH_RETURN_URL=http://new.thunderstore.localhost
60+
- __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=.thunderstore.localhost
6161
secrets:
6262
- npmrc
6363

tools/nginx/new-localhost.conf renamed to tools/nginx/new-thunderstore-localhost.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ map $http_upgrade $connection_upgrade {
55

66
server {
77
listen 80;
8-
server_name new.localhost;
8+
server_name new.thunderstore.localhost;
99

1010
# Resolve container DNS dynamically to avoid stale IPs.
1111
resolver 127.0.0.11 ipv6=off valid=30s;
1212

1313
location / {
14-
# Ensure requests to new.localhost are never served from the backend nginx proxy cache.
14+
# Ensure requests to new.thunderstore.localhost are never served from the backend nginx proxy cache.
1515
proxy_cache off;
1616
proxy_cache_bypass 1;
1717
proxy_no_cache 1;

0 commit comments

Comments
 (0)