Xan
Xan
Explore posts from servers
CCoder.com
Created by Xan on 5/19/2025 in #help
SSH/Tunnel to database fails
I think its something to do with our mysql being only accessible through mysql container name and not 127.0.0.1 inside the image. I ended up fixing connecting our tools to it with a terminal function
function tunnel-sql() {
local PROJECT="$1"
local LOCAL_PORT=3306
local REMOTE_USER="user"
local REMOTE_HOST="127.0.0.1"
local REMOTE_PORT="2222"

if [[ -z "$PROJECT" ]]; then
echo "Usage: tunnel-mysql <coder_project_name>"
return 1
fi

echo "๐Ÿ”Œ Starting coder tunnel for project: $PROJECT"
tunnel "$PROJECT" &
local TUNNEL_PID=$!

echo "โณ Waiting for tunnel to initialize..."
sleep 4

echo "๐Ÿ” Fetching MySQL container IP..."
local CONTAINER_IP
CONTAINER_IP=$(ssh -p $REMOTE_PORT "$REMOTE_USER@$REMOTE_HOST" "getent hosts mysql | awk '{ print \$1 }'")

if [[ -z "$CONTAINER_IP" ]]; then
echo "โŒ Failed to get MySQL container IP"
kill $TUNNEL_PID
return 1
fi

echo "๐Ÿ“ก MySQL container IP: $CONTAINER_IP"
echo "๐Ÿš€ Starting SSH tunnel: localhost:$LOCAL_PORT โžœ $CONTAINER_IP:3306"
ssh -L "$LOCAL_PORT:$CONTAINER_IP:3306" "$REMOTE_USER@$REMOTE_HOST" -p "$REMOTE_PORT"

echo "๐Ÿงน Cleaning up coder tunnel (PID $TUNNEL_PID)"
kill $TUNNEL_PID 2>/dev/null
}
function tunnel-sql() {
local PROJECT="$1"
local LOCAL_PORT=3306
local REMOTE_USER="user"
local REMOTE_HOST="127.0.0.1"
local REMOTE_PORT="2222"

if [[ -z "$PROJECT" ]]; then
echo "Usage: tunnel-mysql <coder_project_name>"
return 1
fi

echo "๐Ÿ”Œ Starting coder tunnel for project: $PROJECT"
tunnel "$PROJECT" &
local TUNNEL_PID=$!

echo "โณ Waiting for tunnel to initialize..."
sleep 4

echo "๐Ÿ” Fetching MySQL container IP..."
local CONTAINER_IP
CONTAINER_IP=$(ssh -p $REMOTE_PORT "$REMOTE_USER@$REMOTE_HOST" "getent hosts mysql | awk '{ print \$1 }'")

if [[ -z "$CONTAINER_IP" ]]; then
echo "โŒ Failed to get MySQL container IP"
kill $TUNNEL_PID
return 1
fi

echo "๐Ÿ“ก MySQL container IP: $CONTAINER_IP"
echo "๐Ÿš€ Starting SSH tunnel: localhost:$LOCAL_PORT โžœ $CONTAINER_IP:3306"
ssh -L "$LOCAL_PORT:$CONTAINER_IP:3306" "$REMOTE_USER@$REMOTE_HOST" -p "$REMOTE_PORT"

echo "๐Ÿงน Cleaning up coder tunnel (PID $TUNNEL_PID)"
kill $TUNNEL_PID 2>/dev/null
}
This makes it so things work a little more like they used to
9 replies
CCoder.com
Created by Xan on 3/18/2025 in #help
v2.19.1 - coder config-ssh deletes entire config
When creating/destroying tons of workspaces, it's not a lot more painful to manually edit the connection list in so many tools. I could see if I only worked in a few workspaces but my list of workspaces changes frequently and is very large lol
11 replies
CCoder.com
Created by Xan on 3/18/2025 in #help
v2.19.1 - coder config-ssh deletes entire config
Tinkerwell is a PHP tool that lets you quickly select connections from your ssh config for managing remote PHP environments. Tabby is a popular macOS terminal that had a panel that listed all of your ssh config connections. These tools and then all of our own automations relied on the way Coder was doing it before which provided a sort of universal compatibility with other dev tools.
11 replies
CCoder.com
Created by Xan on 3/18/2025 in #help
v2.19.1 - coder config-ssh deletes entire config
I posted a feature request in GitHub about maybe possibly filling out the ssh config still with something like coder config-ssh --no-wildcard
11 replies
CCoder.com
Created by Xan on 3/18/2025 in #help
v2.19.1 - coder config-ssh deletes entire config
Not in my current set up, and this breaks a few automations and tools we relied on that read from our ssh config ๐Ÿ˜ฆ
11 replies
CCoder.com
Created by Xan on 3/18/2025 in #help
v2.19.1 - coder config-ssh deletes entire config
If I hit the "PhpStorm" button in the backend for anyworkspace, it says The workspace "example"does not have an agenc named "example" where example is the name of my workspace
11 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
got everything set up perfectly! appreciate you!
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
whaaaaaat they're atomic so you can visit one for every commit
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
ohhhh perfect
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
really appreciate the tips, just getting started with this after quitting netlify lol
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
it automatically names preview branch deploys correct? that can't be configured to match the branch name?
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
trying to convince everyone this is viable for us and then start doing more SPAs and less... wordpress ๐Ÿ˜‚
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
okay cool this should work in a way
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
awesome
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
ideally we're trying to figure out how to do like.. clientsite.ourstagingsiteurl.com - latest commit on staging branch <- PIN protect random-branches.clients.ourstaginsiteurl.com - for random branches <- PIN protect clientsite.com - latest master commit, no PIN
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
so with no rules it'll block all traffic? then just add an allow with the emails?
16 replies
CDCloudflare Developers
Created by Xan on 8/3/2023 in #pages-help
Password Protect Pages, not based on email?
yeah I'll stick with PIN since its mostly to stop staging sites from getting crawled and only allowing us and the clients to see them
16 replies