From 033355395f305a7fd2b3d4d0cedb443e28d92112 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 13 Sep 2021 15:00:08 +0200 Subject: [PATCH 1/7] :bug: Fix metrics on ws connections. --- backend/src/app/notifications.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/app/notifications.clj b/backend/src/app/notifications.clj index 80afa560f..9c6b51dab 100644 --- a/backend/src/app/notifications.clj +++ b/backend/src/app/notifications.clj @@ -135,7 +135,7 @@ ws-send (mtx/wrap-counter ws-send mtx-messages ["send"])] (letfn [(on-connect [conn] - (mtx-aconn :inc) + ((::mtx/fn mtx-aconn) {}) ;; A subscription channel should use a lossy buffer ;; because we can't penalize normal clients when one ;; slow client is connected to the room. @@ -162,8 +162,8 @@ (a/ Date: Tue, 14 Sep 2021 10:45:06 +0200 Subject: [PATCH 2/7] :bug: Fix incorrect handling of metrics on notifications module. --- backend/src/app/notifications.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/app/notifications.clj b/backend/src/app/notifications.clj index 9c6b51dab..f7efa6f3f 100644 --- a/backend/src/app/notifications.clj +++ b/backend/src/app/notifications.clj @@ -135,7 +135,7 @@ ws-send (mtx/wrap-counter ws-send mtx-messages ["send"])] (letfn [(on-connect [conn] - ((::mtx/fn mtx-aconn) {}) + ((::mtx/fn mtx-aconn) {:cmd :inc :by 1}) ;; A subscription channel should use a lossy buffer ;; because we can't penalize normal clients when one ;; slow client is connected to the room. @@ -162,8 +162,8 @@ (a/ Date: Wed, 15 Sep 2021 14:28:57 +0200 Subject: [PATCH 3/7] :paperclip: Add default env variable for browser executable path. --- docker/images/Dockerfile.exporter | 3 ++- exporter/src/app/config.cljs | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docker/images/Dockerfile.exporter b/docker/images/Dockerfile.exporter index 6e5955aee..9a4f6e215 100644 --- a/docker/images/Dockerfile.exporter +++ b/docker/images/Dockerfile.exporter @@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive ENV LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 \ - NODE_VERSION=v14.17.5 + NODE_VERSION=v14.17.5 \ + PENPOT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium RUN set -ex; \ mkdir -p /etc/resolvconf/resolv.conf.d; \ diff --git a/exporter/src/app/config.cljs b/exporter/src/app/config.cljs index eb65382a4..7c79a533c 100644 --- a/exporter/src/app/config.cljs +++ b/exporter/src/app/config.cljs @@ -7,13 +7,13 @@ (ns app.config (:refer-clojure :exclude [get]) (:require - [app.common.data :as d] ["process" :as process] - [cljs.pprint] - [cuerdas.core :as str] + [app.common.data :as d] [app.common.spec :as us] - [cljs.spec.alpha :as s] [cljs.core :as c] + [cljs.pprint] + [cljs.spec.alpha :as s] + [cuerdas.core :as str] [lambdaisland.uri :as u])) (def defaults @@ -22,6 +22,7 @@ :browser-concurrency 5 :browser-strategy :incognito}) +(s/def ::browser-executable-path ::us/string) (s/def ::public-uri ::us/string) (s/def ::http-server-port ::us/integer) (s/def ::browser-concurrency ::us/integer) @@ -31,7 +32,8 @@ (s/keys :opt-un [::public-uri ::http-server-port ::browser-concurrency - ::browser-strategy])) + ::browser-strategy + ::browser-executable-path])) (defn- read-env [prefix] (let [env (unchecked-get process "env") From bff0030f2ba861364582ee71b25fc89839df3341 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 16 Sep 2021 11:28:39 +0200 Subject: [PATCH 4/7] :bug: Fix frontend docker image entry point. --- docker/images/config.env | 11 ++----- docker/images/files/nginx-entrypoint.sh | 38 +++---------------------- frontend/src/app/config.cljs | 9 ++++++ 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/docker/images/config.env b/docker/images/config.env index 157d2be43..15474b764 100644 --- a/docker/images/config.env +++ b/docker/images/config.env @@ -33,19 +33,14 @@ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com # PENPOT_SMTP_USERNAME= # PENPOT_SMTP_PASSWORD= # PENPOT_SMTP_TLS=true -# PENPOT_SMTP_SSL=false +# PENPOT_SMTP_SSL=false -# Enable or disable external user registration process. -PENPOT_REGISTRATION_ENABLED=true +# Flags that enables features on frontend applitation. +PENPOT_FRONTEND_FLAGS="enable-registration enable-demo-users" # Comma separated list of allowed domains to register. Empty to allow all. # PENPOT_REGISTRATION_DOMAIN_WHITELIST="" -# Penpot comes with the facility to create quick demo users that are -# automatically deleted after some time. This settings enables or disables the -# creation of demo users. -PENPOT_ALLOW_DEMO_USERS=true - ## Authentication providers # Google diff --git a/docker/images/files/nginx-entrypoint.sh b/docker/images/files/nginx-entrypoint.sh index 8e2c645f8..53328434c 100644 --- a/docker/images/files/nginx-entrypoint.sh +++ b/docker/images/files/nginx-entrypoint.sh @@ -9,26 +9,6 @@ log() { ## App Frontend config ######################################### -update_demo_warning() { - if [ -n "$PENPOT_DEMO_WARNING" ]; then - log "Updating Demo Warning: $PENPOT_DEMO_WARNING" - sed -i \ - -e "s|^//var penpotDemoWarning = .*;|var penpotDemoWarning = $PENPOT_DEMO_WARNING;|g" \ - "$1" - fi -} - - -update_allow_demo_users() { - if [ -n "$PENPOT_ALLOW_DEMO_USERS" ]; then - log "Updating Allow Demo Users: $PENPOT_ALLOW_DEMO_USERS" - sed -i \ - -e "s|^//var penpotAllowDemoUsers = .*;|var penpotAllowDemoUsers = $PENPOT_ALLOW_DEMO_USERS;|g" \ - "$1" - fi -} - - update_google_client_id() { if [ -n "$PENPOT_GOOGLE_CLIENT_ID" ]; then log "Updating Google Client Id: $PENPOT_GOOGLE_CLIENT_ID" @@ -67,6 +47,7 @@ update_oidc_client_id() { fi } +# DEPRECATED update_login_with_ldap() { if [ -n "$PENPOT_LOGIN_WITH_LDAP" ]; then log "Updating Login with LDAP: $PENPOT_LOGIN_WITH_LDAP" @@ -76,7 +57,7 @@ update_login_with_ldap() { fi } - +# DEPRECATED update_registration_enabled() { if [ -n "$PENPOT_REGISTRATION_ENABLED" ]; then log "Updating Registration Enabled: $PENPOT_REGISTRATION_ENABLED" @@ -86,30 +67,19 @@ update_registration_enabled() { fi } -update_analytics_enabled() { - if [ -n "$PENPOT_ANALYTICS_ENABLED" ]; then - sed -i \ - -e "s|^//var penpotAnalyticsEnabled = .*;|var penpotAnalyticsEnabled = $PENPOT_ANALYTICS_ENABLED;|g" \ - "$1" - fi -} - update_flags() { - if [ -n "$PENPOT_FLAGS" ]; then + if [ -n "$PENPOT_FRONTEND_FLAGS" ]; then sed -i \ - -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FLAGS\";|g" \ + -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FRONTEND_FLAGS\";|g" \ "$1" fi } -update_demo_warning /var/www/app/js/config.js -update_allow_demo_users /var/www/app/js/config.js update_google_client_id /var/www/app/js/config.js update_gitlab_client_id /var/www/app/js/config.js update_github_client_id /var/www/app/js/config.js update_oidc_client_id /var/www/app/js/config.js update_login_with_ldap /var/www/app/js/config.js update_registration_enabled /var/www/app/js/config.js -update_analytics_enabled /var/www/app/js/config.js update_flags /var/www/app/js/config.js exec "$@"; diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index 24346505d..2282fb825 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -54,6 +54,15 @@ :browser :webworker)) +(def available-flags + #{:registration + :audit-log + :demo-users + :user-feedback + :demo-users + :demo-warning + :login-with-ldap}) + (def default-flags #{:registration :demo-users}) From 39278b47dd8e6326201671ab070654d3c50564b6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 16 Sep 2021 11:31:54 +0200 Subject: [PATCH 5/7] :bug: Fix typo in prev commit. --- frontend/src/app/config.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index 2282fb825..8e43d15aa 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -59,7 +59,6 @@ :audit-log :demo-users :user-feedback - :demo-users :demo-warning :login-with-ldap}) From 1fe23ff732725ed3c720ad9d3734e41cf3546a84 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 16 Sep 2021 11:33:40 +0200 Subject: [PATCH 6/7] :paperclip: Minor renaming of config variables. --- docker/images/config.env | 4 ++-- docker/images/files/nginx-entrypoint.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/images/config.env b/docker/images/config.env index 15474b764..cc843cda5 100644 --- a/docker/images/config.env +++ b/docker/images/config.env @@ -33,10 +33,10 @@ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com # PENPOT_SMTP_USERNAME= # PENPOT_SMTP_PASSWORD= # PENPOT_SMTP_TLS=true -# PENPOT_SMTP_SSL=false +# PENPOT_SMTP_SSL=false # Flags that enables features on frontend applitation. -PENPOT_FRONTEND_FLAGS="enable-registration enable-demo-users" +PENPOT_FLAGS="enable-registration enable-demo-users" # Comma separated list of allowed domains to register. Empty to allow all. # PENPOT_REGISTRATION_DOMAIN_WHITELIST="" diff --git a/docker/images/files/nginx-entrypoint.sh b/docker/images/files/nginx-entrypoint.sh index 53328434c..270b7e26a 100644 --- a/docker/images/files/nginx-entrypoint.sh +++ b/docker/images/files/nginx-entrypoint.sh @@ -68,9 +68,9 @@ update_registration_enabled() { } update_flags() { - if [ -n "$PENPOT_FRONTEND_FLAGS" ]; then + if [ -n "$PENPOT_FLAGS" ]; then sed -i \ - -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FRONTEND_FLAGS\";|g" \ + -e "s|^//var penpotFlags = .*;|var penpotFlags = \"$PENPOT_FLAGS\";|g" \ "$1" fi } From 06e54a17c0f292f5a0165ae659fb7e9ca4f98c0a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 16 Sep 2021 11:35:45 +0200 Subject: [PATCH 7/7] :books: Update some comments on docker config.env file. --- docker/images/config.env | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/images/config.env b/docker/images/config.env index cc843cda5..2a4c2d4cd 100644 --- a/docker/images/config.env +++ b/docker/images/config.env @@ -35,7 +35,8 @@ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com # PENPOT_SMTP_TLS=true # PENPOT_SMTP_SSL=false -# Flags that enables features on frontend applitation. +# Feature flags. Right now they are only affect frontend, but in +# future release they will affect to both backend and frontend. PENPOT_FLAGS="enable-registration enable-demo-users" # Comma separated list of allowed domains to register. Empty to allow all.