From ab5fafc3df2250e8807bba466c873cbb5e6e59af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 09:52:30 +0000 Subject: [PATCH 1/9] add gitignore for cert files --- docker/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 docker/.gitignore diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000000..373c9ef890 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1 @@ +./certs/* From 78c1c06dba97bc9da8e969ffc8ff68bf65205e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 09:52:56 +0000 Subject: [PATCH 2/9] basic docker config --- docker/Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++ docker/docker-compose.yaml | 25 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yaml diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..6f97c4ef79 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,44 @@ +FROM ubuntu:noble + +RUN mkdir -p /build + +WORKDIR /build + +RUN apt update +RUN apt install git -y +RUN apt install curl -y +RUN apt install wget -y +RUN apt-get install build-essential -y + + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash +RUN . /root/.nvm/nvm.sh ; nvm install 18 +RUN . /root/.nvm/nvm.sh ; nvm use 18 +RUN . /root/.nvm/nvm.sh ; corepack enable +RUN . /root/.nvm/nvm.sh ; corepack prepare yarn@4.4.0 --activate + +RUN wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz +RUN tar -C /usr/local/ -xzf go1.23.5.linux-amd64.tar.gz +RUN export PATH=$PATH:/usr/local/go/bin + + + + +RUN git clone https://github.com/OpenMaxIO/openmaxio-object-browser + +WORKDIR /build/openmaxio-object-browser/web-app/ + +RUN git checkout v1.7.6 + +RUN . /root/.nvm/nvm.sh ; yarn install +RUN . /root/.nvm/nvm.sh ; yarn build + +WORKDIR /build/openmaxio-object-browser +RUN export PATH=$PATH:/usr/local/go/bin ; make console + + + +expose 9090 + + +CMD [ "/build/openmaxio-object-browser/console", "server" ] diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000000..f5696c4098 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + openmaxio: + build: + context: . + dockerfile: Dockerfile + ports: + - "9090:9090" + environment: + - CONSOLE_MINIO_SERVER=http[s]://your_minio_instance:9000 + restart: unless-stopped + + nginx: + image: nginx:alpine + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./certs/minio.crt:/cert.crt:ro + - ./certs/minio.key:/cert.key:ro + depends_on: + - openmaxio + restart: unless-stopped From af0fafb0ccbfb84e55199b2a6e8e5c070a5beff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 09:53:19 +0000 Subject: [PATCH 3/9] generate self signed certs for testing --- docker/generate_certs.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docker/generate_certs.sh diff --git a/docker/generate_certs.sh b/docker/generate_certs.sh new file mode 100644 index 0000000000..0660ab2585 --- /dev/null +++ b/docker/generate_certs.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +cd $SCRIPT_DIR + +mkdir -p certs + +openssl req -x509 -nodes -days 365 \ + -newkey rsa:2048 \ + -keyout certs/minio.key \ + -out certs/minio.crt \ + -subj "/CN=openmaxio" From 00ff16fb0611030d5ebbd5a9fa30d71e5b087a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 09:53:31 +0000 Subject: [PATCH 4/9] basic nginx config --- docker/nginx/nginx.conf | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docker/nginx/nginx.conf diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000000..3f6a750383 --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,23 @@ +events {} + +http { + server { + listen 80; + return 301 https://$host$request_uri; + + + } + + server { + listen 443 ssl; + + ssl_certificate /cert.crt; + ssl_certificate_key /cert.key; + + location / { + proxy_pass http://openmaxio:9090; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } +} From 9ceb0289ae0c042e8ae43d989885a85760e399b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 09:53:51 +0000 Subject: [PATCH 5/9] basic instruction --- docker/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docker/README.md diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000..1176e12378 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,32 @@ +# OpenMaxIO in docker + +### Prereqs +I assume this is being run on linux, if being run on windows you will need to generate certs diffirently + +### Configuration + +Set the location of minio: +docker-compose.yaml +- You need to set the "services/openmaxio/environment/CONSOLE_MINIO_SERVER" variable to your minio endpoint + +Use valid certs: +- If you want to use proper certs, place the cert and key in ./certs/minio.crt and ./certs/minio.key + +Set other environment variables: +- If you want to set further environment variables for minio, in docker-compose.yaml place them in "services/openmaxio/environment/" + + +### How to run + +``` + +cd docker +# if using the self-signed certs, run the following line, if using proper certs, skip it +./generate_certs.sh +docker compose up -d + +``` + +### Notes: +This is not the best aproach, I am using a farily "bloated" image here and not cleaning up the build tools afterwards +I am hoping this can be a jumping-off point for someone to make a better version of this From de304771161f5eed587c5f29015daff325f23d95 Mon Sep 17 00:00:00 2001 From: Gbit <34913299+gbit-is@users.noreply.github.com> Date: Fri, 11 Jul 2025 09:56:38 +0000 Subject: [PATCH 6/9] add docker info to Readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3c29d2d49b..3b13fbb06a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ make console ./console server ``` +# Run OpenMAXIO UI in docker: + [Docker Instructions](docker/). + # To connect OpenMaxIO UI to an existing Minio server run this command (replace 1.2.3.4:9000 to your address) ```bash From 56551f9beff737f2dcec00a7d4ff5e35f51ddee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 13:38:29 +0000 Subject: [PATCH 7/9] Use multistage build for a cleaner image --- docker/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6f97c4ef79..fef5e95258 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,9 +36,11 @@ RUN . /root/.nvm/nvm.sh ; yarn build WORKDIR /build/openmaxio-object-browser RUN export PATH=$PATH:/usr/local/go/bin ; make console +FROM scratch +COPY --from=0 /build/openmaxio-object-browser/console /bin/console -expose 9090 +expose 9090 -CMD [ "/build/openmaxio-object-browser/console", "server" ] +CMD [ "/bin/console", "server" ] From 7e7d3db0234fbaf25ed7d2e71c270ab553311cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 13:38:41 +0000 Subject: [PATCH 8/9] enable websockets for file browser --- docker/nginx/nginx.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 3f6a750383..719ab82fec 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -5,17 +5,22 @@ http { listen 80; return 301 https://$host$request_uri; - + } server { listen 443 ssl; + client_max_body_size 100000M; + ssl_certificate /cert.crt; ssl_certificate_key /cert.key; location / { proxy_pass http://openmaxio:9090; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } From 8ec4dca428d0dfa25b228b34faec47570f068ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0r=C3=BAn=20=C3=93lafsd=C3=B3ttir?= Date: Fri, 11 Jul 2025 13:39:35 +0000 Subject: [PATCH 9/9] removing disclaimer of it being a terrible build --- docker/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 1176e12378..ad8d12edf5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -26,7 +26,3 @@ cd docker docker compose up -d ``` - -### Notes: -This is not the best aproach, I am using a farily "bloated" image here and not cleaning up the build tools afterwards -I am hoping this can be a jumping-off point for someone to make a better version of this