- Postgres 15+
- Cassandra
- Python 3.8+
- Poetry (Python library)
-
Install Postgres.
Using Docker (recommended):
docker run --name monoid-postgres -p 5432:5432 -e POSTGRES_PASSWORD=pgpassword -d postgres
-
Install Cassandra.
Using Docker (recommended):
docker run --name cass --network cass-network -d -e CASSANDRA_BROADCAST_ADDRESS=127.0.0.1 -p 9042:9042 cassandra:latest
Note: Production uses AWS Keyspaces, which requires certificates (
global-bundle.pem
andsf-class2-root.crt
) undermonoid_backend/core/secret/
. If using other services such as ScyllaDB or DataStax, modify the functions in monoid_backend/core/cassandra.py.
-
Copy
.env.example
with a name.env
.cp .env.example .env
-
Change all values in
.env
. -
Install dependencies using Poetry.
poetry install
-
Migrate Postgres. (Ensure
.env
is updated.)alembic upgrade head
-
Migrate Cassandra. (Ensure
.env
is updated.)# Run from monoid/monoid_backend python scripts/cassandra/0_create_chat_session_models.py
poetry run uvicorn monoid_backend.main:app --port 8080 --reload
When creating a new or making changes to an existing RDB model, you would need to migrate your database.
-
Create your migration version
Option 1: Automatically create new revisions.
alembic revision -- autogenerate -m "COMMIT MESSAGE"
Option 2: Write a custom migrations (manually edit
upgrade()
anddowngrade()
)alembic revision -m "COMMIT MESSAGE"
-
Upgrade to your latest version
alembic upgrade head
For more info, please refer to Alembic's doc.
Coming soon.