From f4f51dbf6bbbfc24c2a988598f667e2bd4f98a2a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 31 Mar 2021 14:34:46 +0200 Subject: [PATCH] :sparkles: Add minor adaptations for gitpod config and docker files. --- .gitpod.yml | 71 +++++++++++++++++++----------- docker/gitpod/Dockerfile | 48 +++++++++++++------- docker/gitpod/files/nginx.conf | 2 +- exporter/scripts/wait-and-start.sh | 1 + 4 files changed, 79 insertions(+), 43 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index c513062fa..0735ba2dd 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,72 +5,93 @@ ports: # nginx - port: 3449 onOpen: open-preview + # frontend nREPL - port: 3447 onOpen: ignore visibility: private + # frontend shadow server - port: 3448 - onOpen: notify + onOpen: ignore visibility: private + + # backend - port: 6060 - - port: 9090 + onOpen: ignore + # exporter shadow server - port: 9630 - onOpen: notify + onOpen: ignore visibility: private + # exporter http server - port: 6061 onOpen: ignore + # mailhog web interface - port: 8025 - onOpen: notify + onOpen: ignore + # mailhog postfix - port: 1025 onOpen: ignore + # postgres - port: 5432 onOpen: ignore + # redis - port: 6379 onOpen: ignore + # openldap - port: 389 onOpen: ignore tasks: # https://github.com/gitpod-io/gitpod/issues/666#issuecomment-534347856 - - before: > + - name: gulp + command: > + cd $GITPOD_REPO_ROOT/frontend/; + yarn && gp sync-done 'frontend-yarn'; + npx gulp --theme=${PENPOT_THEME} watch + + - name: frontend shadow watch + command: > + cd $GITPOD_REPO_ROOT/frontend/; + gp sync-await 'frontend-yarn'; + npx shadow-cljs watch main + + - init: gp await-port 5432 && psql -f $GITPOD_REPO_ROOT/docker/gitpod/files/postgresql_init.sql + name: backend + command: > + cd $GITPOD_REPO_ROOT/backend/; + ./scripts/start-dev + + - name: exporter shadow watch + command: + cd $GITPOD_REPO_ROOT/exporter/; + gp sync-await 'frontend-yarn'; + yarn && npx shadow-cljs watch main + + - name: exporter web server + command: > + cd $GITPOD_REPO_ROOT/exporter/; + ./scripts/wait-and-start.sh + + - name: signed terminal + before: > [[ ! -z ${GNUGPG} ]] && cd ~ && rm -rf .gnupg && echo ${GNUGPG} | base64 -d | tar --no-same-owner -xzvf - - name: signed terminal init: > [[ ! -z ${GNUGPG_KEY} ]] && git config --global commit.gpgsign true && git config --global user.signingkey ${GNUGPG_KEY} command: cd $GITPOD_REPO_ROOT - - init: yarn --cwd $GITPOD_REPO_ROOT/frontend/ install - name: frontend shadow watch - command: cd $GITPOD_REPO_ROOT/frontend/ && npx -y shadow-cljs watch main - - - init: yarn --cwd $GITPOD_REPO_ROOT/exporter/ install - name: exporter shadow watch - command: gp await-port 3448 && cd $GITPOD_REPO_ROOT/exporter/ && npx -y shadow-cljs watch main - - - name: exporter web server - openMode: split-right - command: gp await-port 9630 && cd $GITPOD_REPO_ROOT/exporter/ && ./scripts/wait-and-start.sh - - - init: gp await-port 5432 && psql -f $GITPOD_REPO_ROOT/docker/gitpod/files/postgresql_init.sql - name: backend - command: cd $GITPOD_REPO_ROOT/backend/ && ./scripts/start-dev - - - name: gulp - command: gp await-port 3448 && cd $GITPOD_REPO_ROOT/frontend/ && npx -y gulp --theme=${PENPOT_THEME} watch - - name: redis command: redis-server diff --git a/docker/gitpod/Dockerfile b/docker/gitpod/Dockerfile index ea3a0b972..0c2fe3a14 100644 --- a/docker/gitpod/Dockerfile +++ b/docker/gitpod/Dockerfile @@ -19,7 +19,8 @@ COPY docker/gitpod/files/nginx.conf /etc/nginx/nginx.conf USER root ENV CLOJURE_VERSION=1.10.3.814 \ - CLJKONDO_VERSION=2021.03.03 \ + CLJKONDO_VERSION=2021.03.22 \ + BABASHKA_VERSION=0.3.1 \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 @@ -59,6 +60,7 @@ RUN set -ex; \ libxi6 \ libxrandr2 \ libxrender1 \ + libxshmfence1 \ libxss1 \ libxtst6 \ fonts-liberation \ @@ -69,21 +71,39 @@ RUN set -ex; \ rm -rf /var/lib/apt/lists/*; RUN set -ex; \ - wget "https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh"; \ - chmod +x "linux-install-$CLOJURE_VERSION.sh"; \ - "./linux-install-$CLOJURE_VERSION.sh"; \ - rm -rf "linux-install-$CLOJURE_VERSION.sh" + curl -LfsSo /tmp/openjdk.tar.gz https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16%2B36/OpenJDK16-jdk_x64_linux_hotspot_16_36.tar.gz; \ + mkdir -p /usr/lib/jvm/openjdk16; \ + cd /usr/lib/jvm/openjdk16; \ + tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ + rm -rf /tmp/openjdk.tar.gz; +# Install clojure cli +RUN set -ex; \ + curl -LfsSo /tmp/clojure.sh https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh; \ + chmod +x /tmp/clojure.sh; \ + /tmp/clojure.sh; \ + rm -rf /tmp/clojure.sh; + +# Install clj-kondo +RUN set -ex; \ + curl -LfsSo /tmp/clj-kondo.zip https://github.com/borkdude/clj-kondo/releases/download/v$CLJKONDO_VERSION/clj-kondo-$CLJKONDO_VERSION-linux-amd64.zip; \ + cd /usr/local/bin; \ + unzip /tmp/clj-kondo.zip; \ + rm /tmp/clj-kondo.zip; + +# Install babashka RUN set -ex; \ cd /tmp; \ - wget "https://github.com/borkdude/clj-kondo/releases/download/v${CLJKONDO_VERSION}/clj-kondo-${CLJKONDO_VERSION}-linux-amd64.zip"; \ - unzip "clj-kondo-${CLJKONDO_VERSION}-linux-amd64.zip"; \ - sudo mv clj-kondo /usr/local/bin/; \ - rm "clj-kondo-${CLJKONDO_VERSION}-linux-amd64.zip"; + curl -LfsSo /tmp/babashka.tar.gz https://github.com/babashka/babashka/releases/download/v$BABASHKA_VERSION/babashka-$BABASHKA_VERSION-linux-amd64.tar.gz; \ + cd /usr/local/bin; \ + tar -xf /tmp/babashka.tar.gz; \ + rm -rf /tmp/babashka.tar.gz; USER gitpod -ENV PENPOT_SMTP_ENABLED=true \ +ENV PATH="/usr/lib/jvm/openjdk16/bin:/usr/local/nodejs/bin:$PATH" \ + JAVA_HOME=/usr/lib/jvm/openjdk16 \ + PENPOT_SMTP_ENABLED=true \ PENPOT_SMTP_HOST=localhost \ PENPOT_SMTP_PORT=1025 \ PENPOT_SMTP_USER= \ @@ -92,12 +112,6 @@ ENV PENPOT_SMTP_ENABLED=true \ PENPOT_SMTP_TLS=false \ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com \ PENPOT_SMTP_DEFAULT_FROM=no-reply@example.com \ - PENPOT_SMTP_ENABLED=true \ - PENPOT_SMTP_HOST=localhost \ - PENPOT_SMTP_PORT=1025 \ - PENPOT_SMTP_USER= \ - PENPOT_SMTP_PASSWORD= \ - PENPOT_SMTP_SSL=false \ - PENPOT_SMTP_TLS=false + PENPOT_DATABASE_URI="postgresql://localhost/penpot" # TODO Retrieve OpenLDAP from rroemhild/docker-test-openldap diff --git a/docker/gitpod/files/nginx.conf b/docker/gitpod/files/nginx.conf index 80c5d5b43..319b4bcbb 100644 --- a/docker/gitpod/files/nginx.conf +++ b/docker/gitpod/files/nginx.conf @@ -97,7 +97,7 @@ http { location /internal/assets { internal; - alias $gitpod_repo_root/backend/resources/public/assets; + alias $gitpod_repo_root/backend/assets; add_header x-internal-redirect "$upstream_http_x_accel_redirect"; } diff --git a/exporter/scripts/wait-and-start.sh b/exporter/scripts/wait-and-start.sh index 730ed16bc..c04935367 100755 --- a/exporter/scripts/wait-and-start.sh +++ b/exporter/scripts/wait-and-start.sh @@ -2,4 +2,5 @@ bb -i '(babashka.wait/wait-for-port "localhost" 9630)'; bb -i '(babashka.wait/wait-for-path "target/app.js")'; +sleep 2; node target/app.js