Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update dockerfile
  • Loading branch information
Sudhamsha committed Apr 22, 2025
commit b4bb2d4b720a461c0776388038da5d02940e0a50
49 changes: 49 additions & 0 deletions alembic/versions/482cd6517ce4_add_default_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""add default user

Revision ID: 482cd6517ce4
Revises: 8057ae7329c2
Create Date: 2023-01-01 00:00:00.000000

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
import uuid

# revision identifiers, used by Alembic.
revision = '482cd6517ce4'
down_revision = '8057ae7329c2'
branch_labels = None
depends_on = None


def upgrade() -> None:
# Create a default admin user
users = table('users',
column('id', sa.String),
column('email', sa.String),
column('hashed_password', sa.String),
column('is_active', sa.Boolean),
column('is_superuser', sa.Boolean),
column('is_verified', sa.Boolean)
)

# Default hashed password for 'admin@example.com' (this is a placeholder)
# In a real scenario, this would be properly hashed
hashed_password = '$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW' # 'password'

op.bulk_insert(users, [
{
'id': str(uuid.uuid4()),
'email': 'admin@example.com',
'hashed_password': hashed_password,
'is_active': True,
'is_superuser': True,
'is_verified': True
}
])


def downgrade() -> None:
# Remove the default admin user
op.execute("DELETE FROM users WHERE email = 'admin@example.com'")
36 changes: 36 additions & 0 deletions alembic/versions/8057ae7329c2_initial_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""initial migration

Revision ID: 8057ae7329c2
Revises:
Create Date: 2023-01-01 00:00:00.000000

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '8057ae7329c2'
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
# Create tables for the initial database schema
op.create_table('users',
sa.Column('id', sa.String(length=36), nullable=False),
sa.Column('email', sa.String(length=320), nullable=False),
sa.Column('hashed_password', sa.String(length=1024), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('is_superuser', sa.Boolean(), nullable=False),
sa.Column('is_verified', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)


def downgrade() -> None:
# Drop tables created in upgrade
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
23 changes: 21 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,28 @@ services:
deploy:
resources:
limits:
cpus: '2.0'
memory: 8GB
cpus: '1.0'
memory: 2GB
depends_on:
- postgres

postgres:
image: pgvector/pgvector:pg17
container_name: cognee-postgres
networks:
- cognee-network
environment:
- POSTGRES_USER=cognee
- POSTGRES_PASSWORD=cognee
- POSTGRES_DB=cognee_db
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

networks:
cognee-network:
name: cognee-network

volumes:
postgres_data:
Loading