diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ba3cc35 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +services: + postgres: + image: postgres:16-alpine + environment: + POSTGRES_DB: proxypool + POSTGRES_USER: proxypool + POSTGRES_PASSWORD: proxypool + ports: + - "5432:5432" + volumes: + - pg_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U proxypool"] + interval: 2s + timeout: 5s + retries: 10 + + redis: + image: redis:7-alpine + ports: + - "6379:6379" + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 2s + timeout: 5s + retries: 10 + +volumes: + pg_data: \ No newline at end of file diff --git a/src/proxy_pool/db/base.py b/src/proxy_pool/db/base.py index 7a72cff..294ec74 100644 --- a/src/proxy_pool/db/base.py +++ b/src/proxy_pool/db/base.py @@ -12,7 +12,7 @@ class Base(DeclarativeBase): class UUIDPrimaryKeyMixin: id: Mapped[uuid.UUID] = mapped_column( primary_key=True, - default_factory=uuid.uuid4, + default=uuid.uuid4, ) diff --git a/src/proxy_pool/proxy/models.py b/src/proxy_pool/proxy/models.py index 1a33978..a7ffd5c 100644 --- a/src/proxy_pool/proxy/models.py +++ b/src/proxy_pool/proxy/models.py @@ -45,6 +45,7 @@ class ProxySource(UUIDPrimaryKeyMixin, TimestampMixin, Base): cron_schedule: Mapped[str | None] = mapped_column(String(64)) default_protocol: Mapped[ProxyProtocol] = mapped_column( ENUM(ProxyProtocol, name="proxy_protocol"), + default=ProxyProtocol.HTTP, ) is_active: Mapped[bool] = mapped_column(default=True) last_scraped_at: Mapped[datetime | None] = mapped_column()