forked from syntaxbullet/AuroraBot-discord
feat: Add script and configuration for remote Drizzle Studio access via SSH tunnel.
This commit is contained in:
@@ -7,3 +7,6 @@ DISCORD_BOT_TOKEN=your-discord-bot-token
|
|||||||
DISCORD_CLIENT_ID=your-discord-client-id
|
DISCORD_CLIENT_ID=your-discord-client-id
|
||||||
DISCORD_GUILD_ID=your-discord-guild-id
|
DISCORD_GUILD_ID=your-discord-guild-id
|
||||||
DATABASE_URL=postgres://kyoko:kyoko@db:5432/kyoko
|
DATABASE_URL=postgres://kyoko:kyoko@db:5432/kyoko
|
||||||
|
|
||||||
|
VPS_USER=your-vps-user
|
||||||
|
VPS_HOST=your-vps-ip
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
"db:push": "docker compose run --rm app drizzle-kit push",
|
"db:push": "docker compose run --rm app drizzle-kit push",
|
||||||
"db:push:local": "drizzle-kit push",
|
"db:push:local": "drizzle-kit push",
|
||||||
"dev": "bun --watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"db:studio": "drizzle-kit studio --host 0.0.0.0"
|
"db:studio": "drizzle-kit studio --host 0.0.0.0",
|
||||||
|
"studio:remote": "bash scripts/remote-studio.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@napi-rs/canvas": "^0.1.84",
|
"@napi-rs/canvas": "^0.1.84",
|
||||||
|
|||||||
25
scripts/remote-studio.sh
Executable file
25
scripts/remote-studio.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
if [ -f .env ]; then
|
||||||
|
# export $(grep -v '^#' .env | xargs) # Use a safer way if possible, but for simple .env this often works.
|
||||||
|
# Better way to source .env without exporting everything to shell if we just want to use them in script:
|
||||||
|
set -a
|
||||||
|
source .env
|
||||||
|
set +a
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VPS_HOST" ] || [ -z "$VPS_USER" ]; then
|
||||||
|
echo "Error: VPS_HOST and VPS_USER must be set in .env"
|
||||||
|
echo "Please add them to your .env file:"
|
||||||
|
echo "VPS_USER=your-username"
|
||||||
|
echo "VPS_HOST=your-ip-address"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔮 Establishing secure tunnel to Drizzle Studio..."
|
||||||
|
echo "📚 Studio will be accessible at: https://local.drizzle.studio"
|
||||||
|
echo "Press Ctrl+C to stop the connection."
|
||||||
|
|
||||||
|
# -N means "Do not execute a remote command". -L is for local port forwarding.
|
||||||
|
ssh -N -L 4983:127.0.0.1:4983 $VPS_USER@$VPS_HOST
|
||||||
Reference in New Issue
Block a user