EC
Ente Community•5mo ago
no402

Where is data directory for selfhosted ente auth

Hey everyone, does anyone know where the data is stored when selfhosting ente auth? The data/ folder in the root of the project folder seems to be empty
13 Replies
Ducky
Ducky•5mo ago
Remember to use /solved to mark your thread as solved once your question is answered.
vishnu
vishnu•5mo ago
Data is stored within the PostgresDB
no402
no402OP•5mo ago
Which is stored where? I thought this was similar to Vaultwarden, whereas the data is mapped in the container, but lies on the hosts filesystem inside the data folder Cant seem to find anything to this in the docs rn
vishnu
vishnu•5mo ago
Our docker image comes packed with Postgres, you can docker container list to get more info
no402
no402OP•5mo ago
So a simple file backup or dump of the postgres is not possible? In the compose.yaml under the postgres container: volumes: - postgres-data:/var/lib/postgresql/data I was suspecting this to be the data directory that exports the files
no402
no402OP•5mo ago
https://help.ente.io/self-hosting/faq/backup "For postgres, the entire data volume needs to be backed up." Does this mean the docker volume or the the literal files that are mapped from host to container?
Backups | Ente Help
General introduction to backing up your self hosted Ente instance
vishnu
vishnu•5mo ago
I believe for Postgres you should be able to take a pg_dump and restore from there
no402
no402OP•5mo ago
I have made my own solution then, snippet:
pg_user="$(grep POSTGRES_USER ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"
pg_pw="$(grep POSTGRES_PASSWORD ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"
pg_db="$(grep POSTGRES_DB ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"

# backup
docker compose exec -T postgres /bin/bash -c "PGPASSWORD='${pg_pw}' pg_dump -U ${pg_user} -d ${pg_db} --inserts" > ${backup_dir}/enteauth.backup.sql

# restore (TO BE TESTED)
# cat ${backup_dir}/enteauth.backup.sql | docker compose exec -T postgres /bin/bash -c "PGPASSWORD='${pg_pw}' psql -U ${pg_user} -d ${pg_db}"
pg_user="$(grep POSTGRES_USER ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"
pg_pw="$(grep POSTGRES_PASSWORD ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"
pg_db="$(grep POSTGRES_DB ${ente_dir}/compose.yaml | awk -F':' '{print $2}' | tr -d ' ')"

# backup
docker compose exec -T postgres /bin/bash -c "PGPASSWORD='${pg_pw}' pg_dump -U ${pg_user} -d ${pg_db} --inserts" > ${backup_dir}/enteauth.backup.sql

# restore (TO BE TESTED)
# cat ${backup_dir}/enteauth.backup.sql | docker compose exec -T postgres /bin/bash -c "PGPASSWORD='${pg_pw}' psql -U ${pg_user} -d ${pg_db}"
` Data seems to be in COPY format by default, thats why the "--inserts" flag is for, insert rows match the exact number of authenticators saved - need a fresh restore to confirm this 100% working though. Just FYI, otherwise this is /solved now
Ducky
Ducky•5mo ago
-# If your issue is resolved, you can use the /solved command to close the thread. If not, use /unsolve to cancel. Thread marked as solved. It will be closed in <t:1751549604:R>.
no402
no402OP•5mo ago
Ah good thing threads get closed, is there an archive for someone to look up these solved threads?
vishnu
vishnu•5mo ago
Closed threads don't get deleted, so they'll remain searchable 🙂
no402
no402OP•5mo ago
Lovely, have a good one 🙂
Ducky
Ducky•5mo ago
This thread is now closed.

Did you find this page helpful?