From e8e3398a743df2dc254aae64512f6f6b4a001c3f Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 31 Jan 2023 17:42:28 +0100 Subject: [PATCH 1/6] :bug: Fix default nginx configuration for docker images --- docker/images/files/nginx.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/images/files/nginx.conf b/docker/images/files/nginx.conf index cc089b770..f628aacfe 100644 --- a/docker/images/files/nginx.conf +++ b/docker/images/files/nginx.conf @@ -102,9 +102,9 @@ http { proxy_pass http://penpot-backend:6060/api; } - location /admin { - proxy_pass http://penpot-admin:6065/admin; - } + # location /admin { + # proxy_pass http://penpot-admin:6065/admin; + # } location /ws/notifications { proxy_set_header Upgrade $http_upgrade; From 7dd55c7f9d033c7ac7ea06a6439937cc6f586d20 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 31 Jan 2023 18:50:53 +0100 Subject: [PATCH 2/6] :rewind: Revert JRE/JLINK changes from Dockerfile.backend file --- docker/images/Dockerfile.backend | 75 +++++++++++--------------------- 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/docker/images/Dockerfile.backend b/docker/images/Dockerfile.backend index 7a7102332..be6cdaa75 100644 --- a/docker/images/Dockerfile.backend +++ b/docker/images/Dockerfile.backend @@ -1,15 +1,35 @@ -FROM ubuntu:22.04 as jre-build +FROM ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive \ +LABEL maintainer="Andrey Antukh " +ENV LANG='en_US.UTF-8' \ + LC_ALL='en_US.UTF-8' \ + JAVA_HOME="/opt/jdk" \ + PATH=/opt/jdk/bin:$PATH \ + DEBIAN_FRONTEND=noninteractive \ TZ=Etc/UTC -RUN set -eux; \ +RUN set -ex; \ + useradd -U -M -u 1001 -s /bin/false -d /opt/penpot penpot; \ apt-get -qq update; \ + apt-get -qq upgrade; \ apt-get -qqy --no-install-recommends install \ - curl \ - ca-certificates \ - binutils \ + curl \ + tzdata \ + locales \ + ca-certificates \ + imagemagick \ + webp \ + rlwrap \ + fontconfig \ + woff-tools \ + woff2 \ + python3 \ + fontforge \ ; \ + echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ + locale-gen; \ + mkdir -p /opt/penpot/assets; \ + chown -R penpot:penpot /opt/penpot; \ rm -rf /var/lib/apt/lists/*; RUN set -eux; \ @@ -39,49 +59,6 @@ RUN set -eux; \ tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ rm -rf /tmp/openjdk.tar.gz; -RUN /opt/jdk/bin/jlink \ - --verbose \ - --module-path /opt/jdk/jmods \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress 0 \ - --add-modules java.base,java.naming,java.xml,java.logging,java.net.http,java.sql,java.management,java.desktop,jdk.jfr,jdk.unsupported,jdk.management.jfr \ - --output /opt/jre - - -FROM ubuntu:22.04 - -LABEL maintainer="Andrey Antukh " -ENV LANG='en_US.UTF-8' \ - LC_ALL='en_US.UTF-8' \ - JAVA_HOME="/opt/jre" \ - PATH=/opt/jre/bin:$PATH \ - TZ=Etc/UTC - -COPY --from=jre-build /opt/jre /opt/jre - -RUN set -ex; \ - useradd -U -M -u 1001 -s /bin/false -d /opt/penpot penpot; \ - apt-get -qq update; \ - apt-get -qqy --no-install-recommends install \ - curl \ - tzdata \ - locales \ - ca-certificates \ - imagemagick \ - webp \ - fontconfig \ - woff-tools \ - woff2 \ - python3 \ - fontforge \ - ; \ - echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen; \ - mkdir -p /opt/penpot/assets; \ - chown -R penpot:penpot /opt/penpot; \ - rm -rf /var/lib/apt/lists/*; COPY --chown=penpot:penpot ./bundle-backend/ /opt/penpot/backend/ From 14e3439caeb375ce09b66718d62d14c5d0a203b2 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 31 Jan 2023 18:52:16 +0100 Subject: [PATCH 3/6] :fire: Remove admin mention from compose, still not working correctly --- docker/images/docker-compose.yaml | 34 ------------------------------- 1 file changed, 34 deletions(-) diff --git a/docker/images/docker-compose.yaml b/docker/images/docker-compose.yaml index 2e224c720..000419a55 100644 --- a/docker/images/docker-compose.yaml +++ b/docker/images/docker-compose.yaml @@ -260,40 +260,6 @@ services: ports: - "1080:1080" - ## An optional admin application for pentpot. It allows manage users, teams and inspect - ## some parts of the database. You can read more about it on: - ## https://github.com/penpot/penpot-admin - ## - ## If you are going to use admin, ensure to have `enable-prepl-server` in backend flags - ## and uncomment the `PENPOT_PREPL_HOST` environment variable. - ## - ## Status: EXPERIMENTAL - - # penpot-admin: - # image: "penpotapp/admin:latest" - # networks: - # - penpot - # - # depends_on: - # - penpot-postgres - # - penpot-backend - # - # environment: - # ## Adjust to the same value as on backend - # - PENPOT_PUBLIC_URI=http://localhost:9001 - # - # ## Do not touch it, this is an internal routes - # - PENPOT_API_URI=http://penpot-frontend/ - # - PENPOT_PREPL_URI=tcp://penpot-backend:6063/ - # - PENPOT_DEBUG="false" - # - # ## Adjust to the same values as on backend - # - PENPOT_DATABASE_HOST=penpot-postgres - # - PENPOT_DATABASE_NAME=penpot - # - PENPOT_DATABASE_USERNAME=penpot - # - PENPOT_DATABASE_PASSWORD=penpot - # - PENPOT_REDIS_URI=redis://penpot-redis/0 - ## Example configuration of MiniIO (S3 compatible object storage service); If you don't ## have preference, then just use filesystem, this is here just for the completeness. From f8cb505196e47fc868db97494fb0ad01317056e2 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 31 Jan 2023 18:51:44 +0100 Subject: [PATCH 4/6] :bug: Fix arguments handling on docker/images/build.sh script --- docker/images/build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/images/build.sh b/docker/images/build.sh index 6957c12e6..e9118b1b1 100755 --- a/docker/images/build.sh +++ b/docker/images/build.sh @@ -4,10 +4,13 @@ set -x DOCKER_CLI_EXPERIMENTAL=enabled ORG=${PENPOT_DOCKER_NAMESPACE:-penpotapp}; PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64}; -IMAGE=${1:-backend}; + +IMAGE=${PENPOT_BUILD_IMAGE:-backend} +PLATFORM=${PENPOT_BUILD_PLATFORM:-linux/amd64}; +VERSION=${PENPOT_BUILD_VERSION:-latest} DOCKER_IMAGE="$ORG/$IMAGE"; -OPTIONS="-t $DOCKER_IMAGE:$PENPOT_BUILD_VERSION"; +OPTIONS="-t $DOCKER_IMAGE:$VERSION"; IFS=", " read -a TAGS <<< $PENPOT_BUILD_TAGS; @@ -16,10 +19,6 @@ for element in "${TAGS[@]}"; do OPTIONS="$OPTIONS -t $DOCKER_IMAGE:$element"; done -if [ "$PENPOT_BUILD_PUSH" = "true" ]; then - OPTIONS="--push $OPTIONS" -fi - docker buildx inspect penpot > /dev/null 2>&1; docker run --privileged --rm tonistiigi/binfmt --install all @@ -32,4 +31,5 @@ else fi unset IFS; + docker buildx build --platform ${PLATFORM// /,} $OPTIONS -f Dockerfile.$IMAGE "$@" .; From 8a968dc081829a7294ec5a00ed848c6fc9d0a240 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 31 Jan 2023 13:26:28 +0100 Subject: [PATCH 5/6] :bug: Fix upload team image --- frontend/src/app/main/data/dashboard.cljs | 4 ++-- frontend/src/app/main/repo.cljs | 9 +++++++++ frontend/src/app/main/ui/dashboard/team.cljs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 8e84b6a21..3cd752a52 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -426,8 +426,8 @@ (rx/ignore))))) (defn update-team-photo - [{:keys [file] :as params}] - (us/assert! ::di/file file) + [file] + (us/assert! ::di/blob file) (ptk/reify ::update-team-photo ptk/WatchEvent (watch [_ state _] diff --git a/frontend/src/app/main/repo.cljs b/frontend/src/app/main/repo.cljs index 55c2e3976..594c1f3b4 100644 --- a/frontend/src/app/main/repo.cljs +++ b/frontend/src/app/main/repo.cljs @@ -200,3 +200,12 @@ :body (http/form-data params)}) (rx/map http/conditional-decode-transit) (rx/mapcat handle-response))) + +(defmethod command ::multipart-upload + [id params] + (->> (http/send! {:method :post + :uri (u/join @cf/public-uri "api/rpc/command/" (name id)) + :credentials "include" + :body (http/form-data params)}) + (rx/map http/conditional-decode-transit) + (rx/mapcat handle-response))) diff --git a/frontend/src/app/main/ui/dashboard/team.cljs b/frontend/src/app/main/ui/dashboard/team.cljs index b1450a734..8c0becf46 100644 --- a/frontend/src/app/main/ui/dashboard/team.cljs +++ b/frontend/src/app/main/ui/dashboard/team.cljs @@ -888,7 +888,7 @@ on-file-selected (fn [file] - (st/emit! (dd/update-team-photo {:file file})))] + (st/emit! (dd/update-team-photo file)))] (mf/use-effect From 91ececa59efe8a0c6f8f9762dae8977835bbe9fc Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 31 Jan 2023 23:01:13 +0100 Subject: [PATCH 6/6] :bug: Fix backend flags on docker compose sample file --- docker/images/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/images/docker-compose.yaml b/docker/images/docker-compose.yaml index 000419a55..90deed915 100644 --- a/docker/images/docker-compose.yaml +++ b/docker/images/docker-compose.yaml @@ -134,7 +134,7 @@ services: ## environment variables for the backend here: ## https://help.penpot.app/technical-guide/configuration/#advanced-configuration - - PENPOT_FLAGS=enable-registration enable-login disable-email-verification enable-smtp enable-prepl-server + - PENPOT_FLAGS=enable-registration enable-login-with-password disable-email-verification enable-smtp enable-prepl-server ## Penpot SECRET KEY. It serves as a master key from which other keys for subsystems ## (eg http sessions) are derived.