various fixes

This commit is contained in:
bunkerity 2023-04-28 16:47:51 +02:00
parent fa67c5d7ba
commit 5e4ce45793
13 changed files with 48 additions and 48 deletions

View File

@ -100,18 +100,18 @@ jobs:
KUBECONFIG: "/tmp/k8s/kubeconfig"
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
IMAGE_TAG: "staging"
# - name: Run Linux ubuntu tests
# if: inputs.TYPE == 'linux'
# run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "ubuntu"
# env:
# TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
# ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}
# - name: Run Linux debian tests
# if: inputs.TYPE == 'linux'
# run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "debian"
# env:
# TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
# ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}
- name: Run Linux ubuntu tests
if: inputs.TYPE == 'linux'
run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "ubuntu"
env:
TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}
- name: Run Linux debian tests
if: inputs.TYPE == 'linux'
run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "debian"
env:
TEST_DOMAINS: ${{ secrets.TEST_DOMAINS_LINUX }}
ROOT_DOMAIN: ${{ secrets.ROOT_DOMAIN }}
# - name: Run Linux centos tests
# if: inputs.TYPE == 'linux'
# run: export $(echo "$TEST_DOMAINS" | xargs) && ./tests/main.py "linux" "centos"

View File

@ -3,7 +3,7 @@
## Overview
<p align="center">
<iframe style="display: block;" width="560" height="315" src="https://www.youtube-nocookie.com/embed/2n4EarhW7-Y" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe style="display: block;" width="560" height="315" src="https://www.youtube-nocookie.com/embed/Ao20SfvQyr4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</p>
The "Web UI" is a web application that helps you manage your BunkerWeb instance using a user-friendly interface instead of the command-line one.

View File

@ -61,7 +61,7 @@ services:
- MAGENTO_ENABLE_HTTPS=yes
- MAGENTO_ENABLE_ADMIN_HTTPS=yes
- MAGENTO_DATABASE_HOST=mydb
- MAGENTO_DATABASE_NAME=mangentodb
- MAGENTO_DATABASE_NAME=magentodb
- MAGENTO_DATABASE_USER=user
- MAGENTO_DATABASE_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
- ELASTICSEARCH_HOST=myelasticsearch

View File

@ -48,11 +48,11 @@ api.global.POST["^/confs$"] = function(self)
elseif ngx.ctx.bw.uri == "/data" then
destination = "/data"
elseif ngx.ctx.bw.uri == "/cache" then
destination = "/data/cache"
destination = "/var/cache/bunkerweb"
elseif ngx.ctx.bw.uri == "/custom_configs" then
destination = "/data/configs"
destination = "/etc/bunkerweb/configs"
elseif ngx.ctx.bw.uri == "/plugins" then
destination = "/data/plugins"
destination = "/etc/bunkerweb/plugins"
end
local form, err = upload:new(4096)
if not form then

View File

@ -5,7 +5,7 @@ init_worker_by_lua_block {
-- Our timer function
local ready_log = function(premature)
-- Instantiate objects
local logger = require "bunkerweb.logger":new("INIT-STREAM")
local logger = require "bunkerweb.logger":new("INIT")
local datastore = require "bunkerweb.datastore":new()
-- Don't print the ready log if we are in loading state
local is_loading, err = require "bunkerweb.utils".get_variable("IS_LOADING", false)

View File

@ -5,8 +5,8 @@
listen 0.0.0.0:{{ HTTPS_PORT }} ssl {% if HTTP2 == "yes" %}http2{% endif %} {% if USE_PROXY_PROTOCOL == "yes" %}proxy_protocol{% endif %};
# TLS config
ssl_certificate /data/cache/customcert/{{ CUSTOM_SSL_CERT.replace("/", "_") }};
ssl_certificate_key /data/cache/customcert/{{ CUSTOM_SSL_KEY.replace("/", "_") }};
ssl_certificate {{ CUSTOM_SSL_CERT }};
ssl_certificate_key {{ CUSTOM_SSL_KEY }};
ssl_protocols {{ SSL_PROTOCOLS }};
ssl_prefer_server_ciphers on;
ssl_session_tickets off;

View File

@ -1,12 +1,12 @@
{% set os_path = import("os.path") %}
{% if USE_CUSTOM_SSL == "yes" and os_path.isfile("/data/cache/customcert/{}".format(CUSTOM_SSL_CERT.replace("/", "_"))) and os_path.isfile("/data/cache/customcert/{}".format(CUSTOM_SSL_KEY.replace("/", "_"))) +%}
{% if USE_CUSTOM_SSL == "yes" and os_path.isfile(CUSTOM_SSL_CERT) and os_path.isfile(CUSTOM_SSL_KEY) +%}
# listen
listen 0.0.0.0:{{ LISTEN_STREAM_PORT_SSL }} ssl {% if USE_UDP == "yes" %} udp {% endif %}{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
# TLS config
ssl_certificate /data/cache/customcert/{{ CUSTOM_SSL_CERT.replace("/", "_") }};
ssl_certificate_key /data/cache/customcert/{{ CUSTOM_SSL_KEY.replace("/", "_") }};
ssl_certificate {{ CUSTOM_SSL_CERT }};
ssl_certificate_key {{ CUSTOM_SSL_KEY }};
ssl_protocols {{ SSL_PROTOCOLS }};
ssl_prefer_server_ciphers on;
ssl_session_tickets off;

View File

@ -40,13 +40,13 @@ def install_plugin(plugin_dir) -> bool:
with open(f"{plugin_dir}/plugin.json", "rb") as f:
metadata = loads(f.read())
# Don't go further if plugin is already installed
if Path(f"/data/plugins/{metadata['id']}/plugin.json").is_file():
if Path(f"/etc/bunkerweb/plugins/{metadata['id']}/plugin.json").is_file():
logger.warning(
f"Skipping installation of plugin {metadata['id']} (already installed)",
)
return False
# Copy the plugin
copytree(plugin_dir, f"/data/plugins/{metadata['id']}")
copytree(plugin_dir, f"/etc/bunkerweb/plugins/{metadata['id']}")
# Add u+x permissions to jobs files
for job_file in glob(f"{plugin_dir}/jobs/*"):
st = stat(job_file)
@ -118,8 +118,8 @@ try:
external_plugins = []
external_plugins_ids = []
for plugin in listdir("/data/plugins"):
path = f"/data/plugins/{plugin}"
for plugin in listdir("/etc/bunkerweb/plugins"):
path = f"/etc/bunkerweb/plugins/{plugin}"
if not Path(f"{path}/plugin.json").is_file():
logger.warning(f"Plugin {plugin} is not valid, deleting it...")
rmtree(path)

View File

@ -43,11 +43,11 @@ try:
# Cluster case
if bw_integration in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
# Create tarball of /data/cache/letsencrypt
# Create tarball of /var/cache/bunkerweb/letsencrypt
tgz = BytesIO()
with tar_open(mode="w:gz", fileobj=tgz) as tf:
tf.add("/data/cache/letsencrypt", arcname=".")
tf.add("/var/cache/bunkerweb/letsencrypt", arcname=".")
tgz.seek(0, 0)
files = {"archive.tar.gz": tgz}

View File

@ -169,12 +169,12 @@ class JobScheduler(ApiCaller):
if reload:
try:
if self._get_apis():
self.__logger.info("Sending /data/cache folder ...")
if not self._send_files("/data/cache", "/cache"):
self.__logger.info("Sending /var/cache/bunkerweb folder ...")
if not self._send_files("/var/cache/bunkerweb", "/cache"):
success = False
self.__logger.error("Error while sending /data/cache folder")
self.__logger.error("Error while sending /var/cache/bunkerweb folder")
else:
self.__logger.info("Successfully sent /data/cache folder")
self.__logger.info("Successfully sent /var/cache/bunkerweb folder")
if not self.__reload():
success = False
except:

View File

@ -95,7 +95,7 @@ def generate_custom_configs(
integration: str,
api_caller: ApiCaller,
*,
original_path: str = "/data/configs",
original_path: str = "/etc/bunkerweb/configs",
):
Path(original_path).mkdir(parents=True, exist_ok=True)
for custom_config in custom_configs:
@ -108,7 +108,7 @@ def generate_custom_configs(
if integration in ("Autoconf", "Swarm", "Kubernetes", "Docker"):
logger.info("Sending custom configs to BunkerWeb")
ret = api_caller._send_files("/data/configs", "/custom_configs")
ret = api_caller._send_files("/etc/bunkerweb/configs", "/custom_configs")
if not ret:
logger.error(
@ -121,7 +121,7 @@ def generate_external_plugins(
integration: str,
api_caller: ApiCaller,
*,
original_path: str = "/data/plugins",
original_path: str = "/etc/bunkerweb/plugins",
):
Path(original_path).mkdir(parents=True, exist_ok=True)
for plugin in plugins:
@ -139,7 +139,7 @@ def generate_external_plugins(
if integration in ("Autoconf", "Swarm", "Kubernetes", "Docker"):
logger.info("Sending plugins to BunkerWeb")
ret = api_caller._send_files("/data/plugins", "/plugins")
ret = api_caller._send_files("/etc/bunkerweb/plugins", "/plugins")
if not ret:
logger.error(
@ -372,11 +372,11 @@ if __name__ == "__main__":
try:
if len(api_caller._get_apis()) > 0:
# send cache
logger.info("Sending /data/cache folder ...")
if not api_caller._send_files("/data/cache", "/cache"):
logger.error("Error while sending /data/cache folder")
logger.info("Sending /var/cache/bunkerweb folder ...")
if not api_caller._send_files("/var/cache/bunkerweb", "/cache"):
logger.error("Error while sending /var/cache/bunkerweb folder")
else:
logger.info("Successfully sent /data/cache folder")
logger.info("Successfully sent /var/cache/bunkerweb folder")
# restart nginx
if integration not in ("Autoconf", "Swarm", "Kubernetes", "Docker"):
@ -452,7 +452,7 @@ if __name__ == "__main__":
# Remove old custom configs files
logger.info("Removing old custom configs files ...")
for file in glob("/data/configs/*"):
for file in glob("/etc/bunkerweb/configs/*"):
if Path(file).is_symlink() or Path(file).is_file():
Path(file).unlink()
elif Path(file).is_dir():
@ -496,7 +496,7 @@ if __name__ == "__main__":
# Remove old external plugins files
logger.info("Removing old external plugins files ...")
for file in glob("/data/plugins/*"):
for file in glob("/etc/bunkerweb/plugins/*"):
if Path(file).is_symlink() or Path(file).is_file():
Path(file).unlink()
elif Path(file).is_dir():

View File

@ -12,7 +12,7 @@ from utils import path_to_dict
def generate_custom_configs(
custom_configs: List[Dict[str, Any]],
*,
original_path: str = "/data/configs",
original_path: str = "/etc/bunkerweb/configs",
):
Path(original_path).mkdir(parents=True, exist_ok=True)
for custom_config in custom_configs:
@ -41,7 +41,7 @@ class ConfigFiles:
if custom_configs:
self.__logger.info("Refreshing custom configs ...")
# Remove old custom configs files
for file in glob("/data/configs/*"):
for file in glob("/etc/bunkerweb/configs/*"):
if Path(file).is_symlink() or Path(file).is_file():
Path(file).unlink()
elif Path(file).is_dir():

View File

@ -15,9 +15,9 @@ class SwarmTest(Test):
self._domains = {
r"www\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1_1')}",
r"auth\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1_2')}",
r"app1\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1_1')}",
r"app2\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1_2')}",
r"app3\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1_3')}",
r"app1\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN1')}",
r"app2\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN2')}",
r"app3\.example\.com": f"{Test.random_string(6)}.{getenv('TEST_DOMAIN3')}",
}
@staticmethod