[TC-837] Update base template configs
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.git
|
||||||
|
local.env
|
||||||
|
.helm
|
||||||
|
docker-compose.yml
|
||||||
|
Makefile
|
||||||
|
Dockerfile
|
||||||
|
local.env.example
|
||||||
|
README.md
|
||||||
@@ -1,12 +1,36 @@
|
|||||||
|
podAnnotations:
|
||||||
|
vault.security.banzaicloud.io/vault-addr: https://vault.avroid.tech
|
||||||
|
vault.security.banzaicloud.io/vault-path: avroid-office
|
||||||
|
vault.security.banzaicloud.io/vault-role: tavro-cloud-dev
|
||||||
|
vault.security.banzaicloud.io/vault-skip-verify: "true"
|
||||||
|
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
|
|
||||||
extraEnv:
|
extraEnv:
|
||||||
POSTGRES_DSN:
|
- name: POSTGRES_DSN
|
||||||
value: "postgresql://test:test@postgresql:5432/messenger"
|
value: "vault:path/to/service/secrets/svc-template-backend-service#POSTGRES_DSN"
|
||||||
PORT:
|
- name: PORT
|
||||||
value: "8000"
|
value: "8000"
|
||||||
ENVIRONMENT:
|
- name: ENVIRONMENT
|
||||||
value: "dev"
|
value: "dev"
|
||||||
|
|
||||||
service:
|
service:
|
||||||
port: 8000
|
port: 8000
|
||||||
|
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: harbor-registry-secret
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
hosts:
|
||||||
|
- host: s-template-backend-service-dev.avroid.tech
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
tls:
|
||||||
|
- secretName: avroid-tech-tls
|
||||||
|
hosts:
|
||||||
|
- s-template-backend-service-dev.avroid.tech
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
|
podAnnotations:
|
||||||
|
vault.security.banzaicloud.io/vault-addr: https://vault.avroid.tech
|
||||||
|
vault.security.banzaicloud.io/vault-path:
|
||||||
|
vault.security.banzaicloud.io/vault-role: tavro-cloud
|
||||||
|
vault.security.banzaicloud.io/vault-skip-verify: "true"
|
||||||
|
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
|
|
||||||
extraEnv:
|
extraEnv:
|
||||||
POSTGRES_DSN:
|
- name: POSTGRES_DSN
|
||||||
value: "postgresql://test:test@postgresql:5432/messenger"
|
value: "vault:path/to/service/secrets/svc-template-backend-service#POSTGRES_DSN"
|
||||||
PORT:
|
- name: PORT
|
||||||
value: "8000"
|
value: "8000"
|
||||||
ENVIRONMENT:
|
- name: ENVIRONMENT
|
||||||
value: "prod"
|
value: "prod"
|
||||||
|
|
||||||
service:
|
service:
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
|
podAnnotations:
|
||||||
|
vault.security.banzaicloud.io/vault-addr: https://vault.avroid.tech
|
||||||
|
vault.security.banzaicloud.io/vault-path: avroid-office
|
||||||
|
vault.security.banzaicloud.io/vault-role: tavro-cloud-stage
|
||||||
|
vault.security.banzaicloud.io/vault-skip-verify: "true"
|
||||||
|
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
|
|
||||||
extraEnv:
|
extraEnv:
|
||||||
POSTGRES_DSN:
|
- name: POSTGRES_DSN
|
||||||
value: "postgresql://test:test@postgresql:5432/messenger"
|
value: "vault:path/to/service/secrets/svc-template-backend-service#POSTGRES_DSN"
|
||||||
PORT:
|
- name: PORT
|
||||||
value: "8000"
|
value: "8000"
|
||||||
ENVIRONMENT:
|
- name: ENVIRONMENT
|
||||||
value: "stage"
|
value: "stage"
|
||||||
|
|
||||||
service:
|
service:
|
||||||
|
|||||||
@@ -1,12 +1,36 @@
|
|||||||
|
podAnnotations:
|
||||||
|
vault.security.banzaicloud.io/vault-addr: https://vault.avroid.tech
|
||||||
|
vault.security.banzaicloud.io/vault-path: avroid-office
|
||||||
|
vault.security.banzaicloud.io/vault-role: tavro-cloud-test
|
||||||
|
vault.security.banzaicloud.io/vault-skip-verify: "true"
|
||||||
|
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
|
|
||||||
extraEnv:
|
extraEnv:
|
||||||
POSTGRES_DSN:
|
- name: POSTGRES_DSN
|
||||||
value: "postgresql://test:test@postgresql:5432/messenger"
|
value: "vault:path/to/service/secrets/svc-template-backend-service#POSTGRES_DSN"
|
||||||
PORT:
|
- name: PORT
|
||||||
value: "8000"
|
value: "8000"
|
||||||
ENVIRONMENT:
|
- name: ENVIRONMENT
|
||||||
value: "test"
|
value: "test"
|
||||||
|
|
||||||
service:
|
service:
|
||||||
port: 8000
|
port: 8000
|
||||||
|
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: harbor-registry-secret
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
hosts:
|
||||||
|
- host: s-template-backend-service-test.avroid.tech
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
tls:
|
||||||
|
- secretName: avroid-tech-tls
|
||||||
|
hosts:
|
||||||
|
- s-template-backend-service-test.avroid.tech
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: ImplementationSpecific
|
||||||
21
Dockerfile
21
Dockerfile
@@ -3,18 +3,23 @@ FROM harbor.avroid.tech/docker-hub-proxy/python:3.12
|
|||||||
ARG PIP_INDEX_URL
|
ARG PIP_INDEX_URL
|
||||||
|
|
||||||
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
|
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
|
||||||
|
ENV UID=999
|
||||||
|
ENV GID=999
|
||||||
|
ENV USER_NAME=app
|
||||||
|
ENV USER_GROUP=${USER_NAME}
|
||||||
|
ENV USER_HOME=/${USER_NAME}
|
||||||
|
|
||||||
WORKDIR /app
|
RUN groupadd -g ${GID} ${USER_GROUP} \
|
||||||
|
&& useradd -r -g ${GID} -u ${UID} -d ${USER_HOME} ${USER_NAME} \
|
||||||
|
&& pip --no-cache-dir install poetry==2.0.1
|
||||||
|
|
||||||
|
USER ${USER_NAME}
|
||||||
|
|
||||||
|
WORKDIR ${USER_HOME}
|
||||||
|
|
||||||
COPY pyproject.toml poetry.lock ./
|
COPY pyproject.toml poetry.lock ./
|
||||||
|
|
||||||
RUN pip --no-cache-dir install poetry \
|
RUN poetry install --with=dev --no-root --no-cache
|
||||||
&& poetry export \
|
|
||||||
--with=dev,tests,format \
|
|
||||||
--without-hashes \
|
|
||||||
-f requirements.txt \
|
|
||||||
-o requirements.txt \
|
|
||||||
&& pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
networks:
|
networks:
|
||||||
cloud-messenger:
|
tavro-cloud:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
@@ -7,9 +7,13 @@ volumes:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
template-backend-service:
|
template-backend-service:
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
PIP_INDEX_URL: "https://nexus.avroid.tech/repository/all-pypi-proxy/simple"
|
||||||
env_file: "local.env"
|
env_file: "local.env"
|
||||||
container_name: template-backend-service
|
container_name: template-backend-service
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app
|
- ./:/app
|
||||||
environment:
|
environment:
|
||||||
@@ -18,14 +22,14 @@ services:
|
|||||||
LOGGING: '{"json_enabled": true, "level": "INFO"}'
|
LOGGING: '{"json_enabled": true, "level": "INFO"}'
|
||||||
POSTGRES_DSN: postgresql://messenger:messenger@postgresql:5432/messenger
|
POSTGRES_DSN: postgresql://messenger:messenger@postgresql:5432/messenger
|
||||||
networks:
|
networks:
|
||||||
- cloud-messenger
|
- tavro-cloud
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgresql
|
- postgresql
|
||||||
|
|
||||||
postgresql:
|
postgresql:
|
||||||
image: postgres:14.0
|
image: postgres:17.0
|
||||||
container_name: template-backend-service-db
|
container_name: template-backend-service-db
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
@@ -35,7 +39,7 @@ services:
|
|||||||
POSTGRES_PASSWORD: messenger
|
POSTGRES_PASSWORD: messenger
|
||||||
POSTGRES_DB: messenger
|
POSTGRES_DB: messenger
|
||||||
networks:
|
networks:
|
||||||
- cloud-messenger
|
- tavro-cloud
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
2
entry.sh
2
entry.sh
@@ -9,4 +9,4 @@ alembic upgrade head
|
|||||||
# alembic --name specific_scheme upgrade head
|
# alembic --name specific_scheme upgrade head
|
||||||
|
|
||||||
# Start application
|
# Start application
|
||||||
python -m src.api_app
|
poetry run python -m src.api_app
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
POSTGRES_DSN=postgresql://postgres_user:postgres_password@postgres_host:5432/db
|
POSTGRES_DSN=postgresql://postgres_user:postgres_password@postgres_host:5432/db
|
||||||
PORT=8000
|
PORT=8000
|
||||||
|
HOST=0.0.0.0
|
||||||
|
|||||||
897
poetry.lock
generated
897
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "template-backend-service"
|
name = "template-backend-service"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Nadezhda Lavrenteva <nadezhda.lavrentieva@avroid.team>"]
|
authors = ["Nadezhda Lavrenteva <nadezhda.lavrentieva@avroid.team>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@@ -8,7 +8,7 @@ readme = "README.md"
|
|||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">=3.12 <3.13"
|
python = ">=3.12 <3.13"
|
||||||
coverage = "^7.6.1"
|
coverage = "^7.6.1"
|
||||||
avroid-service-lib = "^0.0.3"
|
avroid-service-lib = "^0.0.6"
|
||||||
|
|
||||||
[[tool.poetry.source]]
|
[[tool.poetry.source]]
|
||||||
name = "nexus"
|
name = "nexus"
|
||||||
@@ -40,9 +40,9 @@ ruff = "^0.6.8"
|
|||||||
pre-commit = "^3.8.0"
|
pre-commit = "^3.8.0"
|
||||||
|
|
||||||
[tool.poetry.group.tests.dependencies]
|
[tool.poetry.group.tests.dependencies]
|
||||||
|
pytest-mock = "^3.14.0"
|
||||||
pytest-asyncio = "^0.24.0"
|
pytest-asyncio = "^0.24.0"
|
||||||
pytest-cov = "^5.0.0"
|
pytest-cov = "^5.0.0"
|
||||||
pytest-mock = "^3.14.0"
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
@@ -64,7 +64,7 @@ warn_unused_ignores = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
strict_equality = true
|
strict_equality = true
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
plugins = ['pydantic.mypy']
|
plugins = ["pydantic.mypy"]
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = "tests.*,migrations.*"
|
module = "tests.*,migrations.*"
|
||||||
@@ -73,11 +73,13 @@ ignore_errors = true
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
||||||
[tool.ruff.lint]
|
|
||||||
|
|
||||||
select = ["E", "F", "W", "C90", "I", "N", "UP", "YTT", "ASYNC", "S", "B", "C4", "DTZ", "T10", "ISC", "ICN",
|
[tool.ruff.lint]
|
||||||
|
select = [
|
||||||
|
"E", "F", "W", "C90", "I", "N", "UP", "YTT", "ASYNC", "S", "B", "C4", "DTZ", "T10", "ISC", "ICN",
|
||||||
"PIE", "T20", "PT", "Q", "RET", "SLF", "SIM", "ERA", "PLE", "TRY", "PYI", "PERF", "LOG", "RUF008",
|
"PIE", "T20", "PT", "Q", "RET", "SLF", "SIM", "ERA", "PLE", "TRY", "PYI", "PERF", "LOG", "RUF008",
|
||||||
"RUF009", "RUF012", "RUF013", "RUF015", "RUF019", "RUF100", "RUF200"]
|
"RUF009", "RUF012", "RUF013", "RUF015", "RUF019", "RUF100", "RUF200"
|
||||||
|
]
|
||||||
unfixable = [
|
unfixable = [
|
||||||
"ERA", # do not autoremove commented out code
|
"ERA", # do not autoremove commented out code
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from src.settings import WebAppSettings
|
|||||||
|
|
||||||
class PGConnector:
|
class PGConnector:
|
||||||
def __init__(self, settings: WebAppSettings) -> None:
|
def __init__(self, settings: WebAppSettings) -> None:
|
||||||
self.pg_engine = create_engine(settings.postgres_dsn)
|
self.pg_engine = create_engine(str(settings.postgres_dsn))
|
||||||
self.pg_session = sessionmaker(self.pg_engine, class_=Session)
|
self.pg_session = sessionmaker(self.pg_engine, class_=Session)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from avroid_service_lib import BaseAppSettings
|
|||||||
|
|
||||||
class WebAppSettings(BaseAppSettings):
|
class WebAppSettings(BaseAppSettings):
|
||||||
postgres_dsn: str
|
postgres_dsn: str
|
||||||
|
host: str = "0.0.0.0"
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
env_file = "local.env"
|
env_file = "local.env"
|
||||||
|
|||||||
Reference in New Issue
Block a user