diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 093afab3..1448a79b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: args: [ --allow-multiple-documents ] - id: debug-statements - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 + rev: 6.1.0 hooks: - id: flake8 args: [--max-line-length, "100", --ignore, "E203, W503"] diff --git a/backend/ibutsu_server/db/models.py b/backend/ibutsu_server/db/models.py index 22c53d18..bb08a0ed 100644 --- a/backend/ibutsu_server/db/models.py +++ b/backend/ibutsu_server/db/models.py @@ -238,7 +238,7 @@ def password(self): return self._password @password.setter - def password_set(self, value): + def password(self, value): self._password = bcrypt.generate_password_hash(value).decode("utf8") def check_password(self, plaintext): diff --git a/backend/ibutsu_server/db/util.py b/backend/ibutsu_server/db/util.py index a8bb3cf8..4d13b825 100644 --- a/backend/ibutsu_server/db/util.py +++ b/backend/ibutsu_server/db/util.py @@ -56,10 +56,10 @@ def add_superadmin( user = models.User( email=email, name=name, - password=password, is_superadmin=True, is_active=True, ) + user.password = password session.add(user) diff --git a/backend/ibutsu_server/openapi/openapi.yaml b/backend/ibutsu_server/openapi/openapi.yaml index f7e8813b..018f9df0 100644 --- a/backend/ibutsu_server/openapi/openapi.yaml +++ b/backend/ibutsu_server/openapi/openapi.yaml @@ -1387,6 +1387,7 @@ paths: summary: Get a general health report tags: - health + security: [] x-openapi-router-controller: ibutsu_server.controllers.health_controller /health/database: get: diff --git a/backend/setup.py b/backend/setup.py index 6c2ecf10..32f3e013 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -6,7 +6,7 @@ REQUIRES = [ "alembic", "celery", - "connexion", + "connexion[swagger-ui]==2.14.2", "flask_bcrypt", "flask_cors", "flask_mail", diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index b6d6d721..a9998f46 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -9,11 +9,12 @@ services: working_dir: /mnt user: ${UID:-1000} volumes: - - "./frontend:/mnt" + - "./frontend:/mnt:z" ports: - "3000:3000" depends_on: - - backend + backend: + condition: service_healthy backend: environment: - JWT_SECRET=jwtsecret @@ -32,13 +33,20 @@ services: command: /bin/bash -c 'python -m venv .backend_env && source .backend_env/bin/activate && pip install -U pip setuptools wheel && pip install -r requirements.txt && python -m ibutsu_server --host 0.0.0.0' working_dir: /mnt volumes: - - "./backend:/mnt" + - "./backend:/mnt:z" user: ${UID:-1000} ports: - "8080:8080" depends_on: - - postgres - - redis + postgres: + condition: service_healthy + redis: + condition: service_started + healthcheck: + test: curl --output /dev/null --silent --head --fail http://localhost:8080/api/health + interval: 10s + timeout: 10s + retries: 5 worker: environment: - COLUMNS=80 @@ -54,17 +62,25 @@ services: command: /bin/bash -c 'python -m venv .worker_env && source .worker_env/bin/activate && pip install -U pip setuptools wheel && pip install -r requirements.txt && ./celery_worker.sh' working_dir: /mnt volumes: - - "./backend:/mnt" + - "./backend:/mnt:z" user: ${UID:-1000} depends_on: - - backend - - postgres - - redis + postgres: + condition: service_healthy + redis: + condition: service_started + backend: + condition: service_healthy postgres: environment: POSTGRES_USER: ibutsu POSTGRES_PASSWORD: ibutsu POSTGRES_DB: ibutsu - image: postgres:14 + image: postgres:15 + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U ibutsu" ] + interval: 5s + timeout: 5s + retries: 5 redis: image: redis:latest