linux - fix letsencryt not working and fix permissions on /etc/bunkerweb/configs for tests
This commit is contained in:
parent
0ccd757817
commit
8f7833413b
|
@ -24,4 +24,6 @@ sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" README.md
|
|||
sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" tests/ui/docker-compose.yml
|
||||
for test in tests/core/* ; do
|
||||
sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" ${test}/docker-compose.yml
|
||||
done
|
||||
done
|
||||
# linux
|
||||
sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" src/linux/scripts*.sh
|
||||
|
|
|
@ -95,6 +95,23 @@ try:
|
|||
parents=True, exist_ok=True
|
||||
)
|
||||
|
||||
# Get env vars
|
||||
bw_integration = "Linux"
|
||||
integration_path = Path(sep, "usr", "share", "bunkerweb", "INTEGRATION")
|
||||
os_release_path = Path(sep, "etc", "os-release")
|
||||
if getenv("KUBERNETES_MODE", "no") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
elif getenv("SWARM_MODE", "no") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("AUTOCONF_MODE", "no") == "yes":
|
||||
bw_integration = "Autoconf"
|
||||
elif integration_path.is_file():
|
||||
bw_integration = integration_path.read_text(encoding="utf-8").strip()
|
||||
elif os_release_path.is_file() and "Alpine" in os_release_path.read_text(
|
||||
encoding="utf-8"
|
||||
):
|
||||
bw_integration = "Docker"
|
||||
|
||||
# Extract letsencrypt folder if it exists in db
|
||||
db = Database(
|
||||
logger,
|
||||
|
@ -103,7 +120,7 @@ try:
|
|||
)
|
||||
|
||||
tgz = get_file_in_db("folder.tgz", db, job_name="certbot-renew")
|
||||
if tgz:
|
||||
if tgz and bw_integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
# Delete folder if needed
|
||||
if letsencrypt_path.exists():
|
||||
rmtree(str(letsencrypt_path), ignore_errors=True)
|
||||
|
|
|
@ -87,6 +87,23 @@ try:
|
|||
parents=True, exist_ok=True
|
||||
)
|
||||
|
||||
# Get env vars
|
||||
bw_integration = "Linux"
|
||||
integration_path = Path(sep, "usr", "share", "bunkerweb", "INTEGRATION")
|
||||
os_release_path = Path(sep, "etc", "os-release")
|
||||
if getenv("KUBERNETES_MODE", "no") == "yes":
|
||||
bw_integration = "Kubernetes"
|
||||
elif getenv("SWARM_MODE", "no") == "yes":
|
||||
bw_integration = "Swarm"
|
||||
elif getenv("AUTOCONF_MODE", "no") == "yes":
|
||||
bw_integration = "Autoconf"
|
||||
elif integration_path.is_file():
|
||||
bw_integration = integration_path.read_text(encoding="utf-8").strip()
|
||||
elif os_release_path.is_file() and "Alpine" in os_release_path.read_text(
|
||||
encoding="utf-8"
|
||||
):
|
||||
bw_integration + "Docker"
|
||||
|
||||
# Extract letsencrypt folder if it exists in db
|
||||
db = Database(
|
||||
logger,
|
||||
|
@ -95,7 +112,7 @@ try:
|
|||
)
|
||||
|
||||
tgz = get_file_in_db("folder.tgz", db)
|
||||
if tgz:
|
||||
if tgz and bw_integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
|
||||
# Delete folder if needed
|
||||
if letsencrypt_path.exists():
|
||||
rmtree(str(letsencrypt_path), ignore_errors=True)
|
||||
|
|
|
@ -22,7 +22,7 @@ if [ -f /etc/os-release ]; then
|
|||
if [[ "$OS" == "Ubuntu" || "$OS" == "Debian" ]]; then
|
||||
# Get the version of the package
|
||||
VERSION=$(dpkg-query -W -f='${Version}' bunkerweb)
|
||||
if dpkg --compare-versions "$VERSION" lt "1.5.0" && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
if dpkg --compare-versions "$VERSION" lt "1.5.1" && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
echo "ℹ️ Copy /var/tmp/variables.env to /etc/bunkerweb/variables.env"
|
||||
do_and_check_cmd cp -f /var/tmp/variables.env /etc/bunkerweb/variables.env
|
||||
echo "ℹ️ Copy /var/tmp/ui.env to /etc/bunkerweb/ui.env"
|
||||
|
@ -31,7 +31,7 @@ if [ -f /etc/os-release ]; then
|
|||
elif [[ "$OS" == "CentOS Linux" || "$OS" == "Fedora" ]]; then
|
||||
# Get the version of the package
|
||||
VERSION=$(rpm -q --queryformat '%{VERSION}' bunkerweb)
|
||||
if [ "$(printf '%s\n' "$VERSION" "$(echo '1.5.0' | tr -d ' ')" | sort -V | head -n 1)" = "$VERSION" ] && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
if [ "$(printf '%s\n' "$VERSION" "$(echo '1.5.1' | tr -d ' ')" | sort -V | head -n 1)" = "$VERSION" ] && [ -f /var/tmp/variables.env ] && [ -f /var/tmp/ui.env ]; then
|
||||
echo "ℹ️ Copy /var/tmp/variables.env to /etc/bunkerweb/variables.env"
|
||||
do_and_check_cmd cp -f /var/tmp/variables.env /etc/bunkerweb/variables.env
|
||||
echo "ℹ️ Copy /var/tmp/ui.env to /etc/bunkerweb/ui.env"
|
||||
|
@ -41,4 +41,4 @@ if [ -f /etc/os-release ]; then
|
|||
else
|
||||
echo "❌ Error: /etc/os-release not found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -193,4 +193,4 @@ case $1 in
|
|||
echo "Invalid option!"
|
||||
echo "List of options availables:"
|
||||
display_help
|
||||
esac
|
||||
esac
|
||||
|
|
|
@ -112,7 +112,7 @@ class LinuxTest(Test):
|
|||
setup = f"{test}/setup-linux.sh"
|
||||
if isfile(setup):
|
||||
proc = self.docker_exec(
|
||||
self.__distro, f"cd /opt/{self._name} && ./setup-linux.sh"
|
||||
self.__distro, f"cd /opt/{self._name} && ./setup-linux.sh && chmod -R nginx:nginx /etc/bunkerweb/configs"
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
raise Exception("docker exec setup failed (test)")
|
||||
|
|
Loading…
Reference in New Issue