Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make Dokploy to do not require port 80 and 443 to be avilable? #130

Closed
andrewzolotukhin opened this issue Jun 8, 2024 · 3 comments · Fixed by #135
Closed

How to make Dokploy to do not require port 80 and 443 to be avilable? #130

andrewzolotukhin opened this issue Jun 8, 2024 · 3 comments · Fixed by #135
Labels
enhancement New feature or request

Comments

@andrewzolotukhin
Copy link

Hi,

I have a VPS where nginx is running several websites (so it listens on 80 and 443 ports).
I would like to install Dokploy there, but nginx should keep running. Are there any way to supply a custom port to the installation script?

@Siumauricio Siumauricio added the enhancement New feature or request label Jun 8, 2024
@Siumauricio Siumauricio moved this to Review in @Dokploy Roadmap Jun 8, 2024
Siumauricio added a commit that referenced this issue Jun 8, 2024
…t-require-port-80-and-443-to-be-avilable

feat(#130): allow to pass enviroment variables to assign custom port …
@github-project-automation github-project-automation bot moved this from Review to Done in @Dokploy Roadmap Jun 8, 2024
@Siumauricio Siumauricio moved this from Done to Released in @Dokploy Roadmap Jun 8, 2024
@Siumauricio
Copy link
Contributor

Siumauricio commented Jun 8, 2024

@andrewzolotukhin Hi, In the next version v0.2.2 you can pass TRAEFIK_SSL_PORT and TRAEFIK_PORT by default they are 443 and 80 but you can override, make sure to delete the /etc/dokploy/traefik/traefik.yml if you have installed dokploy, in the case you don't have just run the following command the full script for this case can be this:

Just don't forget to assign values to the enviroment variables, I tested and it was working so let me know!

#!/bin/bash

if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" >&2
    exit 1
fi

# check if is Mac OS
if [ "$(uname)" = "Darwin" ]; then
    echo "This script must be run on Linux" >&2
    exit 1
fi


# check if is running inside a container
if [ -f /.dockerenv ]; then
    echo "This script must be run on Linux" >&2
    exit 1
fi

# check if something is running on port 80
if ss -tulnp | grep ':80 ' >/dev/null; then
    echo "Error: something is already running on port 80" >&2
    exit 1
fi

# check if something is running on port 443
if ss -tulnp | grep ':443 ' >/dev/null; then
    echo "Error: something is already running on port 443" >&2
    exit 1
fi


command_exists() {
  command -v "$@" > /dev/null 2>&1
}

if command_exists docker; then
  echo "Docker already installed"
else
  curl -sSL https://get.docker.com | sh
fi

docker swarm leave --force 2>/dev/null

advertise_addr=$(curl -s ifconfig.me)

docker swarm init --advertise-addr $advertise_addr

echo "Swarm initialized"

docker network rm -f dokploy-network 2>/dev/null
docker network create --driver overlay --attachable dokploy-network

echo "Network created"

mkdir -p /etc/dokploy

chmod -R 777 /etc/dokploy

docker pull dokploy/dokploy:latest

# Installation
docker service create \
  --name dokploy \
  --replicas 1 \
  --network dokploy-network \
  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
  --mount type=bind,source=/etc/dokploy,target=/etc/dokploy \
  --publish published=3000,target=3000,mode=host \
  --update-parallelism 1 \
  --update-order stop-first \
  -e TRAEFIK_SSL_PORT=<Value For SSL PORT eg(444)> \
  -e TRAEFIK_PORT=<VALUE FOR TRAEFIK HTTP PORT eg(81)> \
  dokploy/dokploy:latest



GREEN="\033[0;32m"
YELLOW="\033[1;33m"
BLUE="\033[0;34m"
NC="\033[0m" # No Color


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://${advertise_addr}:3000${NC}\n\n"
echo ""

@andrewzolotukhin
Copy link
Author

Hi, thank you very much for such a quick and comprehensive answer!

@chuyun
Copy link
Contributor

chuyun commented Dec 10, 2024

@andrewzolotukhin Hi, In the next version v0.2.2 you can pass TRAEFIK_SSL_PORT and TRAEFIK_PORT by default they are 443 and 80 but you can override, make sure to delete the /etc/dokploy/traefik/traefik.yml if you have installed dokploy, in the case you don't have just run the following command the full script for this case can be this:您好,在下一个版本 v0.2.2 中,您可以传递TRAEFIK_SSL_PORTTRAEFIK_PORT默认情况下它们是 443 和 80,但您可以覆盖,如果您安装了 dokploy,请确保删除 /etc/dokploy/traefik/traefik.yml,在如果您不只运行以下命令,则这种情况的完整脚本可以是这样的:

Just don't forget to assign values to the enviroment variables, I tested and it was working so let me know!只是不要忘记为环境变量赋值,我测试过并且它有效,所以请告诉我!

#!/bin/bash

if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" >&2
    exit 1
fi

# check if is Mac OS
if [ "$(uname)" = "Darwin" ]; then
    echo "This script must be run on Linux" >&2
    exit 1
fi


# check if is running inside a container
if [ -f /.dockerenv ]; then
    echo "This script must be run on Linux" >&2
    exit 1
fi

# check if something is running on port 80
if ss -tulnp | grep ':80 ' >/dev/null; then
    echo "Error: something is already running on port 80" >&2
    exit 1
fi

# check if something is running on port 443
if ss -tulnp | grep ':443 ' >/dev/null; then
    echo "Error: something is already running on port 443" >&2
    exit 1
fi


command_exists() {
  command -v "$@" > /dev/null 2>&1
}

if command_exists docker; then
  echo "Docker already installed"
else
  curl -sSL https://get.docker.com | sh
fi

docker swarm leave --force 2>/dev/null

advertise_addr=$(curl -s ifconfig.me)

docker swarm init --advertise-addr $advertise_addr

echo "Swarm initialized"

docker network rm -f dokploy-network 2>/dev/null
docker network create --driver overlay --attachable dokploy-network

echo "Network created"

mkdir -p /etc/dokploy

chmod -R 777 /etc/dokploy

docker pull dokploy/dokploy:latest

# Installation
docker service create \
  --name dokploy \
  --replicas 1 \
  --network dokploy-network \
  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
  --mount type=bind,source=/etc/dokploy,target=/etc/dokploy \
  --publish published=3000,target=3000,mode=host \
  --update-parallelism 1 \
  --update-order stop-first \
  -e TRAEFIK_SSL_PORT=<Value For SSL PORT eg(444)> \
  -e TRAEFIK_PORT=<VALUE FOR TRAEFIK HTTP PORT eg(81)> \
  dokploy/dokploy:latest



GREEN="\033[0;32m"
YELLOW="\033[1;33m"
BLUE="\033[0;34m"
NC="\033[0m" # No Color


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://${advertise_addr}:3000${NC}\n\n"
echo ""

I tried, but there was a problem.Can you provide some assistance? thanks
#804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

3 participants