Skip to content

Commit 915721a

Browse files
committed
Working dev script
1 parent 345f959 commit 915721a

6 files changed

Lines changed: 596 additions & 13 deletions

File tree

server/dashboard/src/routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const GuestGuard = () => {
3232
return !user ? <Outlet /> : <Navigate to={redirectTo} replace />;
3333
};
3434

35-
const simpleAuth = import.meta.env.SIMPLE_AUTH;
35+
const simpleAuth = import.meta.env.DASH_SIMPLE_AUTH;
3636

3737
export const router = createBrowserRouter([
3838
{

server/dashboard/src/routes/auth/Login.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ const LoginRoute = () => {
2323
signInWithEmailAndPassword(data.email, data.password);
2424
};
2525

26+
const simpleAuth = import.meta.env.DASH_SIMPLE_AUTH;
27+
2628
return (
2729
<AuthLayout
2830
title="Log In"
29-
links={[{
31+
links={(!simpleAuth) && [{
3032
label: "Create Account",
3133
href: "/auth/signup",
3234
}, {

server/dashboard/vite.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default defineConfig({
1616
src: path.resolve(__dirname, "./src"),
1717
},
1818
},
19-
define: {
20-
"import.meta.env.SIMPLE_AUTH": process.env.SIMPLE_AUTH === "true",
21-
},
19+
20+
envDir: path.resolve(__dirname, ".."),
21+
22+
envPrefix: "DASH_",
2223
});

server/dev.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ DB_BACKEND=${DB_BACKEND:-postgres}
2020
DB_PORT=${DB_PORT:-5432}
2121
STUDIO_PORT=${STUDIO_PORT:-5555}
2222
NET=devnet
23+
NM_VOL=openpin-dev-node-modules
24+
DASH_NM_VOL=openpin-dev-dash-node-modules
2325

2426
# ──────────────────────────────────────────────
2527
# 2. Clean-up helper (runs on Ctrl-C / exit)
@@ -34,9 +36,11 @@ cleanup () {
3436
trap cleanup INT TERM EXIT
3537

3638
# ──────────────────────────────────────────────
37-
# 3. Network
39+
# 3. Network / volumes
3840
# ──────────────────────────────────────────────
3941
docker network inspect "$NET" >/dev/null 2>&1 || { echo "🔵 Creating network $NET"; docker network create "$NET"; }
42+
docker volume inspect "$NM_VOL" >/dev/null 2>&1 || { echo "🔵 Creating volume $NM_VOL"; docker volume create "$NM_VOL"; }
43+
docker volume inspect "$DASH_NM_VOL" >/dev/null 2>&1 || { echo "🔵 Creating volume $DASH_NM_VOL"; docker volume create "$DASH_NM_VOL"; }
4044

4145
# ──────────────────────────────────────────────
4246
# 3. Postgres (optional)
@@ -55,7 +59,7 @@ if [[ "$DB_BACKEND" == "postgres" ]]; then
5559
if docker container inspect openpin-dev-db &>/dev/null; then
5660
echo "✅ Found existing Postgres container."
5761
if ! docker start openpin-dev-db >/dev/null 2>&1; then
58-
echo "⚠️ Could not start it (probably missing network) recreating ..."
62+
echo "⚠️ Could not start it (probably missing network) - recreating ..."
5963
docker rm -f openpin-dev-db
6064
postgres_create
6165
fi
@@ -71,14 +75,17 @@ if [[ "$DB_BACKEND" == "postgres" ]]; then
7175
psql -U postgres -d openpin -tAc "select count(*) from information_schema.tables where table_schema='public';")
7276
if [[ "$TABLES" == "0" ]]; then
7377
echo "🆕 Running initial Prisma migration ..."
74-
docker run --rm --network "$NET" -v "$PWD":/app -w /app \
78+
docker run --rm --network "$NET" \
79+
-v "$PWD":/app -w /app \
80+
-v "$NM_VOL":/app/node_modules \
7581
-e DATABASE_URL="postgresql://postgres:$POSTGRES_PASSWORD@openpin-dev-db:5432/openpin" \
7682
node:20-slim bash -c "npm ci --omit=dev --silent && npx prisma generate && npx prisma migrate deploy"
7783
fi
7884

7985
prisma_start () {
8086
docker run -d --name prisma-studio --network "$NET" \
8187
-v "$PWD":/app -w /app \
88+
-v "$NM_VOL":/app/node_modules \
8289
-e DATABASE_URL="postgresql://postgres:$POSTGRES_PASSWORD@openpin-dev-db:5432/openpin" \
8390
-p "$STUDIO_PORT":5555 \
8491
node:20-slim bash -c "npm ci --omit=dev --silent && npx prisma generate && npx prisma studio --hostname 0.0.0.0 --port 5555"
@@ -109,6 +116,8 @@ docker run --rm -it \
109116
--name openpin-dev \
110117
--network $NET \
111118
-v "$PWD":/app \
119+
-v "$NM_VOL":/app/node_modules \
120+
-v "$DASH_NM_VOL":/app/dashboard/node_modules \
112121
-v "$FIREBASE_KEY_PATH":/keys/firebaseKey.json:ro \
113122
-w /app \
114123
-p 8080:8080 \

0 commit comments

Comments
 (0)