Skip to content

hedon-rust-road/chat

Repository files navigation

Chat

  • chat_server
  • notify_server

Run Postgres in Docker

docker run -d \
    -e POSTGRES_PASSWORD=postgres \
    -e POSTGRES_USER=postgres \
    -p 5432:5432 \
    --name mypostgres postgres

Install sqlx

cargo install sqlx-cli --no-default-features --features rustls,postgres

Create database

pgcli
CREATE DATABASE chat;

Init sql migration

sqlx migrate add initial

Edit sql migration

vi migrations/{timestamp}_initial.sql

Run sqlx migrate

sqlx migrate run

Generate public ed25519 key with OpenSSL

generate private key

openssl genpkey -algorithm ed25519 -out ./fixtures/encoding.pem

generate public key

openssl pkey -in ./fixtures/encoding.pem -pubout -out ./fixtures/decoding.pem