Skip to content

Commit 83d8ac0

Browse files
[DOP-19907] - change settings configuration (#112)
* [DOP-19796] - add log_url before sedning run task to celery worker * [DOP-19907] - refactor repository * [DOP-19907] - add broker configuration * [DOP-19907] - remove markers * [DOP-19907] - update psycopg2 to psycopg3 * [DOP-19907] - configure middlewares * [DOP-19907] - bring back asyncpg in backend * [DOP-19907] - add flake8 to pyproject.toml and remove setup.cfg * [DOP-19907] - minor fixes * [DOP-19907] - update ENV in Dockerfile.worker
1 parent 3d0fa35 commit 83d8ac0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1736
-756
lines changed

.env.docker

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
TZ=UTC
22
ENV=LOCAL
33

4+
# Debug
5+
SYNCMASTER__SERVER__DEBUG=true
6+
7+
# Logging
8+
SYNCMASTER__SERVER__LOGGING__SETUP=True
9+
SYNCMASTER__SERVER__LOGGING__PRESET=colored
10+
411
# Postgres
5-
POSTGRES_HOST=db
6-
POSTGRES_PORT=5432
7-
POSTGRES_DB=syncmaster
8-
POSTGRES_USER=syncmaster
9-
POSTGRES_PASSWORD=changeme
12+
SYNCMASTER__DATABASE__URL=postgresql+asyncpg://syncmaster:changeme@db:5432/syncmaster
1013

1114
# RabbitMQ
12-
RABBITMQ_HOST=rabbitmq
13-
RABBITMQ_PORT=5672
14-
RABBITMQ_USER=guest
15-
RABBITMQ_PASSWORD=guest
15+
SYNCMASTER__BROKER__URL=amqp://guest:guest@rabbitmq:5672/
1616

1717
# S3
1818
MINIO_ACCESS_KEY=syncmaster
@@ -28,6 +28,13 @@ TEST_S3_ACCESS_KEY=syncmaster
2828
TEST_S3_SECRET_KEY=changeme
2929
TEST_S3_BUCKET=syncmaster
3030

31+
# needed for test-postgres container
32+
POSTGRES_HOST=test-postgres
33+
POSTGRES_PORT=5432
34+
POSTGRES_DB=syncmaster
35+
POSTGRES_USER=syncmaster
36+
POSTGRES_PASSWORD=changeme
37+
3138
TEST_POSTGRES_HOST_FOR_CONFTEST=test-postgres
3239
TEST_POSTGRES_PORT_FOR_CONFTEST=5432
3340
TEST_POSTGRES_HOST_FOR_WORKER=test-postgres

.env.local

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
export TZ=UTC
22
export ENV=LOCAL
33

4+
# Debug
5+
export SYNCMASTER__SERVER__DEBUG=true
6+
7+
# Logging
8+
export SYNCMASTER__SERVER__LOGGING__SETUP=True
9+
export SYNCMASTER__SERVER__LOGGING__PRESET=colored
10+
411
# Postgres
5-
export POSTGRES_HOST=localhost
6-
export POSTGRES_PORT=5432
7-
export POSTGRES_DB=syncmaster
8-
export POSTGRES_USER=syncmaster
9-
export POSTGRES_PASSWORD=changeme
12+
export SYNCMASTER__DATABASE__URL=postgresql+asyncpg://syncmaster:changeme@localhost:5432/syncmaster
1013

1114
# RabbitMQ
12-
export RABBITMQ_HOST=localhost
13-
export RABBITMQ_PORT=5672
14-
export RABBITMQ_USER=guest
15-
export RABBITMQ_PASSWORD=guest
15+
export SYNCMASTER__BROKER__URL=amqp://guest:guest@localhost:5672/
1616

1717
export TEST_S3_HOST_FOR_CONFTEST=localhost
1818
export TEST_S3_PORT_FOR_CONFTEST=9010

.pre-commit-config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ repos:
4949
files: ^(.*__main__\.py)$
5050
- id: insert-license
5151
files: .*\.py$
52-
exclude: ^(tests/.*\.py)$
52+
exclude: ^(syncmaster/backend/dependencies/stub.py|docs/.*\.py|tests/.*\.py)$
5353
args:
5454
- --license-filepath
5555
- .spdx-license-header.txt
@@ -100,6 +100,14 @@ repos:
100100

101101
- repo: local
102102
hooks:
103+
- id: flake8
104+
name: flake8
105+
entry: flake8
106+
language: python
107+
types: [python]
108+
files: ^syncmaster/.*$
109+
pass_filenames: true
110+
103111
- id: mypy
104112
name: mypy
105113
entry: mypy ./syncmaster/backend --config-file ./pyproject.toml
@@ -136,6 +144,7 @@ repos:
136144

137145
ci:
138146
skip:
147+
- flake8 # checked with Github Actions
139148
- mypy # checked with Github Actions
140149
- chmod # failing in pre-commit.ci
141150
- docker-compose-check # cannot run on pre-commit.ci

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build:
1717
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry install --no-root --all-extras --with docs --without dev,test
1818
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry show -v
1919
- python -m pip list -v
20-
- POSTGRES_HOST=db POSTGRES_PORT=5432 POSTGRES_DB=syncmaster POSTGRES_USER=user POSTGRES_PASSWORD=password RABBITMQ_HOST=rabbitmq RABBITMQ_PORT=5672 RABBITMQ_USER=user RABBITMQ_PASSWORD=password python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json
20+
- SYNCMASTER__DATABASE__URL=postgresql+psycopg://fake:[email protected]:5432/fake SYNCMASTER__BROKER__URL=amqp://fake:faket@fake:5672/ python -m syncmaster.backend.export_openapi_schema docs/_static/openapi.json
2121

2222
sphinx:
2323
configuration: docs/conf.py

docker/Dockerfile.worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ COPY ./syncmaster/ /app/syncmaster/
3939

4040
FROM base as test
4141

42-
ENV CREATE_SPARK_SESSION_FUNCTION=tests.spark.get_worker_spark_session
42+
ENV SYNCMASTER__CREATE_SPARK_SESSION_FUNCTION=tests.spark.get_worker_spark_session
4343

4444
# CI runs tests in the worker container, so we need backend dependencies too
4545
RUN poetry install --no-root --all-extras --with test --without docs,dev
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. _backend-configuration-broker:
2+
3+
Broker settings
4+
=================
5+
6+
.. autopydantic_model:: syncmaster.settings.broker.RabbitMQSettings
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _backend-configuration-cors:
2+
3+
CORS settings
4+
=============
5+
6+
These settings used to control `CORS <https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS>`_ options.
7+
8+
.. autopydantic_model:: syncmaster.settings.server.cors.CORSSettings
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. _backend-configuration-database:
2+
3+
Database settings
4+
=================
5+
6+
.. autopydantic_model:: syncmaster.settings.database.DatabaseSettings
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _backend-configuration:
2+
3+
Configuration
4+
=============
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
:caption: Configuration
9+
:hidden:
10+
11+
database
12+
broker
13+
logging
14+
cors
15+
debug
16+
17+
.. autopydantic_settings:: syncmaster.settings.Settings
18+
.. autopydantic_settings:: syncmaster.settings.server.ServerSettings
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. _backend-configuration-logging:
2+
3+
Logging settings
4+
================
5+
6+
7+
.. autopydantic_model:: syncmaster.settings.server.log.LoggingSettings

0 commit comments

Comments
 (0)