From f510f5037db431653270e5a8cdb3bdcd98c677d6 Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Fri, 4 Apr 2025 20:21:44 +0000 Subject: [PATCH 1/4] Bugfix: Place environment file in root of workspace --- assemblyline/.codesandbox/tasks.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/assemblyline/.codesandbox/tasks.json b/assemblyline/.codesandbox/tasks.json index 88b568547..e011faf08 100644 --- a/assemblyline/.codesandbox/tasks.json +++ b/assemblyline/.codesandbox/tasks.json @@ -2,15 +2,19 @@ // These tasks will run in order when initializing your CodeSandbox project. "setupTasks": [ { - "command": "git clone https://github.com/CybercentreCanada/assemblyline-docker-compose assemblyline", + "command": "if [ -d \"assemblyline\" ]; then git clone https://github.com/CybercentreCanada/assemblyline-docker-compose --depth 1 assemblyline; else cd fi", "name": "Clone the latest release of the Docker appliance" }, { - "command": "cd assemblyline && source .env && openssl req -nodes -x509 -newkey rsa:4096 -keyout ./config/nginx.key -out ./config/nginx.crt -days 365 -subj \"/C=CA/ST=Ontario/L=Ottawa/O=CCCS/CN=$DOMAIN\"", + "command": "ln -s assemblyline/.env", + "name": "Link environment file to local workspace" + }, + { + "command": "source .env && openssl req -nodes -x509 -newkey rsa:4096 -keyout ./assemblyline/config/nginx.key -out ./assemblyline/config/nginx.crt -days 365 -subj \"/C=CA/ST=Ontario/L=Ottawa/O=CCCS/CN=$DOMAIN\"", "name": "Generate self-signed certificates" }, { - "command": "cd assemblyline && docker compose pull elasticsearch_minimal redis minio ui_minimal frontend", + "command": "docker compose --project-directory assemblyline pull elasticsearch_minimal redis minio ui_minimal frontend", "name": "Pull required images" }, { @@ -23,11 +27,11 @@ }, { "name": "Start up minimal appliance", - "command": "cd assemblyline && cp .env /project/sandbox/.env && docker compose up -d elasticsearch_minimal redis minio ui_minimal frontend nginx_minimal" + "command": "docker compose --project-directory assemblyline up -d elasticsearch_minimal redis minio ui_minimal frontend nginx_minimal" }, { "name": "Bootstrap local user accounts", - "command": "cd assemblyline && docker compose -f bootstrap-compose.yaml up -d first_time_setup" + "command": "docker compose --project-directory assemblyline -f bootstrap-compose.yaml up -d first_time_setup" }, { "name": "Generate mock data", From 2a72bb17a2470286786c56e3baf4c48df488befa Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Fri, 4 Apr 2025 20:32:31 +0000 Subject: [PATCH 2/4] Fix embedded images in README --- assemblyline/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assemblyline/README.md b/assemblyline/README.md index cb93c654b..015c90d01 100644 --- a/assemblyline/README.md +++ b/assemblyline/README.md @@ -10,12 +10,12 @@ For more information on how to deploy the full version of Assemblyline (which al ### Accessing the UI CodeSandbox should already startup an instance of Assemblyline via the [.tasks](./.codesandbox/tasks.json) and you should see a preview exposed on port 4443. You can click on the "Open Preview in a new window" icon to access Assemblyline's UI within your browser. -![Open preview in a new tab](./images/open_preview.png) +![Open preview in a new tab](https://raw.githubusercontent.com/codesandbox/sandbox-templates/main/assemblyline/images/open_preview.png) ### Logging In You can sign into the local account using `admin` for both the username and password field. -![Default login credentials](./images/default_login.png) +![Default login credentials](https://raw.githubusercontent.com/codesandbox/sandbox-templates/main/assemblyline/images/default_login.png) ### What's Next? That's about it from me! You can explore the system to your heart's content 🤓. From 29b55f8efc24a1c771185060e8000ee6a4a9120f Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Fri, 4 Apr 2025 20:54:13 +0000 Subject: [PATCH 3/4] Update commands to not fail in CodeSandbox --- assemblyline/.codesandbox/tasks.json | 84 ++++++++++++++-------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/assemblyline/.codesandbox/tasks.json b/assemblyline/.codesandbox/tasks.json index e011faf08..a65133ae5 100644 --- a/assemblyline/.codesandbox/tasks.json +++ b/assemblyline/.codesandbox/tasks.json @@ -1,44 +1,44 @@ { - // These tasks will run in order when initializing your CodeSandbox project. - "setupTasks": [ - { - "command": "if [ -d \"assemblyline\" ]; then git clone https://github.com/CybercentreCanada/assemblyline-docker-compose --depth 1 assemblyline; else cd fi", - "name": "Clone the latest release of the Docker appliance" - }, - { - "command": "ln -s assemblyline/.env", - "name": "Link environment file to local workspace" - }, - { - "command": "source .env && openssl req -nodes -x509 -newkey rsa:4096 -keyout ./assemblyline/config/nginx.key -out ./assemblyline/config/nginx.crt -days 365 -subj \"/C=CA/ST=Ontario/L=Ottawa/O=CCCS/CN=$DOMAIN\"", - "name": "Generate self-signed certificates" - }, - { - "command": "docker compose --project-directory assemblyline pull elasticsearch_minimal redis minio ui_minimal frontend", - "name": "Pull required images" - }, - { - "command": "docker build nginx-ssl-frontend -t cccs/nginx-ssl-frontend", - "name": "Build NGINX image that's compatible with CodeSandbox" - }, - { - "command": "sed -i s/443:443/4443:443/g assemblyline/common/nginx.yaml", - "name": "Swap port forwarding to be compatible with CodeSandbox" - }, - { - "name": "Start up minimal appliance", - "command": "docker compose --project-directory assemblyline up -d elasticsearch_minimal redis minio ui_minimal frontend nginx_minimal" - }, - { - "name": "Bootstrap local user accounts", - "command": "docker compose --project-directory assemblyline -f bootstrap-compose.yaml up -d first_time_setup" - }, - { - "name": "Generate mock data", - "command": "docker exec ui python3 -m assemblyline.odm.random_data.create_test_data full" - } - ], + // These tasks will run in order when initializing your CodeSandbox project. + "setupTasks": [ + { + "command": "git clone https://github.com/CybercentreCanada/assemblyline-docker-compose --depth 1 assemblyline || true", + "name": "Clone the latest release of the Docker appliance" + }, + { + "command": "ln -s assemblyline/.env || true", + "name": "Link environment file to local workspace" + }, + { + "command": "source .env && openssl req -nodes -x509 -newkey rsa:4096 -keyout ./assemblyline/config/nginx.key -out ./assemblyline/config/nginx.crt -days 365 -subj \"/C=CA/ST=Ontario/L=Ottawa/O=CCCS/CN=$DOMAIN\"", + "name": "Generate self-signed certificates" + }, + { + "command": "docker compose --project-directory assemblyline pull elasticsearch_minimal redis minio ui_minimal frontend", + "name": "Pull required images" + }, + { + "command": "docker build nginx-ssl-frontend -t cccs/nginx-ssl-frontend", + "name": "Build NGINX image that's compatible with CodeSandbox" + }, + { + "command": "sed -i s/443:443/4443:443/g assemblyline/common/nginx.yaml", + "name": "Swap port forwarding to be compatible with CodeSandbox" + }, + { + "name": "Start up minimal appliance", + "command": "docker compose --project-directory assemblyline up -d elasticsearch_minimal redis minio ui_minimal frontend nginx_minimal" + }, + { + "name": "Bootstrap local user accounts", + "command": "docker compose --project-directory assemblyline -f bootstrap-compose.yaml up -d first_time_setup" + }, + { + "name": "Generate mock data", + "command": "docker exec ui python3 -m assemblyline.odm.random_data.create_test_data full" + } + ], - // These tasks can be run from CodeSandbox. Running one will open a log in the app. - "tasks": {} - } + // These tasks can be run from CodeSandbox. Running one will open a log in the app. + "tasks": {} +} From 98a65b3959887f4c497520dd3cd44f7424d70718 Mon Sep 17 00:00:00 2001 From: cccs-rs <62077998+cccs-rs@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:00:06 +0000 Subject: [PATCH 4/4] Patch the sed command --- assemblyline/.codesandbox/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assemblyline/.codesandbox/tasks.json b/assemblyline/.codesandbox/tasks.json index a65133ae5..06e607b59 100644 --- a/assemblyline/.codesandbox/tasks.json +++ b/assemblyline/.codesandbox/tasks.json @@ -22,7 +22,7 @@ "name": "Build NGINX image that's compatible with CodeSandbox" }, { - "command": "sed -i s/443:443/4443:443/g assemblyline/common/nginx.yaml", + "command": "sed -i 's/\"443:443\"/\"4443:443\"/g' assemblyline/common/nginx.yaml", "name": "Swap port forwarding to be compatible with CodeSandbox" }, {