Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for volumes #63

Open
zackees opened this issue Mar 9, 2024 · 7 comments
Open

Add support for volumes #63

zackees opened this issue Mar 9, 2024 · 7 comments

Comments

@zackees
Copy link

zackees commented Mar 9, 2024

How can one enable volume so that we can use this app past any container redeploy

@jelveh
Copy link
Contributor

jelveh commented Mar 9, 2024

@KernelDeimos

@KernelDeimos
Copy link
Contributor

KernelDeimos commented Mar 9, 2024

The -v flag of the docker command can create bind mounts or volume mounts. You may need to make some changes to the Dockerfile in the repo; for example you might need to comment out COPY . . so you can mount to /opt/puter/app.

If you're using docker-compose, you can add this:

    volumes:
      - type: bind
        source: .
        target: /opt/puter/app

I haven't tested using "." as source so there may be some trial and error involved. I'm more familiar with bind mounts than volume mounts so that's why I used that as my example, but to create a volume mount my understanding is you change type to volume and specify a volume name as the source rather than a path. The Docker documentation is a good resource for this.

@KernelDeimos
Copy link
Contributor

Hello again - did my answer earlier help?

@zackees
Copy link
Author

zackees commented Apr 11, 2024

Hi there, thanks for your suggestion. Unfortunately it doesn't work on my windows box. Nor does it work if I add a disk on render.com for the path, which isn't surprising since I have to mount the entire code directory instead of an empty datadirectory.

Is it possible for there to be an empty root data directory in puter that I can just set a disk to?

---
version: "3.8"
services:
  puter:
    container_name: puter
    image: ghcr.io/heyputer/puter:latest
    pull_policy: always
    # build: ./
    restart: unless-stopped
    ports:
      - '4100:4100'
    environment:
      # TZ: Europe/Paris
      # CONFIG_PATH: /etc/puter
      PUID: 1000
      PGID: 1000
    volumes:
      - ./puter/config:/etc/puter
      - ./puter/data:/var/puter
      - type: bind
        source: .
        target: /opt/puter/app
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 30s

Error message:

PS C:\Users\niteris\dev\puter> docker compose up  
[+] Running 1/1
 ✔ puter Pulled                                                                                                            0.9s 
[+] Running 2/2
 ✔ Network puter_default  Created                                                                                          0.1s 
 ✔ Container puter        Created                                                                                          0.1s 
Attaching to puter
puter  | 
puter  | > puter.com@1.0.0 start
puter  | > node run-selfhosted.js
puter  | 
puter  | file:///opt/puter/app/run-selfhosted.js:131
puter  |             if ( oc_call(oc(e, message, includes), error_help.text) ) {
puter  |             ^
puter  | 
puter  | ReferenceError: oc_call is not defined
puter  |     at file:///opt/puter/app/run-selfhosted.js:131:13
puter  | 
puter  | Node.js v21.7.3
puter exited with code 0

Also. I went ahead and tried to run this on Render.com with the disk option. I set the disk to /opt/puter/app, which isn't surprising:

npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_09_16_370Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_14_27_729Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_19_30_369Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_24_39_319Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_29_44_320Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_34_53_347Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_40_05_327Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_45_13_426Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_50_19_433Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T19_55_21_347Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_00_33_336Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_05_39_446Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_10_49_424Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_15_50_324Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_20_59_317Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_26_13_342Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_31_21_333Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_36_31_326Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_41_35_333Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_46_36_356Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_51_42_705Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T20_56_55_339Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T21_02_03_460Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T21_07_09_455Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T21_12_14_257Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T21_17_24_429Z-debug-0.log
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/puter/app/package.json
npm ERR! errno -2
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/opt/puter/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: /home/node/.npm/_logs/2024-04-11T21_22_26_317Z-debug-0.lo

@zackees
Copy link
Author

zackees commented Apr 11, 2024

Also, I want to mention that puter worked fine on Render.com (and I assume DigitalOcean) (minus a persistent volume) but the latest version refuses to go live. This is the log file that I'm getting from the service, which simply repeats over and over again:

puter> 
[ Dev Console ]
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                     ┃
┃  Puter is now live at: �]8;;http://puter.localhost:4000�\http://puter.localhost:4000�]8;;�\  ┃
┃  Type web:dismiss to dismiss this message           ┃
┃                                                     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  Your default user has been created!           ┃
┃  username: default_user                        ┃
┃  password: 1f15c7d4                            ┃
┃  (change the password to remove this message)  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
puter> 
[ Dev Console ]
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                     ┃
┃  Puter is now live at: �]8;;http://puter.localhost:4000�\http://puter.localhost:4000�]8;;�\  ┃
┃  Type web:dismiss to dismiss this message           ┃
┃                                                     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  Your default user has been created!           ┃
┃  username: default_user                        ┃
┃  password: 1f15c7d4                            ┃
┃  (change the password to remove this message)  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
puter> 
[ Dev Console ]
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                     ┃
┃  Puter is now live at: �]8;;http://puter.localhost:4000�\http://puter.localhost:4000�]8;;�\  ┃
┃  Type web:dismiss to dismiss this message           ┃
┃                                                     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  Your default user has been created!           ┃
┃  username: default_user                        ┃
┃  password: 1f15c7d4                            ┃
┃  (change the password to remove this message)  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Here is the failed service:
http://puter.onrender.com/

image

@zackees
Copy link
Author

zackees commented Apr 11, 2024

I did a curl command:

curl -L --head https://puter.onrender.com/

And I get this output:

HTTP/1.1 301 Moved Permanently
Date: Thu, 11 Apr 2024 21:33:30 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Location: http://puter.onrender.com/
CF-Ray: 872e1869b9e415ef-SJC
CF-Cache-Status: DYNAMIC
Strict-Transport-Security: max-age=15552000; includeSubDomains
Vary: Accept, Accept-Encoding, Accept-Encoding
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
access-control-allow-methods: GET, POST, OPTIONS, PUT, PATCH, DELETE
cross-origin-resource-policy: cross-origin
rndr-id: 970bf637-bddf-411b
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-render-origin-server: Render
x-xss-protection: 0
Server: cloudflare
alt-svc: h3=":443"; ma=86400

@zackees
Copy link
Author

zackees commented Apr 15, 2024

I see in the code that there are two mappings for configurations and data.

Can we please please put this into one root folder? It's so close to working on Render.com with just a point and click install. I'm assuming a similar case would exist for AWS. All other options require engineering something for the deploy step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants