From ab4f222e92a693ecbc6c465dc82025941ee6a6f2 Mon Sep 17 00:00:00 2001 From: Sylvain Huguet Date: Sun, 31 Mar 2024 11:18:03 +0200 Subject: [PATCH 1/5] Add support for self-hosting in Docker --- .dockerignore | 2 ++ .gitignore | 4 +++- Dockerfile | 10 ++++++---- docker-compose.yml | 28 +++++++++++++++++++++++----- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index a9c8231f..74df5ffb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ .dockerignore Dockerfile node_modules +config +data \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6988d808..f0e514d9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ dist/ .vscode/ .env # this is for jetbrain IDEs -.idea/ \ No newline at end of file +.idea/ +config +data \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a33734e9..e19bafbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,10 @@ FROM node:21-alpine # Set labels LABEL repo="https://github.com/HeyPuter/puter" LABEL license="AGPL-3.0,https://github.com/HeyPuter/puter/blob/master/LICENSE.txt" -LABEL version="v1.2.40-beta" +LABEL version="1.2.46-beta-1" -# Debugging -RUN apk add --no-cache bash # useful for debugging +# Install git (required by Puter to check version) +RUN apk add --no-cache git # Setup working directory RUN mkdir -p /opt/puter/app @@ -24,7 +24,9 @@ USER node RUN npm cache clean --force \ && npm install -EXPOSE 4000 +EXPOSE 4100 +HEALTHCHECK --interval=5m --timeout=3s \ + CMD wget --no-verbose --tries=1 --spider http://localhost:4100/ || exit 1 CMD [ "npm", "start" ] diff --git a/docker-compose.yml b/docker-compose.yml index 47dc2947..c605748a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,25 @@ -version: '3' - +--- +version: "3.8" services: - app: - build: ./ + puter: + container_name: puter + image: ghcr.io/heyputer/puter:latest + pull_policy: always + # build: ./ + restart: unless-stopped ports: - - 4000:4000 + - '4100:4100' + environment: + # TZ: Europe/Paris + # CONFIG_PATH: /etc/puter + PUID: 1000 + PGID: 1000 + volumes: + - ./config:/opt/puter/app/volatile/config + - ./data:/opt/puter/app/volatile/runtime + healthcheck: + test: wget --no-verbose --tries=1 --spider http://localhost:4100 || exit 1 + interval: 5m + timeout: 3s + retries: 3 + start_period: 2m \ No newline at end of file From 5e1d6a7db36cd38f84f68fa78074b552300262f3 Mon Sep 17 00:00:00 2001 From: Sylvain Huguet Date: Sun, 31 Mar 2024 11:19:35 +0200 Subject: [PATCH 2/5] Disable healthcheck until we know the proper URL to call/check --- docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c605748a..86754f82 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,9 +17,9 @@ services: volumes: - ./config:/opt/puter/app/volatile/config - ./data:/opt/puter/app/volatile/runtime - healthcheck: - test: wget --no-verbose --tries=1 --spider http://localhost:4100 || exit 1 - interval: 5m - timeout: 3s - retries: 3 - start_period: 2m \ No newline at end of file + # healthcheck: + # test: wget --no-verbose --tries=1 --spider http://localhost:4100 || exit 1 + # interval: 5m + # timeout: 3s + # retries: 3 + # start_period: 2m \ No newline at end of file From daa90286d341d0d8674a0e8235354b5d8b9cc718 Mon Sep 17 00:00:00 2001 From: Sylvain Huguet Date: Sun, 31 Mar 2024 11:30:12 +0200 Subject: [PATCH 3/5] Update README instruction to run either with pure Docker, or with Docker Compose --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db4509d5..6a122e7c 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,14 @@ This will launch Puter at http://localhost:4000 (or the next available port). ### Using Docker ```bash -git clone https://github.com/HeyPuter/puter -cd puter +docker run --rm -p 4100:4100 -v `pwd`/data:/opt/puter/app/volatile/runtime -v `pwd`/config:/opt/puter/app/volatile/config ghcr.io/heyputer/puter +``` + +### Using Docker Compose + +```bash +mkdir puter && cd puter +wget https://raw.githubusercontent.com/HeyPuter/puter/main/docker-compose.yml docker compose up ``` From 483e2835c44dcb58f0456ea5cd6ad1220c9c4f43 Mon Sep 17 00:00:00 2001 From: Sylvain Huguet Date: Sun, 31 Mar 2024 11:34:03 +0200 Subject: [PATCH 4/5] Disable healthcheck in Dockerfile as well --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e19bafbe..40029c83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN npm cache clean --force \ EXPOSE 4100 -HEALTHCHECK --interval=5m --timeout=3s \ - CMD wget --no-verbose --tries=1 --spider http://localhost:4100/ || exit 1 +# HEALTHCHECK --interval=5m --timeout=3s \ +# CMD wget --no-verbose --tries=1 --spider http://localhost:4100/ || exit 1 CMD [ "npm", "start" ] From cc648be8548f288dbf9c799cc082d596ad09713c Mon Sep 17 00:00:00 2001 From: Sylvain Huguet Date: Mon, 1 Apr 2024 02:07:44 +0200 Subject: [PATCH 5/5] Re-enable healthchecks, adjusted intervals & start-time --- Dockerfile | 4 ++-- docker-compose.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 40029c83..8ccd879b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN npm cache clean --force \ EXPOSE 4100 -# HEALTHCHECK --interval=5m --timeout=3s \ -# CMD wget --no-verbose --tries=1 --spider http://localhost:4100/ || exit 1 +HEALTHCHECK --interval=30s --timeout=3s \ + CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1 CMD [ "npm", "start" ] diff --git a/docker-compose.yml b/docker-compose.yml index 86754f82..7630d5a3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,9 +17,9 @@ services: volumes: - ./config:/opt/puter/app/volatile/config - ./data:/opt/puter/app/volatile/runtime - # healthcheck: - # test: wget --no-verbose --tries=1 --spider http://localhost:4100 || exit 1 - # interval: 5m - # timeout: 3s - # retries: 3 - # start_period: 2m \ No newline at end of file + healthcheck: + test: wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1 + interval: 30s + timeout: 3s + retries: 3 + start_period: 30s