forked from rajun/ar-test
Compare commits
No commits in common. "main" and "main" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,6 +13,3 @@
|
|||||||
|
|
||||||
# Keep the root pb_migrations folder tracked (empty placeholder for production)
|
# Keep the root pb_migrations folder tracked (empty placeholder for production)
|
||||||
!/pb_migrations/.gitkeep
|
!/pb_migrations/.gitkeep
|
||||||
|
|
||||||
|
|
||||||
.yarn
|
|
||||||
|
|||||||
Binary file not shown.
@ -1,19 +1,6 @@
|
|||||||
import PocketBase from 'pocketbase';
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
// VITE_ vars are inlined at BUILD time, not runtime. If the image is built
|
const rawUrl = import.meta.env.VITE_POCKETBASE_URL ?? '';
|
||||||
// without --build-arg VITE_POCKETBASE_URL, this is empty and the SDK silently
|
|
||||||
// resolves requests against `https://` — producing `https://api/collections/...`
|
|
||||||
// which fails as a DNS error that looks like CORS. Fail loudly instead.
|
|
||||||
const rawUrl = import.meta.env.VITE_POCKETBASE_URL;
|
|
||||||
|
|
||||||
if (!rawUrl) {
|
|
||||||
throw new Error(
|
|
||||||
'VITE_POCKETBASE_URL is not set. It must be passed as a --build-arg when ' +
|
|
||||||
'building the Docker image — setting it at runtime has no effect, because ' +
|
|
||||||
'Vite inlines VITE_ variables into the bundle at build time.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure URL always has a protocol so PocketBase SDK treats it as absolute
|
// Ensure URL always has a protocol so PocketBase SDK treats it as absolute
|
||||||
const pbUrl = rawUrl.startsWith('http') ? rawUrl : `https://${rawUrl}`;
|
const pbUrl = rawUrl.startsWith('http') ? rawUrl : `https://${rawUrl}`;
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ export default function Login() {
|
|||||||
<div className="inline-flex w-14 h-14 bg-black border border-neutral-800 rounded-2xl items-center justify-center shadow-lg shadow-black mb-4">
|
<div className="inline-flex w-14 h-14 bg-black border border-neutral-800 rounded-2xl items-center justify-center shadow-lg shadow-black mb-4">
|
||||||
<span className="text-orange-500 font-extrabold text-3xl pl-1 select-none">t.</span>
|
<span className="text-orange-500 font-extrabold text-3xl pl-1 select-none">t.</span>
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-2xl font-bold tracking-tight text-white uppercase">AR_Management</h1>
|
<h1 className="text-2xl font-bold tracking-tight text-white uppercase">AR Management</h1>
|
||||||
<p className="mt-1 text-neutral-500 text-xs uppercase tracking-wider">
|
<p className="mt-1 text-neutral-500 text-xs uppercase tracking-wider">
|
||||||
Authorized Access Only
|
Authorized Access Only
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -1,28 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -e
|
||||||
|
|
||||||
REGISTRY="registry.digitalocean.com/thob-blr1"
|
REGISTRY="registry.digitalocean.com/thob-blr1"
|
||||||
SHA=$(git rev-parse --short=10 HEAD)
|
SHA=$(git rev-parse --short=10 HEAD)
|
||||||
|
|
||||||
# Load .env if present, so VITE_* don't have to be exported by hand.
|
|
||||||
if [ -f .env ]; then
|
|
||||||
echo "Loading build vars from .env"
|
|
||||||
set -a
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
. ./.env
|
|
||||||
set +a
|
|
||||||
fi
|
|
||||||
|
|
||||||
# VITE_ vars are inlined into the client bundle at BUILD time. If they are empty
|
|
||||||
# here, the app ships with a broken PocketBase URL (https://api/...) that fails
|
|
||||||
# in the browser as a DNS error resembling CORS. Refuse to build.
|
|
||||||
: "${VITE_POCKETBASE_URL:?VITE_POCKETBASE_URL is not set — export it or add it to .env}"
|
|
||||||
: "${VITE_FRONTEND_URL:?VITE_FRONTEND_URL is not set — export it or add it to .env}"
|
|
||||||
|
|
||||||
echo "Building commit: $SHA"
|
echo "Building commit: $SHA"
|
||||||
echo " VITE_POCKETBASE_URL=$VITE_POCKETBASE_URL"
|
|
||||||
echo " VITE_FRONTEND_URL=$VITE_FRONTEND_URL"
|
|
||||||
|
|
||||||
# Login
|
# Login
|
||||||
doctl registry login
|
doctl registry login
|
||||||
@ -31,25 +14,13 @@ doctl registry login
|
|||||||
echo "Building AR App..."
|
echo "Building AR App..."
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64 \
|
--platform linux/amd64 \
|
||||||
--build-arg "VITE_POCKETBASE_URL=$VITE_POCKETBASE_URL" \
|
--build-arg VITE_POCKETBASE_URL=$VITE_POCKETBASE_URL \
|
||||||
--build-arg "VITE_FRONTEND_URL=$VITE_FRONTEND_URL" \
|
--build-arg VITE_FRONTEND_URL=$VITE_FRONTEND_URL \
|
||||||
-f Dockerfile \
|
-f Dockerfile \
|
||||||
--load \
|
--load \
|
||||||
-t "$REGISTRY/ar:$SHA" \
|
-t $REGISTRY/ar:$SHA \
|
||||||
-t "$REGISTRY/ar:latest" .
|
-t $REGISTRY/ar:latest .
|
||||||
|
docker push $REGISTRY/ar:$SHA
|
||||||
|
docker push $REGISTRY/ar:latest
|
||||||
|
|
||||||
# Verify the URL actually made it into the client bundle before pushing.
|
echo "✅ All images built and pushed successfully"
|
||||||
echo "Verifying baked-in PocketBase URL..."
|
|
||||||
PB_HOST=$(echo "$VITE_POCKETBASE_URL" | sed -e 's#^https\?://##' -e 's#/.*$##')
|
|
||||||
if ! docker run --rm --entrypoint sh "$REGISTRY/ar:$SHA" \
|
|
||||||
-c "grep -rq '$PB_HOST' /app/build/client"; then
|
|
||||||
echo "❌ Build verification failed: '$PB_HOST' not found in the client bundle."
|
|
||||||
echo " The image was NOT pushed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "✅ Verified: $PB_HOST is baked into the client bundle"
|
|
||||||
|
|
||||||
docker push "$REGISTRY/ar:$SHA"
|
|
||||||
docker push "$REGISTRY/ar:latest"
|
|
||||||
|
|
||||||
echo "✅ All images built and pushed successfully (tag: $SHA)"
|
|
||||||
|
|||||||
@ -79,10 +79,9 @@ services:
|
|||||||
- VITE_POCKETBASE_URL=${VITE_POCKETBASE_URL:-https://pb.ar.thob.studio}
|
- VITE_POCKETBASE_URL=${VITE_POCKETBASE_URL:-https://pb.ar.thob.studio}
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
# NOTE: VITE_* vars are inlined into the client bundle at BUILD time by Vite.
|
|
||||||
# Setting them here has NO effect on the pulled image — they must be passed
|
|
||||||
# as --build-arg in build-and-push.sh. Only server-side vars belong below.
|
|
||||||
environment:
|
environment:
|
||||||
|
- VITE_POCKETBASE_URL=${VITE_POCKETBASE_URL:-https://pb.ar.thob.studio}
|
||||||
|
- VITE_FRONTEND_URL=${VITE_FRONTEND_URL:-https://ar.thob.studio}
|
||||||
- INTERNAL_POCKETBASE_URL=http://ar-pb:8090
|
- INTERNAL_POCKETBASE_URL=http://ar-pb:8090
|
||||||
depends_on:
|
depends_on:
|
||||||
- pocketbase
|
- pocketbase
|
||||||
@ -90,9 +89,6 @@ services:
|
|||||||
- traefik
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- "wud.watch=true"
|
- "wud.watch=true"
|
||||||
# Required: the :latest tag doesn't change, so wud must compare digests
|
|
||||||
# to notice a new image was pushed to the same tag.
|
|
||||||
- "wud.watch.digest=true"
|
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.docker.network=traefik"
|
- "traefik.docker.network=traefik"
|
||||||
- "traefik.http.routers.ar-app.rule=Host(`ar.thob.studio`)"
|
- "traefik.http.routers.ar-app.rule=Host(`ar.thob.studio`)"
|
||||||
|
|||||||
13
package-lock.json
generated
13
package-lock.json
generated
@ -70,6 +70,7 @@
|
|||||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.27.1",
|
"@babel/code-frame": "^7.27.1",
|
||||||
"@babel/generator": "^7.28.5",
|
"@babel/generator": "^7.28.5",
|
||||||
@ -1446,6 +1447,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@react-router/serve/-/serve-7.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/@react-router/serve/-/serve-7.10.0.tgz",
|
||||||
"integrity": "sha512-tgdbw1lmDkzF3gCMj//iNklgUrYHUxz35rj0sbyLeti8K2gVsNxaZWyt5omanFgkeZ7WYfi0wzLHviqxl228eA==",
|
"integrity": "sha512-tgdbw1lmDkzF3gCMj//iNklgUrYHUxz35rj0sbyLeti8K2gVsNxaZWyt5omanFgkeZ7WYfi0wzLHviqxl228eA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mjackson/node-fetch-server": "^0.2.0",
|
"@mjackson/node-fetch-server": "^0.2.0",
|
||||||
"@react-router/express": "7.10.0",
|
"@react-router/express": "7.10.0",
|
||||||
@ -2099,6 +2101,7 @@
|
|||||||
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
|
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"csstype": "^3.2.2"
|
"csstype": "^3.2.2"
|
||||||
}
|
}
|
||||||
@ -2109,6 +2112,7 @@
|
|||||||
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@types/react": "^19.2.0"
|
"@types/react": "^19.2.0"
|
||||||
}
|
}
|
||||||
@ -2321,6 +2325,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.8.25",
|
"baseline-browser-mapping": "^2.8.25",
|
||||||
"caniuse-lite": "^1.0.30001754",
|
"caniuse-lite": "^1.0.30001754",
|
||||||
@ -2848,6 +2853,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
||||||
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
|
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"accepts": "~1.3.8",
|
"accepts": "~1.3.8",
|
||||||
"array-flatten": "1.1.1",
|
"array-flatten": "1.1.1",
|
||||||
@ -3863,6 +3869,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@ -4023,6 +4030,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz",
|
||||||
"integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==",
|
"integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@ -4032,6 +4040,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz",
|
||||||
"integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==",
|
"integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
@ -4044,6 +4053,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.82.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.82.0.tgz",
|
||||||
"integrity": "sha512-Zw/uFZ2dO+02GHlBn7JFGn8kZJ7LdM33B/0BXOovzFay+CMhf94JMw5BVu+F1tVkUKjNvBuaE3fz5BJhga10Tg==",
|
"integrity": "sha512-Zw/uFZ2dO+02GHlBn7JFGn8kZJ7LdM33B/0BXOovzFay+CMhf94JMw5BVu+F1tVkUKjNvBuaE3fz5BJhga10Tg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
},
|
||||||
@ -4117,6 +4127,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.10.0.tgz",
|
||||||
"integrity": "sha512-FVyCOH4IZ0eDDRycODfUqoN8ZSR2LbTvtx6RPsBgzvJ8xAXlMZNCrOFpu+jb8QbtZnpAd/cEki2pwE848pNGxw==",
|
"integrity": "sha512-FVyCOH4IZ0eDDRycODfUqoN8ZSR2LbTvtx6RPsBgzvJ8xAXlMZNCrOFpu+jb8QbtZnpAd/cEki2pwE848pNGxw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookie": "^1.0.1",
|
"cookie": "^1.0.1",
|
||||||
"set-cookie-parser": "^2.6.0"
|
"set-cookie-parser": "^2.6.0"
|
||||||
@ -4704,6 +4715,7 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@ -4841,6 +4853,7 @@
|
|||||||
"integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==",
|
"integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user