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

如何建立PostgreSQL空数据库table结构 #2

Open
tigerzioo opened this issue May 23, 2024 · 0 comments
Open

如何建立PostgreSQL空数据库table结构 #2

tigerzioo opened this issue May 23, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@tigerzioo
Copy link
Owner

tigerzioo commented May 23, 2024

用Docker创建PostgreSQL连接的Memos,就可以自动创建所有的数据库table结构。

创建空数据库

create database memos_prod

给数据库创建用户并把memos_prod数据库的所有权限给此用户。如果用数据库管理员用户,就不需要创建新用户了。

CREATE USER memo_user WITH PASSWORD 'memo_user_password';
GRANT ALL PRIVILEGES ON DATABASE memos_prod to memo_user;

用docker或docker-compose创建memos

Docker

docker run -d \
    --name memos \
    -p 5230:5230 \
    -v ~/.memos/:/var/opt/memos ghcr.io/usememos/memos:stable \
    --driver postgres \
    --dsn 'postgresql://memo_user:memo_user_password@PostgreSQL_server_ip:5432/memos_prod'

Docker compose

version: "3.0"
services:
  memos:
    image: ghcr.io/usememos/memos:stable
    container_name: memos
    volumes:
      - ./.memos/:/var/opt/memos
    ports:
      - 5230:5230
    environment:
      MEMOS_DRIVER: postgres
      MEMOS_DSN: postgresql://memo_user:memo_user_password@PostgreSQL_server_ip:5432/memos_prod
@tigerzioo tigerzioo added the documentation Improvements or additions to documentation label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant