I am trying to access my database via a GUI (Psequel).
I forwarded the port setting from my container as such:
app.yml:
expose:
<standard definitions>
- "15432:5432" # PostgreSQL
Also changed my password as such:
./launcher enter app
su - postgres
psql
ALTER ROLE postgres WITH PASSWORD '<your password>';
And I am unable to access the database. Any suggestions?
If you only need a static snap shot of the database then from https://<site>/admin/backups download a backup. It should be a *.tar.gz file and when uncompressed will be a *.sql file. Create a PostgreSQL database on another machine, which could even be your laptop, and then import the *.sql file.
Now you should be able to access the data all you want with any means that can connect to a PostgreSQL database.
I use the above but access the Discourse database in PostgreSQL via ODBC.
下载的文件是 gz 文件,例如 abc-2025-01-23-095947-v20250122131007.sql.gz。在 Windows 上使用 7-zip 解压缩文件,这会创建一个同名但去掉 .gz 后缀的目录。
C:\Users\Groot\Downloads>dir *.sql.gz
01/23/2025 05:04 AM 407,213,170 abc-2025-01-23-095947-v20250122131007.sql.gz
C:\Users\Groot\Downloads>dir *.sql
01/23/2025 05:04 AM <DIR> abc-2025-01-23-095947-v20250122131007.sql
使用打开到包含 sql 文件的目录的 Windows 命令提示符来验证 sql 文件是否存在。
C:\Users\Groot\Downloads\abc-2025-01-23-095947-v20250122131007.sql>dir
01/23/2025 05:04 AM 1,572,346,154 abc-2025-01-23-095947-v20250122131007.sql
1 File(s) 1,572,346,154 bytes
使用相同的 Windows 命令提示符键入命令以列出 sql 文件的开头。
type /a | more
C:\Users\Groot\Downloads\abc-2025-01-23-095947-v20250122131007.sql>type "abc-2025-01-23-095947-v20250122131007.sql" /a | more
abc-2025-01-23-095947-v20250122131007.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.8 (Debian 15.8-1.pgdg110+1)
-- Dumped by pg_dump version 15.10 (Debian 15.10-1.pgdg120+1)
-- Started on 2025-01-23 09:59:47 UTC
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';