Skip to content

Commit 4c22429

Browse files
2.0.0b2
#### Changelog: * Feature: Use centrifugo to notify browser about new history lines. * Fix: Performance issues when rendering history lines. * Feature: Add centrifugo and traefik to docker-compose. * Service: Change `HistoryLines.id` to `BigAutoField` and `HistoryLines.line` to `TextField`. * Service: Update vstutils 5.0.0b123. See merge request polemarch/ce!234
2 parents 6ef1175 + 9fa9b33 commit 4c22429

22 files changed

+279
-97
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ release_pypi:
151151

152152
publish_docker:
153153
stage: publish
154-
image: vstconsulting/images:tox
154+
image: vstconsulting/images:ubuntu
155155
services:
156156
- name: 'docker:19.03-dind'
157157
alias: 'docker_service_host'

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ RUN --mount=type=cache,target=/var/cache/apt \
3232
git \
3333
sudo \
3434
sshpass \
35+
libpcre3 \
36+
libpcre3-dev \
3537
python3.8-dev \
3638
libldap2-dev \
3739
libldap-2.4-2 \
@@ -53,6 +55,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
5355
mkdir -p /projects /hooks /run/openldap /etc/polemarch/hooks && \
5456
python3.8 -m pip install /polemarch_env/dist/$(ls /polemarch_env/dist/ | grep "\.tar\.gz" | tail -1)[mysql,postgresql] && \
5557
apt remove -y \
58+
libpcre3-dev \
5659
python3.8-dev \
5760
libldap2-dev \
5861
libsasl2-dev \

autobuild.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env bash
21
CURRENT_VERSION=$(python3 setup.py --version | tr -d '\n')
32
TAG=$(git tag -l | tail -1 | tr -d '\n')
43
REGISTRY_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}"
@@ -7,11 +6,11 @@ export DOCKER_BUILDKIT=1
76
export COMPOSE_DOCKER_CLI_BUILD=1
87

98
docker_worker (){
10-
docker tag ce_polemarch $1:$2
9+
docker tag polemarch $1:$2
1110
docker push $1:$2
1211
}
1312

14-
docker-compose build polemarch
13+
docker-compose build polemarch | exit 1
1514

1615
docker login -u "${CI_REGISTRY_USER}" -p "${CI_BUILD_TOKEN}" "${CI_REGISTRY}"
1716
docker login -u "${POLEMARCH_DOCKER_USER}" -p "${POLEMARCH_DOCKER_PASSWORD}"

doc/api_schema.yaml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ info:
1717
docs_url: /docs/
1818
x-links:
1919
Request:
20-
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%201.8.5
20+
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%202.0.0b1
2121
name: Question
22-
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%201.8.5
22+
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%202.0.0b1
2323
name: Bug report
2424
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Feature%20request&issue%5Btitle%5D=
2525
name: Feature request
@@ -66,9 +66,9 @@ info:
6666
logout_url: /account/logout/
6767
login_url: /account/login/
6868
x-versions:
69-
application: 1.8.5
70-
library: 1.8.5
71-
vstutils: 5.0.0b118
69+
application: 2.0.0b1
70+
library: 2.0.0b1
71+
vstutils: 5.0.0b122
7272
django: 3.2.12
7373
djangorestframework: 3.13.1
7474
drf_yasg: 1.20.0
@@ -11969,14 +11969,13 @@ definitions:
1196911969
maximum: 4
1197011970
Module:
1197111971
required:
11972-
- group
1197311972
- module
11974-
- args
1197511973
type: object
1197611974
properties:
1197711975
group:
1197811976
title: Group
1197911977
type: string
11978+
default: all
1198011979
minLength: 1
1198111980
module:
1198211981
title: Module
@@ -11991,7 +11990,7 @@ definitions:
1199111990
args:
1199211991
title: Arguments
1199311992
type: string
11994-
minLength: 1
11993+
default: ''
1199511994
vars:
1199611995
type: object
1199711996
properties:
@@ -12335,14 +12334,13 @@ definitions:
1233512334
maximum: 4
1233612335
Module:
1233712336
required:
12338-
- group
1233912337
- module
12340-
- args
1234112338
type: object
1234212339
properties:
1234312340
group:
1234412341
title: Group
1234512342
type: string
12343+
default: all
1234612344
minLength: 1
1234712345
module:
1234812346
title: Module
@@ -12357,7 +12355,7 @@ definitions:
1235712355
args:
1235812356
title: Arguments
1235912357
type: string
12360-
minLength: 1
12358+
default: ''
1236112359
vars:
1236212360
type: object
1236312361
properties:
@@ -12734,14 +12732,13 @@ definitions:
1273412732
maximum: 4
1273512733
Module:
1273612734
required:
12737-
- group
1273812735
- module
12739-
- args
1274012736
type: object
1274112737
properties:
1274212738
group:
1274312739
title: Group
1274412740
type: string
12741+
default: all
1274512742
minLength: 1
1274612743
module:
1274712744
title: Module
@@ -12756,7 +12753,7 @@ definitions:
1275612753
args:
1275712754
title: Arguments
1275812755
type: string
12759-
minLength: 1
12756+
default: ''
1276012757
vars:
1276112758
type: object
1276212759
properties:
@@ -13087,14 +13084,13 @@ definitions:
1308713084
maximum: 4
1308813085
Module:
1308913086
required:
13090-
- group
1309113087
- module
13092-
- args
1309313088
type: object
1309413089
properties:
1309513090
group:
1309613091
title: Group
1309713092
type: string
13093+
default: all
1309813094
minLength: 1
1309913095
module:
1310013096
title: Module
@@ -13109,7 +13105,7 @@ definitions:
1310913105
args:
1311013106
title: Arguments
1311113107
type: string
13112-
minLength: 1
13108+
default: ''
1311313109
vars:
1311413110
type: object
1311513111
properties:

docker-compose.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
version: '3'
22

33
services:
4+
traefik:
5+
image: traefik:2.6
6+
restart: unless-stopped
7+
volumes:
8+
- ./traefik_dynamic.yml:/traefik_dynamic.yml:ro
9+
environment:
10+
TRAEFIK_PROVIDERS_FILE_FILENAME: "/traefik_dynamic.yml"
11+
TRAEFIK_PING: "true"
12+
TRAEFIK_ENTRYPOINTS_HTTP_ADDRESS: ":80"
13+
healthcheck:
14+
test: [ "CMD", "traefik", "healthcheck" ]
15+
interval: 3s
16+
timeout: 3s
17+
retries: 3
18+
ports:
19+
- "8080:80"
420

521
polemarch:
22+
image: polemarch
623
build: .
724
restart: unless-stopped
825
depends_on:
@@ -16,8 +33,6 @@ services:
1633
tty: true
1734
volumes:
1835
- ./settings.ini:/etc/polemarch/settings.ini:ro
19-
ports:
20-
- "8080:8080"
2136

2237
redis:
2338
image: "redis:6"
@@ -40,6 +55,27 @@ services:
4055
volumes:
4156
- data-volume:/var/lib/mysql
4257

58+
centrifugo:
59+
image: centrifugo/centrifugo:v3
60+
restart: unless-stopped
61+
tty: true
62+
environment:
63+
CENTRIFUGO_TOKEN_HMAC_SECRET_KEY: "d4074fd2-607c-41b0-ab83-f2bc55fae0ec"
64+
CENTRIFUGO_API_KEY: "a08caef0-f1ad-40de-9e59-dd2cec07e2eb"
65+
CENTRIFUGO_ADMIN: "true"
66+
CENTRIFUGO_ADMIN_PASSWORD: "01a18ca9-9328-4ee7-a8de-7e5b231d1df4"
67+
CENTRIFUGO_ADMIN_SECRET: "7e91c9c1-6303-42b1-9f28-1cdfbf58dcf9"
68+
CENTRIFUGO_HISTORY_SIZE: "10"
69+
CENTRIFUGO_HISTORY_TTL: "300s"
70+
CENTRIFUGO_HEALTH: "true"
71+
CENTRIFUGO_ALLOWED_ORIGINS: "*"
72+
healthcheck:
73+
test: [ "CMD", "sh", "-c", "wget -nv -O - http://localhost:8000/health" ]
74+
interval: 3s
75+
timeout: 3s
76+
retries: 3
77+
command: centrifugo
78+
4379
volumes:
4480
data-volume:
4581

frontend_src_new/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
'vue/html-self-closing': ['error', { html: { void: 'any' } }],
2020
'vue/max-attributes-per-line': 'off',
2121
'vue/multi-word-component-names': 'off',
22+
'vue/one-component-per-file': 'off',
2223
},
2324
globals: {
2425
spa: 'readonly',
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/** @vue/component */
2+
export const ExecutionTimeFieldMixin = {
3+
data() {
4+
return {
5+
intervalId: null,
6+
generatedTime: null,
7+
};
8+
},
9+
computed: {
10+
shouldGenerateTime() {
11+
return this.$app.centrifugoClient && ['RUN', 'DELAY'].includes(this.data.status);
12+
},
13+
value() {
14+
if (this.shouldGenerateTime) {
15+
return this.generatedTime;
16+
}
17+
return this.data[this.field.name];
18+
},
19+
},
20+
watch: {
21+
shouldGenerateTime: {
22+
immediate: true,
23+
handler(value) {
24+
if (value && !this.intervalId) {
25+
this.intervalId = setInterval(() => this.updateGeneratedTime(), 1000);
26+
} else {
27+
clearInterval(this.intervalId);
28+
}
29+
},
30+
},
31+
},
32+
methods: {
33+
updateGeneratedTime() {
34+
this.generatedTime = this.$u.getTimeInUptimeFormat(
35+
window.moment.duration(window.moment().diff(this.data.start_time)).asSeconds(),
36+
);
37+
},
38+
},
39+
};
40+
41+
export class ExecutionTimeField extends spa.fields.datetime.UptimeField {
42+
static format = 'execution-time';
43+
44+
static get mixins() {
45+
return super.mixins.concat(ExecutionTimeFieldMixin);
46+
}
47+
}
48+
49+
spa.signals.once('APP_CREATED', (app) => {
50+
app.fieldsResolver.registerField('integer', ExecutionTimeField.format, ExecutionTimeField);
51+
});

0 commit comments

Comments
 (0)