mirror of
https://github.com/Dokploy/website
synced 2025-06-26 18:16:01 +00:00
Merge pull request #34 from Dokploy/fix/set-private-ip-instead-of-public
feat: enhance Docker installation script to retrieve private IP addre…
This commit is contained in:
commit
b46705a572
@ -1 +0,0 @@
|
||||
npx commitlint --edit "$1"
|
@ -1,6 +0,0 @@
|
||||
// Skip Husky install in production and CI
|
||||
if (process.env.NODE_ENV === "production" || process.env.CI === "true") {
|
||||
process.exit(0);
|
||||
}
|
||||
const husky = (await import("husky")).default;
|
||||
console.log(husky());
|
@ -1,2 +0,0 @@
|
||||
pnpm run check
|
||||
git add .
|
@ -11,7 +11,6 @@ install_dokploy() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# check if is running inside a container
|
||||
if [ -f /.dockerenv ]; then
|
||||
echo "This script must be run on Linux" >&2
|
||||
@ -31,13 +30,13 @@ install_dokploy() {
|
||||
fi
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
if command_exists docker; then
|
||||
echo "Docker already installed"
|
||||
echo "Docker already installed"
|
||||
else
|
||||
curl -sSL https://get.docker.com | sh
|
||||
curl -sSL https://get.docker.com | sh
|
||||
fi
|
||||
|
||||
docker swarm leave --force 2>/dev/null
|
||||
@ -85,12 +84,23 @@ install_dokploy() {
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
get_private_ip() {
|
||||
ip addr show | grep -E "inet (192\.168\.|10\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)" | head -n1 | awk '{print $2}' | cut -d/ -f1
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_private_ip)}"
|
||||
|
||||
if [ -z "$advertise_addr" ]; then
|
||||
echo "ERROR: We couldn't find a private IP address."
|
||||
echo "Please set the ADVERTISE_ADDR environment variable manually."
|
||||
echo "Example: export ADVERTISE_ADDR=192.168.1.100"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using advertise address: $advertise_addr"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to initialize Docker Swarm" >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -122,7 +132,6 @@ install_dokploy() {
|
||||
--network dokploy-network \
|
||||
--mount type=volume,source=redis-data-volume,target=/data \
|
||||
redis:7
|
||||
|
||||
|
||||
# Installation
|
||||
docker service create \
|
||||
@ -167,7 +176,6 @@ install_dokploy() {
|
||||
# --publish mode=host,published=443,target=443,protocol=udp \
|
||||
# traefik:v3.1.2
|
||||
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[1;33m"
|
||||
BLUE="\033[0;34m"
|
||||
@ -184,12 +192,12 @@ install_dokploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
formatted_addr=$(format_ip_for_url "$advertise_addr")
|
||||
public_ip="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
formatted_addr=$(format_ip_for_url "$public_ip")
|
||||
echo ""
|
||||
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
|
||||
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
|
||||
printf "${YELLOW}Please go to http://${formatted_addr}:3000${NC}\n\n"
|
||||
echo ""
|
||||
}
|
||||
|
||||
update_dokploy() {
|
||||
|
@ -11,7 +11,6 @@ install_dokploy() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# check if is running inside a container
|
||||
if [ -f /.dockerenv ]; then
|
||||
echo "This script must be run on Linux" >&2
|
||||
@ -85,7 +84,18 @@ install_dokploy() {
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
get_private_ip() {
|
||||
ip addr show | grep -E "inet (192\.168\.|10\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)" | head -n1 | awk '{print $2}' | cut -d/ -f1
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_private_ip)}"
|
||||
|
||||
if [ -z "$advertise_addr" ]; then
|
||||
echo "ERROR: We couldn't find a private IP address."
|
||||
echo "Please set the ADVERTISE_ADDR environment variable manually."
|
||||
echo "Example: export ADVERTISE_ADDR=192.168.1.100"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using advertise address: $advertise_addr"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
@ -185,12 +195,12 @@ install_dokploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
formatted_addr=$(format_ip_for_url "$advertise_addr")
|
||||
public_ip="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
formatted_addr=$(format_ip_for_url "$public_ip")
|
||||
echo ""
|
||||
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
|
||||
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
|
||||
printf "${YELLOW}Please go to http://${formatted_addr}:3000${NC}\n\n"
|
||||
echo ""
|
||||
}
|
||||
|
||||
update_dokploy() {
|
||||
|
@ -84,7 +84,18 @@ install_dokploy() {
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
get_private_ip() {
|
||||
ip addr show | grep -E "inet (192\.168\.|10\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.)" | head -n1 | awk '{print $2}' | cut -d/ -f1
|
||||
}
|
||||
|
||||
advertise_addr="${ADVERTISE_ADDR:-$(get_private_ip)}"
|
||||
|
||||
if [ -z "$advertise_addr" ]; then
|
||||
echo "ERROR: We couldn't find a private IP address."
|
||||
echo "Please set the ADVERTISE_ADDR environment variable manually."
|
||||
echo "Example: export ADVERTISE_ADDR=192.168.1.100"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using advertise address: $advertise_addr"
|
||||
|
||||
docker swarm init --advertise-addr $advertise_addr
|
||||
@ -181,7 +192,8 @@ install_dokploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
formatted_addr=$(format_ip_for_url "$advertise_addr")
|
||||
public_ip="${ADVERTISE_ADDR:-$(get_ip)}"
|
||||
formatted_addr=$(format_ip_for_url "$public_ip")
|
||||
echo ""
|
||||
printf "${GREEN}Congratulations, Dokploy is installed!${NC}\n"
|
||||
printf "${BLUE}Wait 15 seconds for the server to start${NC}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user