snapp icon indicating copy to clipboard operation
snapp copied to clipboard

pre built docker image?

Open aniel300 opened this issue 8 months ago β€’ 17 comments

pre built docker image?

aniel300 avatar Apr 18 '25 10:04 aniel300

What are you asking?

There is the docker compose with instruction on readme

urania-dev avatar Apr 18 '25 12:04 urania-dev

i tried deploying and i couldn't reach the webui

aniel300 avatar Apr 18 '25 12:04 aniel300

could you try to use this and then reach http://localhost:3000

services:
  snapp:
    image: uraniadev/snapp:latest
    ports:
      - 3000:3000
    environment:
      DATABASE_URL: "file:./db.sqlite"
      DATABASE_PROVIDER: sqlite
      TOKEN_SECRET: putALongAndSecureSecretHere
      ORIGIN: http://localhost:3000

urania-dev avatar Apr 18 '25 13:04 urania-dev

ok i will try

aniel300 avatar Apr 20 '25 01:04 aniel300

Hey,

I'm running into an issue that may be related. When launching my container, it tries to update some packages but fails to do so:

0% [Connecting to deb.debian.org]
Temporary failure resolving 'deb.debian.org'
[...]
0 upgraded, 20 newly installed, 0 to remove and 1 not upgraded.
Need to get 2642 kB of archives.

Could you look into this please? πŸ™

deraw avatar Apr 29 '25 10:04 deraw

Well that happen cause the image need to install curl, i get some trouble shipping with It already installed.

That aside the message means the container couldnt connect to the internet? Is It possible?

Edit: arm or amd?

urania-dev avatar Apr 29 '25 14:04 urania-dev

Well that happen cause the image need to install curl, i get some trouble shipping with It already installed.

That aside the message means the container couldnt connect to the internet? Is It possible?

Edit: arm or amd?

I see, that explains it haha

Yes the container is behind a firewall that makes sure it's isolated, only the necessary ports are exposed, I could try to update those rules for this container It's running on arm

deraw avatar Apr 29 '25 16:04 deraw

let me know if it works as i have no arm machine to test it on directly πŸ˜†

urania-dev avatar Apr 29 '25 18:04 urania-dev

i still need to test

aniel300 avatar Apr 30 '25 12:04 aniel300

is it possible for persistent storage for both the db and the app settings?

aniel300 avatar Apr 30 '25 12:04 aniel300

let me know if it works as i have no arm machine to test it on directly πŸ˜†

Packages are installing correctly but I'm running into this error πŸ€”

at /app/build/server/chunks/index4.js:4:16
at new PrismaClient (/app/node_modules/.prisma/client/default.js:43:11)
error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
^
43 | throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');

deraw avatar Apr 30 '25 14:04 deraw

is it possible for persistent storage for both the db and the app settings?

you can persist sqlite just mounting the db, settings are stored there, the filesystem is untouched

services:
  snapp:
    image: uraniadev/snapp:latest
    ports:
      - 3000:3000
    volumes:
      - ./db.sqlite:/app/dbschema/sqlite/prisma/db.sqlite 
    environment:
      DATABASE_URL: "file:./db.sqlite"
      DATABASE_PROVIDER: sqlite
      TOKEN_SECRET: putALongAndSecureSecretHere
      ORIGIN: http://localhost:3000

to be sure just touch db.sqlite beside your docker-compose.yml

urania-dev avatar Apr 30 '25 19:04 urania-dev

let me know if it works as i have no arm machine to test it on directly πŸ˜†

Packages are installing correctly but I'm running into this error πŸ€”

at /app/build/server/chunks/index4.js:4:16
at new PrismaClient (/app/node_modules/.prisma/client/default.js:43:11)
error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
^
43 | throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');

i suppose that happens because it didn't run prisma generate, as it suggests. maybe cause the first run was not allowed to install, and the script interrupted: try to destroy the container, remove any volumes or cache, and re launch your docker compose, this way should install and load the dependencies, generate the schema, and launch the app. hopefully :)

urania-dev avatar Apr 30 '25 19:04 urania-dev

let me know if it works as i have no arm machine to test it on directly πŸ˜†

Packages are installing correctly but I'm running into this error πŸ€”

at /app/build/server/chunks/index4.js:4:16
at new PrismaClient (/app/node_modules/.prisma/client/default.js:43:11)
error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
^
43 | throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');

i suppose that happens because it didn't run prisma generate, as it suggests. maybe cause the first run was not allowed to install, and the script interrupted: try to destroy the container, remove any volumes or cache, and re launch your docker compose, this way should install and load the dependencies, generate the schema, and launch the app. hopefully :)

Error still occurs, but there is this one that appears earlier and that I didn't see at first: ENOENT: no such file or directory, open '/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma_schema_build_bg.wasm', I guess that's why prisma can't run

deraw avatar May 01 '25 12:05 deraw

Uhmmm. I'll look into this

urania-dev avatar May 01 '25 12:05 urania-dev

So fun fact one of my server was indeed arm and looks like working. I can't touch that instance cause is bound to work staff atm, but it seems it is not and arm specific issue as it works.

I'll keep you posted

urania-dev avatar May 08 '25 06:05 urania-dev

Sorry i know its been a while but there will be a couple of week before i can touch this.

Its busy busy time at work πŸ₯²

urania-dev avatar May 13 '25 06:05 urania-dev

trying to upload 0.9-rc-019 that should address this issue on curl installing on first load

urania-dev avatar Jun 01 '25 17:06 urania-dev

Hi, I'm joining this conversation because I also have the β€œprism generation” problem. I followed the instructions from mariushosting https://mariushosting.com/how-to-install-snapp-on-your-synology-nas/ to install Snapp via Portainer on my Synology NAS. These are the logs:


######## This Configuration require to regenerate Prisma Client
47 | `),b=v.shift();if(!b)return e.destroy(),n(new Error("No header received from proxy CONNECT response"));let D=b.split(" "),T=+D[1],P=D.slice(2).join(" "),O={};for(let R of v){if(!R)continue;let L=R.indexOf(":");if(L===-1)return e.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${R}"`));let k=R.slice(0,L).toLowerCase(),G=R.slice(L+1).trimStart(),J=O[k];typeof J=="string"?O[k]=[J,G]:Array.isArray(J)?J.push(G):O[k]=G}sT("got proxy server response: %o %o",b,O),u(),r({connect:{statusCode:T,statusText:P,headers:O},buffered:g})}e.on("error",l),e.on("end",c),a()})}d0.parseProxyResponse=zKe});var Doe=C(Ta=>{"use strict";var KKe=Ta&&Ta.__createBinding||(Object.create?function(e,r,n,i){i===void 0&&(i=n);var o=Object.getOwnPropertyDescriptor(r,n);(!o||("get"in o?!r.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return r[n]}}),Object.defineProperty(e,i,o)}:function(e,r,n,i){i===void 0&&(i=n),e[i]=r[n]}),JKe=Ta&&Ta.__setModuleDefault||(Object.create?function(e,r){Object.defineP
48 | `;if(i.username||i.password){let x=`${decodeURIComponent(i.username)}:${decodeURIComponent(i.password)}`;a["Proxy-Authorization"]=`Basic ${Buffer.from(x).toString("base64")}`}a.Host=`${u}:${n.port}`,a["Proxy-Connection"]||(a["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let x of Object.keys(a))c+=`${x}: ${a[x]}\r
49 | `;let l=(0,eJe.parseProxyResponse)(o);o.write(`${c}\r
50 | `);let{connect:p,buffered:f}=await l;if(r.emit("proxyConnect",p),this.emit("proxyConnect",p,r),p.statusCode===200)return r.once("socket",tJe),n.secureEndpoint?(Eb("Upgrading socket connection to TLS"),xoe.connect({...boe(voe(n),"host","path","port"),socket:o})):o;o.destroy();let g=new oT.Socket({writable:!1});return g.readable=!0,r.once("socket",x=>{Eb("Replaying proxy buffer for failed request"),(0,YKe.default)(x.listenerCount("data")>0),x.push(f),x.push(null)}),g}};aT.protocols=["http","https"];Ta.HttpsProxyAgent=aT;function tJe(e){e.resume()}function boe(e,...r){let n={},i;for(i in e)r.includes(i)||(n[i]=e[i]);return n}});var qoe=C((Boe,joe)=>{"use strict";Boe=joe.exports=m0;function m0(e,r){if(this.stream=r.stream||process.stderr,typeof r=="number"){var n=r;r={},r.total=n}else{if(r=r||{},typeof e!="string")throw new Error("format required");if(typeof r.total!="number")throw new Error("total required")}this.fmt=e,this.curr=r.curr||0,this.total=r.total,this.width=r.width||this.total,this.clear=r.clear,this.
51 | `),this.stream.write(this.lastDraw)};m0.prototype.terminate=function(){this.clear?this.stream.clearLine&&(this.stream.clearLine(),this.stream.cursorTo(0)):this.stream.write(`
52 | `)}});var Goe=C((nqt,Uoe)=>{"use strict";Uoe.exports=qoe()});var Hoe=C((sqt,uJe)=>{uJe.exports={name:"@prisma/fetch-engine",version:"6.9.0",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <[email protected]>",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/fetch-engine"},bugs:"https://github.com/prisma/prisma/issues",enginesOverride:{},devDependencies:{"@swc/core":"1.11.5","@swc/jest":"0.2.37","@types/jest":"29.5.14","@types/node":"18.19.76","@types/progress":"2.0.7",del:"6.1.1",execa:"5.1.1","find-cache-dir":"5.0.0","fs-extra":"11.3.0",hasha:"5.2.2","http-proxy-agent":"7.0.2","https-proxy-agent":"7.0.6",jest:"29.7.0",kleur:"4.1.5","node-fetch":"3.3.2","p-filter":"4.1.0","p-map":"4.0.0","p-retry":"4.6.2",progress:"2.0.3",rimraf:"6.0.1","strip-ansi":"6.0.1","temp-dir":"2.0.0",tempy:"1.0.1","timeout-signal":"2.0.0",typescript:"5.4.5"},dep
ENOENT: no such file or directory, open '/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma_schema_build_bg.wasm'
    path: "/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma_schema_build_bg.wasm",
 syscall: "open",
   errno: -2,
    code: "ENOENT"
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:52:10125)
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:2:263)
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:263:154)
Bun v1.2.15 (Linux x64 baseline)
47 | `),b=v.shift();if(!b)return e.destroy(),n(new Error("No header received from proxy CONNECT response"));let D=b.split(" "),T=+D[1],P=D.slice(2).join(" "),O={};for(let R of v){if(!R)continue;let L=R.indexOf(":");if(L===-1)return e.destroy(),n(new Error(`Invalid header from proxy CONNECT response: "${R}"`));let k=R.slice(0,L).toLowerCase(),G=R.slice(L+1).trimStart(),J=O[k];typeof J=="string"?O[k]=[J,G]:Array.isArray(J)?J.push(G):O[k]=G}sT("got proxy server response: %o %o",b,O),u(),r({connect:{statusCode:T,statusText:P,headers:O},buffered:g})}e.on("error",l),e.on("end",c),a()})}d0.parseProxyResponse=zKe});var Doe=C(Ta=>{"use strict";var KKe=Ta&&Ta.__createBinding||(Object.create?function(e,r,n,i){i===void 0&&(i=n);var o=Object.getOwnPropertyDescriptor(r,n);(!o||("get"in o?!r.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return r[n]}}),Object.defineProperty(e,i,o)}:function(e,r,n,i){i===void 0&&(i=n),e[i]=r[n]}),JKe=Ta&&Ta.__setModuleDefault||(Object.create?function(e,r){Object.defineP
48 | `;if(i.username||i.password){let x=`${decodeURIComponent(i.username)}:${decodeURIComponent(i.password)}`;a["Proxy-Authorization"]=`Basic ${Buffer.from(x).toString("base64")}`}a.Host=`${u}:${n.port}`,a["Proxy-Connection"]||(a["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let x of Object.keys(a))c+=`${x}: ${a[x]}\r
49 | `;let l=(0,eJe.parseProxyResponse)(o);o.write(`${c}\r
50 | `);let{connect:p,buffered:f}=await l;if(r.emit("proxyConnect",p),this.emit("proxyConnect",p,r),p.statusCode===200)return r.once("socket",tJe),n.secureEndpoint?(Eb("Upgrading socket connection to TLS"),xoe.connect({...boe(voe(n),"host","path","port"),socket:o})):o;o.destroy();let g=new oT.Socket({writable:!1});return g.readable=!0,r.once("socket",x=>{Eb("Replaying proxy buffer for failed request"),(0,YKe.default)(x.listenerCount("data")>0),x.push(f),x.push(null)}),g}};aT.protocols=["http","https"];Ta.HttpsProxyAgent=aT;function tJe(e){e.resume()}function boe(e,...r){let n={},i;for(i in e)r.includes(i)||(n[i]=e[i]);return n}});var qoe=C((Boe,joe)=>{"use strict";Boe=joe.exports=m0;function m0(e,r){if(this.stream=r.stream||process.stderr,typeof r=="number"){var n=r;r={},r.total=n}else{if(r=r||{},typeof e!="string")throw new Error("format required");if(typeof r.total!="number")throw new Error("total required")}this.fmt=e,this.curr=r.curr||0,this.total=r.total,this.width=r.width||this.total,this.clear=r.clear,this.
51 | `),this.stream.write(this.lastDraw)};m0.prototype.terminate=function(){this.clear?this.stream.clearLine&&(this.stream.clearLine(),this.stream.cursorTo(0)):this.stream.write(`
52 | `)}});var Goe=C((nqt,Uoe)=>{"use strict";Uoe.exports=qoe()});var Hoe=C((sqt,uJe)=>{uJe.exports={name:"@prisma/fetch-engine",version:"6.9.0",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <[email protected]>",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/fetch-engine"},bugs:"https://github.com/prisma/prisma/issues",enginesOverride:{},devDependencies:{"@swc/core":"1.11.5","@swc/jest":"0.2.37","@types/jest":"29.5.14","@types/node":"18.19.76","@types/progress":"2.0.7",del:"6.1.1",execa:"5.1.1","find-cache-dir":"5.0.0","fs-extra":"11.3.0",hasha:"5.2.2","http-proxy-agent":"7.0.2","https-proxy-agent":"7.0.6",jest:"29.7.0",kleur:"4.1.5","node-fetch":"3.3.2","p-filter":"4.1.0","p-map":"4.0.0","p-retry":"4.6.2",progress:"2.0.3",rimraf:"6.0.1","strip-ansi":"6.0.1","temp-dir":"2.0.0",tempy:"1.0.1","timeout-signal":"2.0.0",typescript:"5.4.5"},dep
ENOENT: no such file or directory, open '/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma_schema_build_bg.wasm'
    path: "/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma_schema_build_bg.wasm",
 syscall: "open",
   errno: -2,
    code: "ENOENT"
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:52:10125)
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:2:263)
      at <anonymous> (/tmp/bunx-0-prisma@latest/node_modules/.bin/prisma:263:154)
Bun v1.2.15 (Linux x64 baseline)
-------------------------------------------
             Welcome to Snapp!
-------------------------------------------
      Thank you for choosing this app.
      Have a great day and enjoy your
            experience with us!
-------------------------------------------
38 | var clientVersion = version;
39 | 
40 | // src/scripts/default-index.ts
41 | var PrismaClient = class {
42 |   constructor() {
43 |     throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');
               ^
error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
      at new PrismaClient (/app/node_modules/.prisma/client/default.js:43:11)
      at /app/build/server/chunks/index4.js:4:16
      at requestImportModule (2:1)
Bun v1.2.15 (Linux x64 baseline)

daFailer avatar Jun 17 '25 14:06 daFailer

Could It be the instruction are old? Marius did that tutorial some versions ago. Many env changed

Il take a look as soon as i have some more free time πŸ™

urania-dev avatar Jun 17 '25 17:06 urania-dev

i tried rework the initial image, i'll build asap, 0.9-rc-020

urania-dev avatar Jun 18 '25 12:06 urania-dev

I've reviewed your README and, with the help of Marius' guide and ChatGPT, I've created a new Docker Compose setup to deploy a fresh stack in my Portainer instance.

However, I'm still encountering the following error: throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');

At this point, I'm unsure whether the issue lies in my setup or if the Docker image itself might be faulty. After extensive trial and error, I've reached the limits of my knowledge and would really appreciate any guidance.

Below is my full docker-compose.yml file:

services:
  db:
    image: postgres:16
    container_name: Snapp-DB
    hostname: snapp-db
    mem_limit: 1g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "snapp", "-U", "snappuser"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/snappdb:/var/lib/postgresql/data:rw
    environment:
      POSTGRES_DB: snappdb
      POSTGRES_USER: snappuser
      POSTGRES_PASSWORD: snapppass
    restart: on-failure:5
    
  snapp:
    container_name: Snapp
    image: uraniadev/snapp:latest
    mem_limit: 4g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:false
    restart: on-failure:5
    ports:
      - 6421:3000
    depends_on: 
     db: 
      condition: service_healthy
    environment:
      DATABASE_PROVIDER: postgres
      DATABASE_URL: postgres://postgres:snapp_pass@postgres:5432/snappdb
      ORIGIN: https://[nasname].synology.me
      PUBLIC_URL: https://[nasname].synology.me
      TOKEN_SECRET: base64:token
      ADMIN_USERNAME: admin
      ADMIN_PASSWORD: password
      ADMIN_EMAIL: [email protected]
      SMTP_FROM: [email protected]
      SMTP_HOST: smtp.gmail.com
      SMTP_PORT: 587
      SMTP_USER: [email protected]
      SMTP_PASS: app_passwort
      SMTP_SSL: false
      ENABLE_SIGNUP: false
      DISABLE_HOME: false
      LOG_LEVEL: info

daFailer avatar Jul 27 '25 22:07 daFailer

I am more incline to believe i have messed up something in the image itself yes. Is It by any chance the arm version of the image?

urania-dev avatar Jul 28 '25 09:07 urania-dev

i don't think that arm version is used. if i understand correctly the line image: uraniadev/snapp:latest refers to https://hub.docker.com/r/uraniadev/snapp ,which I assume is the standard non-arm version

daFailer avatar Jul 29 '25 08:07 daFailer

Image is available for both architecture and tag, so :latest can be both, arm or amd, it download the one that can run on the host. :) uname -i should answer the questione

urania-dev avatar Jul 29 '25 08:07 urania-dev

SO, i took some time to test your docker compose and actually there are some mistake

services:
  db:
    image: postgres:16
    container_name: Snapp-DB
   
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "snapp", "-U", "snappuser"]
    # here you declare test on db snapp
    environment:
      POSTGRES_DB: snappdb
   # but in env the name is actually snappdb
      POSTGRES_USER: snappuser
      POSTGRES_PASSWORD: snapppass
    restart: on-failure:5
    
  snapp:
    container_name: Snapp
    image: uraniadev/snapp:latest
      DATABASE_URL: postgres://postgres:snapp_pass@postgres:5432/snappdb
      # here too you reference postgres as host but it you could use @db 
      # since service is on the same docker compose list, also user is snappuser not postgres

as i changed those and tested on arm and amd it worked fine as expected. would you mind try again with this:

services:
  db:
    image: postgres:16
    container_name: Snapp-DB
    hostname: snapp-db
    mem_limit: 1g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "snappdb", "-U", "snappuser"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - pg-data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: snappdb
      POSTGRES_USER: snappuser
      POSTGRES_PASSWORD: snapppass
    restart: on-failure:5
    
  snapp:
    container_name: Snapp
    image: uraniadev/snapp:latest
    mem_limit: 4g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:false
    restart: on-failure:5
    ports:
      - 80:3000
    depends_on: 
     db: 
      condition: service_healthy
    environment:
      DATABASE_PROVIDER: postgres
      DATABASE_URL: postgres://snappuser:snapppass@db:5432/snappdb
      ORIGIN: https://[nasname].synology.me
      PUBLIC_URL: https://[nasname].synology.me
      TOKEN_SECRET: base64:token
      ADMIN_USERNAME: admin
      ADMIN_PASSWORD: password
      ADMIN_EMAIL: [email protected]
      SMTP_FROM: [email protected]
      SMTP_HOST: smtp.gmail.com
      SMTP_PORT: 587
      SMTP_USER: [email protected]
      SMTP_PASS: app_passwort
      SMTP_SSL: false
      ENABLE_SIGNUP: false
      DISABLE_HOME: false
      LOG_LEVEL: info
volumes:
  pg-data:

Volume mount should prevent any ownership rights errors on volume mount, and the fixed db address and user (and healthcheck) should get rid of error logs.

urania-dev avatar Jul 30 '25 09:07 urania-dev

version 0.9-rc-20 should have fixed this problem, in any case i'm more than happy to reopen the issue and find a solution

urania-dev avatar Jul 30 '25 10:07 urania-dev