From 1e38559f5fead15b1ba49fab876385dbe0bd14ab Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:49:30 +1000 Subject: [PATCH 1/8] Update server.py --- server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server.py b/server.py index 7fc4d5b40..1ba989f0a 100644 --- a/server.py +++ b/server.py @@ -150,6 +150,7 @@ async def start_vue_dev_server(): def configure_magma_env_file(): logging.info("Setting VueJS environment file.") url = BaseWorld.get_config("app.frontend.api_base_url") + logging.info(f"Successfuly set {url} as base url.") with open(f"{MAGMA_PATH}/.env", "w") as fp: fp.write(f"VITE_CALDERA_URL={url}") From 914755f8829637fb6b592c7030ca62aa10486088 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:02:20 +1000 Subject: [PATCH 2/8] Update server.py Able to log in on docker --- server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.py b/server.py index 1ba989f0a..0da4584b5 100644 --- a/server.py +++ b/server.py @@ -267,10 +267,9 @@ def list_str(values): subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) logging.info("VueJS front-end build complete.") app_svc.application.on_response_prepare.append(enable_cors) - + configure_magma_env_file() if args.build: if len(os.listdir(MAGMA_PATH)) > 0: - configure_magma_env_file() logging.info("Building VueJS front-end.") subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True) subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) From d0f8daf991c185204acfe395fee12ae40cd87e25 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:31:04 +1000 Subject: [PATCH 3/8] Update Dockerfile allows server to be built and actually usable on docker --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6bf1cd6f..696cfd2dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,8 +83,7 @@ RUN apt-get update && \ # Directly use npm to install dependencies and build the application (cd plugins/magma && npm install) && \ (cd plugins/magma && npm run build) && \ - # Remove Node.js, npm, and other unnecessary packages - apt-get remove -y nodejs npm && \ + # Remove unnecessary packages (excluding nodejs and npm) apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From 1a2c95097462147631e9f96d3f8ba6e4c5ab7dde Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:31:53 +1000 Subject: [PATCH 4/8] Update server.py --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 0da4584b5..2c5d50673 100644 --- a/server.py +++ b/server.py @@ -266,9 +266,9 @@ def list_str(values): logging.info("Building VueJS front-end.") subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) logging.info("VueJS front-end build complete.") - app_svc.application.on_response_prepare.append(enable_cors) - configure_magma_env_file() + app_svc.application.on_response_prepare.append(enable_cors) if args.build: + configure_magma_env_file() if len(os.listdir(MAGMA_PATH)) > 0: logging.info("Building VueJS front-end.") subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True) From 41782d98df8904d16db0d1cd9b9d80f072ca6483 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:47:34 +1000 Subject: [PATCH 5/8] Update server.py --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 2c5d50673..b30e63227 100644 --- a/server.py +++ b/server.py @@ -268,8 +268,8 @@ def list_str(values): logging.info("VueJS front-end build complete.") app_svc.application.on_response_prepare.append(enable_cors) if args.build: - configure_magma_env_file() if len(os.listdir(MAGMA_PATH)) > 0: + configure_magma_env_file() logging.info("Building VueJS front-end.") subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True) subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) From 6c2070969743155f0b5482c854274322472de1d5 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:50:26 +1000 Subject: [PATCH 6/8] Update README.md add the build arg --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5e813263..e946c20b3 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ cd caldera docker build . --build-arg WIN_BUILD=true -t caldera:latest # Run the image. Change port forwarding configuration as desired. -docker run -p 8888:8888 caldera:latest +docker run -p 8888:8888 caldera:latest --build ``` To gracefully terminate your docker container, do the following: From 96e7b22b8909c2d27f9530d8b05c8e406617a4c0 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:52:59 +1000 Subject: [PATCH 7/8] Update Dockerfile clear up non needed tasks --- Dockerfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 696cfd2dd..a6ccd47db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,14 +79,7 @@ WORKDIR /usr/src/app # Install Node.js, npm, and other build VueJS front-end RUN apt-get update && \ - apt-get install -y nodejs npm && \ - # Directly use npm to install dependencies and build the application - (cd plugins/magma && npm install) && \ - (cd plugins/magma && npm run build) && \ - # Remove unnecessary packages (excluding nodejs and npm) - apt-get autoremove -y && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + apt-get install -y nodejs npm WORKDIR /usr/src/app From aa8945f6551ffe7d12b263a24f088b255f108b80 Mon Sep 17 00:00:00 2001 From: Ali El-Cheikh <50736129+Blipblopblopblop@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:23:59 +1000 Subject: [PATCH 8/8] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6ccd47db..a402ebfe5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,9 +27,9 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" # Install pip requirements RUN pip3 install --no-cache-dir -r requirements.txt -# Set up config file and disable atomic by default -RUN python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();"; \ - sed -i '/\- atomic/d' conf/local.yml; +# Set up config file and dont disable atomic by default +RUN python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();" + # Compile default sandcat agent binaries, which will download basic golang dependencies.