Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions misc/install-bunkerweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,12 @@ configure_full_config() {
fi
}

# Configure installation_type
configure_installation_type() {
print_status "Setting installation type to $INSTALL_TYPE"
echo "$INSTALL_TYPE" > /usr/share/bunkerweb/INSTALL_TYPE
}

# Function to install NGINX on Debian/Ubuntu
install_nginx_debian() {
print_step "Installing NGINX on Debian/Ubuntu"
Expand Down
5 changes: 3 additions & 2 deletions src/common/core/letsencrypt/jobs/certbot-auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
sys_path.append(deps_path)

from Database import Database # type: ignore
from common_utils import get_integration # type: ignore
from common_utils import get_integration, get_installation_type # type: ignore
from logger import getLogger # type: ignore
from API import API # type: ignore

Expand All @@ -23,11 +23,12 @@
token = getenv("CERTBOT_TOKEN", "")
validation = getenv("CERTBOT_VALIDATION", "")
integration = get_integration()
install_type = get_installation_type()

LOGGER.info(f"Detected {integration} integration")

# Cluster case
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf") or install_type in ("manager"):
db = Database(LOGGER, sqlalchemy_string=getenv("DATABASE_URI"))

instances = db.get_instances()
Expand Down
5 changes: 3 additions & 2 deletions src/common/core/letsencrypt/jobs/certbot-cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
sys_path.append(deps_path)

from Database import Database # type: ignore
from common_utils import get_integration # type: ignore
from common_utils import get_integration, get_installation_type # type: ignore
from logger import getLogger # type: ignore
from API import API # type: ignore

Expand All @@ -22,11 +22,12 @@
# Get env vars
token = getenv("CERTBOT_TOKEN", "")
integration = get_integration()
install_type = get_installation_type()

LOGGER.info(f"Detected {integration} integration")

# Cluster case
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
if integration in ("Docker", "Swarm", "Kubernetes", "Autoconf") or install_type in ("manager"):
db = Database(LOGGER, sqlalchemy_string=getenv("DATABASE_URI"))
instances = db.get_instances()

Expand Down
8 changes: 8 additions & 0 deletions src/common/utils/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ def get_integration() -> str:
except:
return "Unknown"

def get_installation_type() -> str:
try:
installation_type_path = Path(sep, "usr", "share", "bunkerweb", "INSTALL_TYPE")
if installation_type_path.is_file():
return installation_type_path.read_text(encoding="utf-8").strip()
return "Unknown"
except:
return "Unknown"

def get_os_info() -> Dict[str, str]:
os_data = {
Expand Down