Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .env.example

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ permissions:

jobs:
lint-and-test:
uses: esclient/tools/.github/workflows/lint-and-test-python.yml@main
uses: esclient/tools/.github/workflows/lint-and-test-python.yml@v1.0.4
with:
python-version: '3.13.7'
secrets: inherit
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
56 changes: 0 additions & 56 deletions .just/common.just

This file was deleted.

22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
FROM python:3.13-slim

RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y wget curl jq && \
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && \
chmod +x /usr/local/bin/yq && \
apt-get remove -y wget && apt-get autoremove -y && \
apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN pip install --no-cache-dir pdm

COPY pyproject.toml pdm.lock ./
RUN pdm export --group dev --without-hashes -f requirements > /tmp/req.text \
&& pip install --no-cache-dir -r /tmp/req.text \
&& rm /tmp/req.text
RUN pip install --no-cache-dir pdm && \
pdm export --without-hashes -f requirements > /tmp/req.txt && \
pip install --no-cache-dir -r /tmp/req.txt && \
pip uninstall -y pdm && \
rm /tmp/req.txt

COPY . .
RUN pip install --no-cache-dir -e .
RUN chmod +x tools/load_envs.sh

ENV ENV=prod
ENV PYTHONPATH=src

CMD ["watchfiles", "run-server"]
CMD ["./tools/load_envs.sh", "watchfiles", "run-server"]
13 changes: 13 additions & 0 deletions configs/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DATABASE_URL: "postgresql://esclient_devmods:XKP$GP2RAJXDVFeR@pg4.sweb.ru:5433/esclient_devmods"
HOST: "0.0.0.0"
PORT: "7004"

LOG_LEVEL: "INFO"
LOG_FORMAT: "%(asctime)s %(levelname)-8s [%(name)s] %(message)s"
LOG_DATEFMT: "%Y-%m-%d %H:%M:%S"

S3_API_ENDPOINT: "https://s3.esclient.ru"
S3_ACCESS_KEY: "dev-access"
S3_SECRET_KEY: "5ece9238b18dc29d5e0724b3ae577cdf90b8f78b5eaf62ca"
S3_BUCKET_NAME: "dev"
S3_VERIFY: "true"
13 changes: 13 additions & 0 deletions configs/prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DATABASE_URL: "{vault:mod-service/prod#database_url}"
HOST: "{vault:mod-service/prod#host}"
PORT: "{vault:mod-service/prod#port}"

LOG_LEVEL: "WARN"
LOG_FORMAT: "%(asctime)s %(levelname)-8s [%(name)s] %(message)s"
LOG_DATEFMT: "%Y-%m-%d %H:%M:%S"

S3_API_ENDPOINT: "https://s3.esclient.ru"
S3_ACCESS_KEY: "{vault:mod-service/prod#s3_access_key}"
S3_SECRET_KEY: "{vault:mod-service/prod#s3_secret_key}"
S3_BUCKET_NAME: "prod"
S3_VERIFY: "true"
27 changes: 11 additions & 16 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
set windows-shell := ["powershell", "-NoProfile", "-Command"]
set windows-shell := ["sh", "-c"]
set dotenv-load := true

COMMON_URL := 'https://raw.githubusercontent.com/esclient/tools/refs/heads/main/python/common.just'
COMMON_JUST_URL := 'https://raw.githubusercontent.com/esclient/tools/refs/heads/main/python/common.just'
LOAD_ENVS_URL := 'https://raw.githubusercontent.com/esclient/tools/refs/heads/main/load_envs.sh'

PROTO_TAG := 'v0.1.2'
PROTO_NAME := 'mod.proto'
TMP_DIR := '.proto'
OUT_DIR := 'src/modservice/grpc'
SERVICE_NAME := 'mod'

MKDIR_DOTJUST := if os() == 'windows' {
'New-Item -ItemType Directory -Force -Path ".just" | Out-Null'
} else {
'mkdir -p .just'
}
MKDIR_TOOLS := 'mkdir -p tools'

FETCH_CMD := if os() == 'windows' {
'Invoke-WebRequest -Uri ' + COMMON_URL + ' -OutFile .just/common.just'
} else {
'curl -fsSL ' + COMMON_URL + ' -o .just/common.just'
}
FETCH_COMMON_JUST := 'curl -fsSL ' + COMMON_JUST_URL + ' -o tools/common.just'
FETCH_LOAD_ENVS := 'curl -fsSL ' + LOAD_ENVS_URL + ' -o tools/load_envs.sh'

import? '.just/common.just'
import? 'tools/common.just'

default:
@just --list

fetch-common:
{{ MKDIR_DOTJUST }}
{{ FETCH_CMD }}
fetch-tools:
{{ MKDIR_TOOLS }}
{{ FETCH_COMMON_JUST }}
{{ FETCH_LOAD_ENVS }}
Loading
Loading