Skip to content

Commit

Permalink
2.0.0b2
Browse files Browse the repository at this point in the history
#### 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
  • Loading branch information
onegreyonewhite committed Apr 20, 2022
2 parents 6ef1175 + 9fa9b33 commit 4c22429
Show file tree
Hide file tree
Showing 22 changed files with 279 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ release_pypi:

publish_docker:
stage: publish
image: vstconsulting/images:tox
image: vstconsulting/images:ubuntu
services:
- name: 'docker:19.03-dind'
alias: 'docker_service_host'
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ RUN --mount=type=cache,target=/var/cache/apt \
git \
sudo \
sshpass \
libpcre3 \
libpcre3-dev \
python3.8-dev \
libldap2-dev \
libldap-2.4-2 \
Expand All @@ -53,6 +55,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
mkdir -p /projects /hooks /run/openldap /etc/polemarch/hooks && \
python3.8 -m pip install /polemarch_env/dist/$(ls /polemarch_env/dist/ | grep "\.tar\.gz" | tail -1)[mysql,postgresql] && \
apt remove -y \
libpcre3-dev \
python3.8-dev \
libldap2-dev \
libsasl2-dev \
Expand Down
5 changes: 2 additions & 3 deletions autobuild.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash
CURRENT_VERSION=$(python3 setup.py --version | tr -d '\n')
TAG=$(git tag -l | tail -1 | tr -d '\n')
REGISTRY_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}"
Expand All @@ -7,11 +6,11 @@ export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1

docker_worker (){
docker tag ce_polemarch $1:$2
docker tag polemarch $1:$2
docker push $1:$2
}

docker-compose build polemarch
docker-compose build polemarch | exit 1

docker login -u "${CI_REGISTRY_USER}" -p "${CI_BUILD_TOKEN}" "${CI_REGISTRY}"
docker login -u "${POLEMARCH_DOCKER_USER}" -p "${POLEMARCH_DOCKER_PASSWORD}"
Expand Down
30 changes: 13 additions & 17 deletions doc/api_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ info:
docs_url: /docs/
x-links:
Request:
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%201.8.5
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%202.0.0b1
name: Question
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%201.8.5
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%202.0.0b1
name: Bug report
- url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Feature%20request&issue%5Btitle%5D=
name: Feature request
Expand Down Expand Up @@ -66,9 +66,9 @@ info:
logout_url: /account/logout/
login_url: /account/login/
x-versions:
application: 1.8.5
library: 1.8.5
vstutils: 5.0.0b118
application: 2.0.0b1
library: 2.0.0b1
vstutils: 5.0.0b122
django: 3.2.12
djangorestframework: 3.13.1
drf_yasg: 1.20.0
Expand Down Expand Up @@ -11969,14 +11969,13 @@ definitions:
maximum: 4
Module:
required:
- group
- module
- args
type: object
properties:
group:
title: Group
type: string
default: all
minLength: 1
module:
title: Module
Expand All @@ -11991,7 +11990,7 @@ definitions:
args:
title: Arguments
type: string
minLength: 1
default: ''
vars:
type: object
properties:
Expand Down Expand Up @@ -12335,14 +12334,13 @@ definitions:
maximum: 4
Module:
required:
- group
- module
- args
type: object
properties:
group:
title: Group
type: string
default: all
minLength: 1
module:
title: Module
Expand All @@ -12357,7 +12355,7 @@ definitions:
args:
title: Arguments
type: string
minLength: 1
default: ''
vars:
type: object
properties:
Expand Down Expand Up @@ -12734,14 +12732,13 @@ definitions:
maximum: 4
Module:
required:
- group
- module
- args
type: object
properties:
group:
title: Group
type: string
default: all
minLength: 1
module:
title: Module
Expand All @@ -12756,7 +12753,7 @@ definitions:
args:
title: Arguments
type: string
minLength: 1
default: ''
vars:
type: object
properties:
Expand Down Expand Up @@ -13087,14 +13084,13 @@ definitions:
maximum: 4
Module:
required:
- group
- module
- args
type: object
properties:
group:
title: Group
type: string
default: all
minLength: 1
module:
title: Module
Expand All @@ -13109,7 +13105,7 @@ definitions:
args:
title: Arguments
type: string
minLength: 1
default: ''
vars:
type: object
properties:
Expand Down
40 changes: 38 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
version: '3'

services:
traefik:
image: traefik:2.6
restart: unless-stopped
volumes:
- ./traefik_dynamic.yml:/traefik_dynamic.yml:ro
environment:
TRAEFIK_PROVIDERS_FILE_FILENAME: "/traefik_dynamic.yml"
TRAEFIK_PING: "true"
TRAEFIK_ENTRYPOINTS_HTTP_ADDRESS: ":80"
healthcheck:
test: [ "CMD", "traefik", "healthcheck" ]
interval: 3s
timeout: 3s
retries: 3
ports:
- "8080:80"

polemarch:
image: polemarch
build: .
restart: unless-stopped
depends_on:
Expand All @@ -16,8 +33,6 @@ services:
tty: true
volumes:
- ./settings.ini:/etc/polemarch/settings.ini:ro
ports:
- "8080:8080"

redis:
image: "redis:6"
Expand All @@ -40,6 +55,27 @@ services:
volumes:
- data-volume:/var/lib/mysql

centrifugo:
image: centrifugo/centrifugo:v3
restart: unless-stopped
tty: true
environment:
CENTRIFUGO_TOKEN_HMAC_SECRET_KEY: "d4074fd2-607c-41b0-ab83-f2bc55fae0ec"
CENTRIFUGO_API_KEY: "a08caef0-f1ad-40de-9e59-dd2cec07e2eb"
CENTRIFUGO_ADMIN: "true"
CENTRIFUGO_ADMIN_PASSWORD: "01a18ca9-9328-4ee7-a8de-7e5b231d1df4"
CENTRIFUGO_ADMIN_SECRET: "7e91c9c1-6303-42b1-9f28-1cdfbf58dcf9"
CENTRIFUGO_HISTORY_SIZE: "10"
CENTRIFUGO_HISTORY_TTL: "300s"
CENTRIFUGO_HEALTH: "true"
CENTRIFUGO_ALLOWED_ORIGINS: "*"
healthcheck:
test: [ "CMD", "sh", "-c", "wget -nv -O - http://localhost:8000/health" ]
interval: 3s
timeout: 3s
retries: 3
command: centrifugo

volumes:
data-volume:

Expand Down
1 change: 1 addition & 0 deletions frontend_src_new/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
'vue/html-self-closing': ['error', { html: { void: 'any' } }],
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off',
'vue/one-component-per-file': 'off',
},
globals: {
spa: 'readonly',
Expand Down
51 changes: 51 additions & 0 deletions frontend_src_new/history/ExecutionTimeField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** @vue/component */
export const ExecutionTimeFieldMixin = {
data() {
return {
intervalId: null,
generatedTime: null,
};
},
computed: {
shouldGenerateTime() {
return this.$app.centrifugoClient && ['RUN', 'DELAY'].includes(this.data.status);
},
value() {
if (this.shouldGenerateTime) {
return this.generatedTime;
}
return this.data[this.field.name];
},
},
watch: {
shouldGenerateTime: {
immediate: true,
handler(value) {
if (value && !this.intervalId) {
this.intervalId = setInterval(() => this.updateGeneratedTime(), 1000);
} else {
clearInterval(this.intervalId);
}
},
},
},
methods: {
updateGeneratedTime() {
this.generatedTime = this.$u.getTimeInUptimeFormat(
window.moment.duration(window.moment().diff(this.data.start_time)).asSeconds(),
);
},
},
};

export class ExecutionTimeField extends spa.fields.datetime.UptimeField {
static format = 'execution-time';

static get mixins() {
return super.mixins.concat(ExecutionTimeFieldMixin);
}
}

spa.signals.once('APP_CREATED', (app) => {
app.fieldsResolver.registerField('integer', ExecutionTimeField.format, ExecutionTimeField);
});
Loading

0 comments on commit 4c22429

Please sign in to comment.