Google Cloud Bucket support
When I mount Google Cloud Storage Bucket and use it as pglite path, it created pgdata/ folder and then app crashes.
Does pglite has some issue with Google Cloud FUSE limitations or just don’t support this mode?
I understand that it is very slow way to use database. But I think this mode is important for prototypes when you want some permanent storage but don’t want to pay for separated machine on Google Cloud for database.
Here is my code:
Did you happen to get the error logs from when it crashed? If you could post them (use debug: 1) that would help a lot in working out why it crashes.
I'm not aware of anyone who has tried with a FUSE based file system.
Thanks! I didn’t know about debug: 1. But logs are strange, I think I need your help.
The JS code:
console.log('DB Location:', config.db)
pglite = new PGlite(config.db, { debug: 1 })
I mount Google Cloud bucket to /var/mnt/db:
--add-volume name=db,type=cloud-storage,bucket=slowreader-staging-db
--add-volume-mount volume=db,mount-path=/var/mnt/db
But I got logs where pglite try to look at /tmp
DB Location: file:///var/mnt/db/pgdata
pglite: no db
# WARNING: program "postgres" is needed by initdb but was not found in the same directory as "/tmp/pglite/bin/initdb"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
# 3442
The database cluster will be initialized with this locale configuration:
provider: libc
LC_COLLATE: C
LC_CTYPE: C.UTF-8
LC_MESSAGES: C
LC_MONETARY: C
LC_NUMERIC: C
LC_TIME: C
# 2651
# 2705
# 2706
# 3444
The default text search configuration will be set to "english".
# 3446
Data page checksums are disabled.
# 3458
popen failure: Function not implemented
error: could not change permissions of directory "/tmp/pglite/base": Operation not permitted
@ai error: could not change permissions of directory "/tmp/pglite/base": Operation not permitted
Can you please check the permissions on /var/mnt/db?
Thanks, seems like it was a reason https://github.com/hplush/slowreader/commit/b9012b101e0d2b3c85ed8bb65c0edbcd18f484ed
I am closing this issue. But why we have /tmp/pglite/base path in the log?
But why we have
/tmp/pglite/basepath in the log?
@ai we use emscripten's filesystem to store pglite's (postgres') files. the emscripten fs is mouted at / and we use /tmp/pglite/base.
@tdrz hm, the wrong path was the reason why I stopped debugging and open an issue. If it was confused, it may confuse others. Not urgent, but we can do log.replaceAll('/tmp/pglite/base', path) replacement in JS wrapper around WASM.
@ai Unsure what you mean. The path in the log is correct.
There is a mapping of the host path to the wasm environment (in your case /var/mnt/db -> /. That is why you needed to change the permissions on /var/mnt/db.