Skip to content

Commit

Permalink
Merge branch '2438-relaxt-additional-submitters-perms' of github.com:…
Browse files Browse the repository at this point in the history
…bastianjoel/openslides-backend into 2438-relaxt-additional-submitters-perms
  • Loading branch information
bastianjoel committed May 28, 2024
2 parents 83ecf4b + 32d8e28 commit b3dee6c
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 33 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ run-dev-attach-local:
run-dev-local run-bash-local: | start-dev-local run-dev-attach-local


# Build and run development container. Additionally run OpenTelemetry services

start-dev-otel:
USER_ID=$$(id -u $${USER}) GROUP_ID=$$(id -g $${USER}) docker compose -f dev/docker-compose.dev.yml -f dev/dc.otel.yml up --build --detach

start-dev-attach-otel start-dev-interactive-otel:
USER_ID=$$(id -u $${USER}) GROUP_ID=$$(id -g $${USER}) docker compose -f dev/docker-compose.dev.yml -f dev/dc.otel.yml up --build

stop-dev-otel:
docker compose -f dev/docker-compose.dev.yml -f dev/dc.otel.yml down --volumes

run-dev-attach-otel:
docker compose -f dev/docker-compose.dev.yml -f dev/dc.otel.yml exec backend ./entrypoint.sh bash --rcfile .bashrc

run-dev-otel run-bash-otel: | start-dev-otel run-dev-attach-otel


# Build standalone development container (not usable inside the docker container)

build-dev:
Expand Down
29 changes: 29 additions & 0 deletions dev/dc.otel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3"
services:

collector:
image: otel/opentelemetry-collector:0.41.0
command: ["--config=/etc/otel-collector-config.yml"]
volumes:
- ./otel-collector-config.yml:/etc/otel-collector-config.yml

jaeger:
image: jaegertracing/all-in-one
ports:
- "16686:16686"

backend:
environment:
- OPENTELEMETRY_ENABLED=1

datastore-reader:
environment:
- OPENTELEMETRY_ENABLED=1

datastore-writer:
environment:
- OPENTELEMETRY_ENABLED=1

auth:
environment:
- OPENTELEMETRY_ENABLED=1
30 changes: 0 additions & 30 deletions dev/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ services:
- DATASTORE_LOG_LEVEL=CRITICAL
depends_on:
- datastore-writer
networks:
- datastore
- postgres
- auth
- redis
datastore-reader:
build:
context: "https://github.com/OpenSlides/openslides-datastore-service.git#main"
Expand All @@ -48,9 +43,6 @@ services:
- DATABASE_HOST=postgres
depends_on:
- postgres
networks:
- datastore
- postgres
datastore-writer:
build:
context: "https://github.com/OpenSlides/openslides-datastore-service.git#main"
Expand All @@ -66,10 +58,6 @@ services:
depends_on:
- postgres
- redis
networks:
- datastore
- postgres
- redis
auth:
build:
context: "https://github.com/OpenSlides/openslides-auth-service.git#main"
Expand All @@ -90,10 +78,6 @@ services:
- datastore-reader
- datastore-writer
- redis
networks:
- datastore
- auth
- redis
vote:
build:
context: "https://github.com/OpenSlides/openslides-vote-service.git#main"
Expand All @@ -113,27 +97,13 @@ services:
- datastore-reader
- redis
- auth
networks:
- datastore
- redis
- auth
- postgres
postgres:
image: postgres:15
environment:
- POSTGRES_USER=openslides
- POSTGRES_PASSWORD=openslides
- POSTGRES_DB=openslides
networks:
- postgres
redis:
image: redis:alpine
ports:
- "6379:6379"
networks:
- redis
networks:
datastore:
postgres:
redis:
auth:
21 changes: 21 additions & 0 deletions dev/otel-collector-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
receivers:
otlp:
protocols:
http:
grpc:

exporters:
jaeger:
endpoint: jaeger:14250
tls:
insecure: true

processors:
batch:

service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [ jaeger]
2 changes: 1 addition & 1 deletion global/meta
5 changes: 4 additions & 1 deletion openslides_backend/shared/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@


def get_text_from_html(html: str) -> str:
return BeautifulSoup(html, features="html.parser").get_text()
if html:
return BeautifulSoup(html, features="html.parser").get_text()
else:
return ""
2 changes: 1 addition & 1 deletion openslides_backend/shared/otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def make_span(env: Env, name: str, attributes: dict[str, str] | None = None) ->
# ), "backend:Opentelemetry span to be set before having set a TRACER_PROVIDER"

tracer = trace.get_tracer_provider().get_tracer(__name__)
span = tracer.start_as_current_span(name, attributes=attributes)
span = tracer.start_as_current_span("backend:" + name, attributes=attributes)

return span
9 changes: 9 additions & 0 deletions tests/system/action/meeting/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import time
from typing import Any

import pytest

from openslides_backend.action.action_worker import ActionWorkerState
from openslides_backend.migrations import get_backend_migration_index
from openslides_backend.models.models import Meeting
Expand Down Expand Up @@ -2417,3 +2419,10 @@ def test_without_users(self) -> None:
},
)
self.assert_model_not_exists("user/2")

@pytest.mark.skip()
def test_import_os3_data(self) -> None:
data_raw = get_initial_data_file("global/data/export-OS3-demo.json")
data = {"committee_id": 1, "meeting": data_raw}
response = self.request("meeting.import", data)
self.assert_status_code(response, 200)

0 comments on commit b3dee6c

Please sign in to comment.