Compare commits

..

6 Commits

9 changed files with 715 additions and 668 deletions
+7 -7
View File
@@ -32,7 +32,7 @@ Table Report:
#### Warning #### Warning
Please note that containers will use ports from 13241 to 13245 and 8080, so there is must be no listeners on this ports range. Please note that containers will use ports from 13240 to 13248, so there is must be no listeners on this ports range.
#### Configure #### Configure
@@ -66,7 +66,7 @@ docker compose up -d --build
#### Structure #### Structure
- **backend**: [127.0.0.1:8080](http://127.0.0.1:8080) -> `8080` - **backend**: [127.0.0.1:13240](http://127.0.0.1:13240) -> `8080`
- Depends on: `postgres`, `redis`, `minio`, `backend-initdb` - Depends on: `postgres`, `redis`, `minio`, `backend-initdb`
- **backend-initdb** - **backend-initdb**
- Depends on: `postgres`, `redis`, `minio` - Depends on: `postgres`, `redis`, `minio`
@@ -139,7 +139,7 @@ You may say: "For what we need a lot of complex technologies for now". I have an
### Restful API ### Restful API
API Base endpoint when deployed with default docker compose: [127.0.0.1:8080](http://127.0.0.1:8080), also see [docs](#openapi-docs). API Base endpoint when deployed with default docker compose: [127.0.0.1:13240](http://127.0.0.1:13240), also see [docs](#openapi-docs).
### Admin panel ### Admin panel
@@ -234,9 +234,9 @@ Moderation implemented via report system. Client goes to `/report` ([see OpenAPI
Also admin user (whose credentials specified lower) can add new staff members and even create a specified group for them (this is built-in django capabilities). Also admin user (whose credentials specified lower) can add new staff members and even create a specified group for them (this is built-in django capabilities).
Report has four states: Sent, Under review, Took action and Skipped. Admin panel has filtration by states and by flagged by llm status. Report has four states: Sent, Under review, Took action and Skipped. Admin panel has filtration by states and by flagged by llm status.
Admin panel when deployed with docker compose (by default): [localhost:8080/admin/](http://localhost:8080/admin/) Admin panel when deployed with docker compose (by default): [localhost:13240/admin/](http://localhost:13240/admin/)
Reports list when deployed with docker compose (requires authentication): [localhost:8080/admin/campaign/campaignreport/](http://localhost:8080/admin/campaign/campaignreport/) Reports list when deployed with docker compose (requires authentication): [localhost:13240/admin/campaign/campaignreport/](http://localhost:13240/admin/campaign/campaignreport/)
Default username: `admin` Default username: `admin`
@@ -276,11 +276,11 @@ Demonstration:
### OpenAPI docs ### OpenAPI docs
When deployed with default docker compose: [localhost:8080/docs](http://localhost:8080/docs) When deployed with default docker compose: [localhost:13240/docs](http://localhost:13240/docs)
### Healthcheck endpoint ### Healthcheck endpoint
When deployed with default docker compose: [localhost:8080/health](http://localhost:8080/health) When deployed with default docker compose: [localhost:13240/health](http://localhost:13240/health)
Lets developers easily understand and identify problem and users check services health. Lets developers easily understand and identify problem and users check services health.
+48 -18
View File
@@ -5,6 +5,9 @@ services:
build: build:
context: ./services/backend context: ./services/backend
dockerfile: Dockerfile dockerfile: Dockerfile
tags:
- adnova-backend:latest
pull: true
depends_on: depends_on:
backend-initdb: backend-initdb:
restart: false restart: false
@@ -18,10 +21,6 @@ services:
restart: false restart: false
condition: service_healthy condition: service_healthy
required: true required: true
minio:
restart: false
condition: service_healthy
required: true
env_file: env_file:
- path: ./infrastructure/backend/.env.template - path: ./infrastructure/backend/.env.template
required: true required: true
@@ -30,16 +29,20 @@ services:
ports: ports:
- name: web - name: web
target: 8080 target: 8080
published: 8080 published: 13240
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
backend-initdb: backend-initdb:
build: build:
context: ./services/backend context: ./services/backend
dockerfile: Dockerfile dockerfile: Dockerfile
tags:
- adnova-backend:latest
pull: true
command: ./scripts/initdb command: ./scripts/initdb
depends_on: depends_on:
postgres: postgres:
@@ -50,27 +53,27 @@ services:
restart: false restart: false
condition: service_healthy condition: service_healthy
required: true required: true
minio:
restart: false
condition: service_healthy
required: true
env_file: env_file:
- path: ./infrastructure/backend/.env.template - path: ./infrastructure/backend/.env.template
required: true required: true
- path: ./infrastructure/backend/.env - path: ./infrastructure/backend/.env
required: false required: false
shm_size: 4mb
backend-staticfiles: backend-staticfiles:
build: build:
context: ./services/backend context: ./services/backend
dockerfile: Dockerfile.staticfiles dockerfile: Dockerfile.staticfiles
tags:
- adnova-backend-staticfiles:latest
pull: true
env_file: env_file:
- path: ./infrastructure/backend/.env.template - path: ./infrastructure/backend/.env.template
required: true required: true
- path: ./infrastructure/backend/.env - path: ./infrastructure/backend/.env
required: false required: false
healthcheck: healthcheck:
test: ["CMD", "service", "nginx", "status", "||", " exit 1"] test: ["CMD-SHELL", "nginx", "-t", "||", "exit 1"]
interval: 1m30s interval: 1m30s
timeout: 5s timeout: 5s
start_period: 5s start_period: 5s
@@ -84,11 +87,15 @@ services:
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
backend-celery-worker: backend-celery-worker:
build: build:
context: ./services/backend context: ./services/backend
dockerfile: Dockerfile dockerfile: Dockerfile
tags:
- adnova-backend:latest
pull: true
command: celery -A config worker -l INFO command: celery -A config worker -l INFO
depends_on: depends_on:
redis: redis:
@@ -108,6 +115,7 @@ services:
start_period: 10s start_period: 10s
start_interval: 2s start_interval: 2s
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
celery-exporter: celery-exporter:
image: docker.io/danihodovic/celery-exporter:0.12.2 image: docker.io/danihodovic/celery-exporter:0.12.2
@@ -122,7 +130,10 @@ services:
required: true required: true
- path: ./infrastructure/celery-exporter/.env - path: ./infrastructure/celery-exporter/.env
required: false required: false
profiles:
- observability
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
telegram_bot: telegram_bot:
build: build:
@@ -130,6 +141,7 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
tags: tags:
- adnova-telegram_bot:latest - adnova-telegram_bot:latest
pull: true
depends_on: depends_on:
backend: backend:
restart: false restart: false
@@ -148,7 +160,10 @@ services:
required: true required: true
- path: ./infrastructure/telegram_bot/.env - path: ./infrastructure/telegram_bot/.env
required: false required: false
profiles:
- telegram_bot
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
redis: redis:
image: docker.io/redis:7-alpine3.21 image: docker.io/redis:7-alpine3.21
@@ -187,6 +202,8 @@ services:
required: true required: true
- path: ./infrastructure/redis-exporter/.env - path: ./infrastructure/redis-exporter/.env
required: false required: false
profiles:
- observability
restart: unless-stopped restart: unless-stopped
shm_size: 4mb shm_size: 4mb
@@ -201,7 +218,7 @@ services:
- path: ./infrastructure/postgres/.env - path: ./infrastructure/postgres/.env
required: false required: false
healthcheck: healthcheck:
test: ["CMD", "pg_isready"] test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 1m30s interval: 1m30s
timeout: 5s timeout: 5s
start_period: 5s start_period: 5s
@@ -230,6 +247,8 @@ services:
required: true required: true
- path: ./infrastructure/postgres-exporter/.env - path: ./infrastructure/postgres-exporter/.env
required: false required: false
profiles:
- observability
restart: unless-stopped restart: unless-stopped
shm_size: 4mb shm_size: 4mb
@@ -262,6 +281,8 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
profiles:
- observability
restart: unless-stopped restart: unless-stopped
secrets: secrets:
- source: pgadmin_password - source: pgadmin_password
@@ -274,10 +295,10 @@ services:
grafana: grafana:
image: docker.io/grafana/grafana-oss:12.0.2 image: docker.io/grafana/grafana-oss:12.0.2
entrypoint: ["/etc/grafana/scripts/entrypoint.sh"]
configs: configs:
- source: grafana_config - source: grafana_config
target: /usr/share/grafana/conf/defaults.ini target: /usr/share/grafana/conf/defaults.ini
entrypoint: ["/etc/grafana/scripts/entrypoint.sh"]
healthcheck: healthcheck:
test: ["CMD", "wget", "-O", "-", "http://localhost:3000/api/health"] test: ["CMD", "wget", "-O", "-", "http://localhost:3000/api/health"]
interval: 1m30s interval: 1m30s
@@ -292,6 +313,8 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
profiles:
- observability
restart: unless-stopped restart: unless-stopped
shm_size: 4mb shm_size: 4mb
volumes: volumes:
@@ -325,6 +348,8 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
profiles:
- observability
restart: unless-stopped restart: unless-stopped
shm_size: 4mb shm_size: 4mb
volumes: volumes:
@@ -360,7 +385,10 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
profiles:
- minio
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
volumes: volumes:
- type: volume - type: volume
source: minio_data source: minio_data
@@ -382,18 +410,17 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
- name: api profiles:
target: 9411 - observability
published: 13247
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
loadtest: loadtest:
build: build:
context: ./services/loadtest context: ./services/loadtest
dockerfile: Dockerfile dockerfile: Dockerfile
tags:
- adnova-loadtest:latest
depends_on: depends_on:
backend: backend:
restart: false restart: false
@@ -411,7 +438,10 @@ services:
host_ip: 127.0.0.1 host_ip: 127.0.0.1
protocol: tcp protocol: tcp
app_protocol: http app_protocol: http
profiles:
- loadtest
restart: unless-stopped restart: unless-stopped
shm_size: 4mb
volumes: volumes:
redis_data: redis_data:
File diff suppressed because it is too large Load Diff
@@ -1,11 +1,13 @@
apiVersion: 1 apiVersion: 1
providers: providers:
- name: "celery" - name: "default"
orgId: 1 orgId: 1
folder: "" folder: ""
type: file type: file
disableDeletion: false
updateIntervalSeconds: 10 updateIntervalSeconds: 10
allowUiUpdates: false
options: options:
path: /etc/grafana/provisioning/dashboards path: /etc/grafana/provisioning/dashboards
foldersFromFilesStructure: true foldersFromFilesStructure: true
@@ -1,10 +1,29 @@
apiVersion: 1 apiVersion: 1
datasources: datasources:
- name: Infinity - name: Backend | Infinity
type: yesoreyeram-infinity-datasource type: yesoreyeram-infinity-datasource
access: proxy access: proxy
orgId: 1 orgId: 1
uid: infinity uid: infinity
url: http://backend:8080
basicAuth: false
basicAuthUser: ""
withCredentials: false
isDefault: false isDefault: false
editable: false editable: false
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
uid: prometheus
url: http://prometheus:9090
basicAuth: false
basicAuthUser: ""
withCredentials: false
isDefault: true
editable: false
jsonData:
httpMethod: POST
queryTimeout: 10s
timeInterval": 10s
+1 -1
View File
@@ -1,3 +1,3 @@
# Below all environment variables and default values # Below all environment variables and default values
BACKEND_BASE_URL=http://127.0.0.1:8080 BACKEND_BASE_URL=http://127.0.0.1:13240
+1 -1
View File
@@ -11,7 +11,7 @@ Ensure you have the following installed on your system:
## Warning ## Warning
Please note that containers will use ports from 13241 to 13246 and 8080, so there is must be no listeners on this ports range. Please note that containers will use ports from 13240 to 13248, so there is must be no listeners on this ports range.
## Setup ## Setup
+1 -1
View File
@@ -9,7 +9,7 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
BACKEND_BASE_URL = os.getenv("BACKEND_BASE_URL", "http://127.0.0.1:8080") BACKEND_BASE_URL = os.getenv("BACKEND_BASE_URL", "http://127.0.0.1:13240")
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)