From 4946ca2d918d959cbabd88462d7e6b3229a60b45 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 00:08:29 +0200 Subject: [PATCH 01/57] Dockerfile for multiarch builds --- Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d0a8912b..90409e5be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.14.0-alpine +FROM node:17-alpine RUN apk add --no-cache g++ cmake make python3 WORKDIR /app COPY package*.json . @@ -6,20 +6,18 @@ RUN yarn install COPY . . RUN yarn build -FROM node:16.14.0-alpine +FROM node:17-alpine WORKDIR /app - +ARG TARGETPLATFORM LABEL coolify.managed true - RUN apk add --no-cache git openssh-client curl jq cmake sqlite - RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6 RUN pnpm add -g pnpm -RUN curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz" | tar -xzvf - docker/docker -C . --strip-components 1 && mv docker /usr/bin/docker RUN mkdir -p ~/.docker/cli-plugins/ -RUN curl -SL https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose -RUN chmod +x ~/.docker/cli-plugins/docker-compose +RUN curl -SL https://cdn.coollabs.io/bin/docker-20.10.9-$TARGETPLATFORM -o /usr/bin/docker +RUN curl -SL https://cdn.coollabs.io/bin/docker-compose-linux-2.3.4-$TARGETPLATFORM -o ~/.docker/cli-plugins/docker-compose +RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker COPY --from=0 /app/docker-compose.yaml . COPY --from=0 /app/build . From f56361c0ca4db1e8055a60ab8a5a8555b7125714 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 14:25:55 +0200 Subject: [PATCH 02/57] updates for ARM --- Dockerfile | 44 ++++-- package.json | 3 +- pnpm-lock.yaml | 302 ++------------------------------------ src/lib/database/users.ts | 2 +- 4 files changed, 44 insertions(+), 307 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90409e5be..28e7e820b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,41 @@ -FROM node:17-alpine -RUN apk add --no-cache g++ cmake make python3 +FROM node:16.14.2-alpine as install WORKDIR /app COPY package*.json . RUN yarn install -COPY . . -RUN yarn build -FROM node:17-alpine -WORKDIR /app + +FROM rust:1.58.1-alpine3.14 as prisma +WORKDIR /prisma +ENV RUSTFLAGS="-C target-feature=-crt-static" +RUN apk --no-cache add openssl direnv git musl-dev openssl-dev build-base perl protoc +RUN git clone --depth=1 --branch=3.11.x https://github.com/prisma/prisma-engines.git /prisma +RUN cargo build --release + +FROM node:16.14.2-alpine ARG TARGETPLATFORM -LABEL coolify.managed true -RUN apk add --no-cache git openssh-client curl jq cmake sqlite + +WORKDIR /app + +ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \ + PRISMA_MIGRATION_ENGINE_BINARY=/app/prisma-engines/migration-engine \ + PRISMA_INTROSPECTION_ENGINE_BINARY=/app/prisma-engines/introspection-engine \ + PRISMA_FMT_BINARY=/app/prisma-engines/prisma-fmt \ + PRISMA_CLI_QUERY_ENGINE_TYPE=binary \ + PRISMA_CLIENT_ENGINE_TYPE=binary +COPY --from=prisma /prisma/target/release/query-engine /prisma/target/release/migration-engine /prisma/target/release/introspection-engine /prisma/target/release/prisma-fmt /app/prisma-engines/ + +COPY --from=install /app/node_modules ./node_modules +COPY . . + +RUN apk add --no-cache git openssh-client curl jq sqlite RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6 RUN pnpm add -g pnpm RUN mkdir -p ~/.docker/cli-plugins/ -RUN curl -SL https://cdn.coollabs.io/bin/docker-20.10.9-$TARGETPLATFORM -o /usr/bin/docker -RUN curl -SL https://cdn.coollabs.io/bin/docker-compose-linux-2.3.4-$TARGETPLATFORM -o ~/.docker/cli-plugins/docker-compose +RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-20.10.9 -o /usr/bin/docker +RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-compose-linux-2.3.4 -o ~/.docker/cli-plugins/docker-compose RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker -COPY --from=0 /app/docker-compose.yaml . -COPY --from=0 /app/build . -COPY --from=0 /app/package.json . -COPY --from=0 /app/node_modules ./node_modules -COPY --from=0 /app/prisma ./prisma - +RUN pnpm build EXPOSE 3000 CMD ["pnpm", "start"] \ No newline at end of file diff --git a/package.json b/package.json index 6c7237198..7dfd0f6e8 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "devDependencies": { "@sveltejs/adapter-node": "1.0.0-next.73", "@sveltejs/kit": "1.0.0-next.303", - "@types/bcrypt": "5.0.0", "@types/js-cookie": "3.0.1", "@types/js-yaml": "^4.0.5", "@types/node": "17.0.23", @@ -62,7 +61,7 @@ "@iarna/toml": "2.2.5", "@prisma/client": "3.11.1", "@sentry/node": "6.19.2", - "bcrypt": "5.0.1", + "bcryptjs": "^2.4.3", "bullmq": "1.78.1", "compare-versions": "4.1.3", "cookie": "0.4.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a89edbf25..29d97a688 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,6 @@ specifiers: '@sentry/node': 6.19.2 '@sveltejs/adapter-node': 1.0.0-next.73 '@sveltejs/kit': 1.0.0-next.303 - '@types/bcrypt': 5.0.0 '@types/js-cookie': 3.0.1 '@types/js-yaml': ^4.0.5 '@types/node': 17.0.23 @@ -15,7 +14,7 @@ specifiers: '@typescript-eslint/parser': 4.31.1 '@zerodevx/svelte-toast': 0.7.1 autoprefixer: 10.4.4 - bcrypt: 5.0.1 + bcryptjs: ^2.4.3 bullmq: 1.78.1 compare-versions: 4.1.3 cookie: 0.4.2 @@ -59,7 +58,7 @@ dependencies: '@iarna/toml': 2.2.5 '@prisma/client': 3.11.1_prisma@3.11.1 '@sentry/node': 6.19.2 - bcrypt: 5.0.1 + bcryptjs: 2.4.3 bullmq: 1.78.1 compare-versions: 4.1.3 cookie: 0.4.2 @@ -83,7 +82,6 @@ dependencies: devDependencies: '@sveltejs/adapter-node': 1.0.0-next.73 '@sveltejs/kit': 1.0.0-next.303_svelte@3.46.4 - '@types/bcrypt': 5.0.0 '@types/js-cookie': 3.0.1 '@types/js-yaml': 4.0.5 '@types/node': 17.0.23 @@ -208,26 +206,6 @@ packages: } dev: false - /@mapbox/node-pre-gyp/1.0.6: - resolution: - { - integrity: sha512-qK1ECws8UxuPqOA8F5LFD90vyVU33W7N3hGfgsOVfrJaRVc8McC3JClTDHpeSbL9CBrOHly/4GsNPAvIgNZE+g== - } - hasBin: true - dependencies: - detect-libc: 1.0.3 - https-proxy-agent: 5.0.0 - make-dir: 3.1.0 - node-fetch: 2.6.6 - nopt: 5.0.0 - npmlog: 5.0.1 - rimraf: 3.0.2 - semver: 7.3.5 - tar: 6.1.11 - transitivePeerDependencies: - - supports-color - dev: false - /@nodelib/fs.scandir/2.1.5: resolution: { @@ -480,15 +458,6 @@ packages: } dev: true - /@types/bcrypt/5.0.0: - resolution: - { - integrity: sha512-agtcFKaruL8TmcvqbndlqHPSJgsolhf/qPWchFlgnW1gECTN/nKbFcoFnvKAQRFfKbh+BO6A3SWdJu9t+xF3Lw== - } - dependencies: - '@types/node': 17.0.23 - dev: true - /@types/cacheable-request/6.0.2: resolution: { @@ -718,13 +687,6 @@ packages: } dev: true - /abbrev/1.1.1: - resolution: - { - integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== - } - dev: false - /acorn-jsx/5.3.2_acorn@7.4.1: resolution: { @@ -851,17 +813,13 @@ packages: engines: { node: '>=0.10.0' } dev: true - /ansi-regex/3.0.0: - resolution: { integrity: sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= } - engines: { node: '>=4' } - dev: false - /ansi-regex/5.0.1: resolution: { integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== } engines: { node: '>=8' } + dev: true /ansi-regex/6.0.1: resolution: @@ -915,24 +873,6 @@ packages: picomatch: 2.3.0 dev: true - /aproba/2.0.0: - resolution: - { - integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== - } - dev: false - - /are-we-there-yet/2.0.0: - resolution: - { - integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw== - } - engines: { node: '>=10' } - dependencies: - delegates: 1.0.0 - readable-stream: 3.6.0 - dev: false - /arg/4.1.3: resolution: { @@ -1652,18 +1592,8 @@ packages: tweetnacl: 0.14.5 dev: false - /bcrypt/5.0.1: - resolution: - { - integrity: sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw== - } - engines: { node: '>= 10.0.0' } - requiresBuild: true - dependencies: - '@mapbox/node-pre-gyp': 1.0.6 - node-addon-api: 3.2.1 - transitivePeerDependencies: - - supports-color + /bcryptjs/2.4.3: + resolution: { integrity: sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms= } dev: false /binary-extensions/2.2.0: @@ -1870,14 +1800,6 @@ packages: } dev: false - /chownr/2.0.0: - resolution: - { - integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== - } - engines: { node: '>=10' } - dev: false - /clean-stack/2.2.0: resolution: { @@ -1962,14 +1884,6 @@ packages: } dev: true - /color-support/1.1.3: - resolution: - { - integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== - } - hasBin: true - dev: false - /colorette/2.0.16: resolution: { @@ -1995,10 +1909,6 @@ packages: /concat-map/0.0.1: resolution: { integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= } - /console-control-strings/1.1.0: - resolution: { integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= } - dev: false - /convert-source-map/1.8.0: resolution: { @@ -2202,10 +2112,6 @@ packages: resolution: { integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= } dev: true - /delegates/1.0.0: - resolution: { integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= } - dev: false - /denque/1.5.1: resolution: { @@ -2229,12 +2135,6 @@ packages: engines: { node: '>=8' } dev: true - /detect-libc/1.0.3: - resolution: { integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= } - engines: { node: '>=0.10' } - hasBin: true - dev: false - /detective/5.2.0: resolution: { @@ -2368,6 +2268,7 @@ packages: { integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== } + dev: true /emoji-regex/9.2.2: resolution: @@ -3010,16 +2911,6 @@ packages: } dev: false - /fs-minipass/2.1.0: - resolution: - { - integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== - } - engines: { node: '>= 8' } - dependencies: - minipass: 3.1.5 - dev: false - /fs.realpath/1.0.0: resolution: { integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8= } @@ -3054,24 +2945,6 @@ packages: resolution: { integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= } dev: true - /gauge/3.0.1: - resolution: - { - integrity: sha512-6STz6KdQgxO4S/ko+AbjlFGGdGcknluoqU+79GOFCDqqyYj5OanQf9AjxwN0jCidtT+ziPMmPSt9E4hfQ0CwIQ== - } - engines: { node: '>=10' } - dependencies: - aproba: 2.0.0 - color-support: 1.1.3 - console-control-strings: 1.1.0 - has-unicode: 2.0.1 - object-assign: 4.1.1 - signal-exit: 3.0.5 - string-width: 2.1.1 - strip-ansi: 4.0.0 - wide-align: 1.1.5 - dev: false - /generate-password/1.7.0: resolution: { @@ -3241,10 +3114,6 @@ packages: engines: { node: '>=8' } dev: true - /has-unicode/2.0.1: - resolution: { integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= } - dev: false - /has/1.0.3: resolution: { @@ -3457,17 +3326,13 @@ packages: engines: { node: '>=0.10.0' } dev: true - /is-fullwidth-code-point/2.0.0: - resolution: { integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= } - engines: { node: '>=4' } - dev: false - /is-fullwidth-code-point/3.0.0: resolution: { integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== } engines: { node: '>=8' } + dev: true /is-fullwidth-code-point/4.0.0: resolution: @@ -3839,6 +3704,7 @@ packages: engines: { node: '>=10' } dependencies: yallist: 4.0.0 + dev: true /lru_map/0.3.3: resolution: { integrity: sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0= } @@ -3860,16 +3726,6 @@ packages: sourcemap-codec: 1.4.8 dev: true - /make-dir/3.1.0: - resolution: - { - integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - } - engines: { node: '>=8' } - dependencies: - semver: 6.3.0 - dev: false - /make-error/1.3.6: resolution: { @@ -3950,27 +3806,6 @@ packages: } dev: true - /minipass/3.1.5: - resolution: - { - integrity: sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw== - } - engines: { node: '>=8' } - dependencies: - yallist: 4.0.0 - dev: false - - /minizlib/2.1.2: - resolution: - { - integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== - } - engines: { node: '>= 8' } - dependencies: - minipass: 3.1.5 - yallist: 4.0.0 - dev: false - /mkdirp-classic/0.5.3: resolution: { @@ -3988,15 +3823,6 @@ packages: minimist: 1.2.5 dev: true - /mkdirp/1.0.4: - resolution: - { - integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== - } - engines: { node: '>=10' } - hasBin: true - dev: false - /mri/1.2.0: resolution: { @@ -4065,23 +3891,6 @@ packages: resolution: { integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= } dev: true - /node-addon-api/3.2.1: - resolution: - { - integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== - } - dev: false - - /node-fetch/2.6.6: - resolution: - { - integrity: sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA== - } - engines: { node: 4.x || >=6.0.0 } - dependencies: - whatwg-url: 5.0.0 - dev: false - /node-forge/1.3.0: resolution: { @@ -4113,17 +3922,6 @@ packages: } dev: false - /nopt/5.0.0: - resolution: - { - integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== - } - engines: { node: '>=6' } - hasBin: true - dependencies: - abbrev: 1.1.1 - dev: false - /normalize-path/3.0.0: resolution: { @@ -4155,23 +3953,6 @@ packages: path-key: 3.1.1 dev: true - /npmlog/5.0.1: - resolution: - { - integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw== - } - dependencies: - are-we-there-yet: 2.0.0 - console-control-strings: 1.1.0 - gauge: 3.0.1 - set-blocking: 2.0.0 - dev: false - - /object-assign/4.1.1: - resolution: { integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= } - engines: { node: '>=0.10.0' } - dev: false - /object-hash/2.2.0: resolution: { @@ -4706,6 +4487,7 @@ packages: hasBin: true dependencies: glob: 7.2.0 + dev: true /rollup/2.61.1: resolution: @@ -4801,10 +4583,7 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 - - /set-blocking/2.0.0: - resolution: { integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc= } - dev: false + dev: true /shebang-command/1.2.0: resolution: { integrity: sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= } @@ -4839,6 +4618,7 @@ packages: { integrity: sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ== } + dev: true /slash/1.0.0: resolution: { integrity: sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= } @@ -4973,17 +4753,6 @@ packages: engines: { node: '>=0.6.19' } dev: true - /string-width/2.1.1: - resolution: - { - integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - } - engines: { node: '>=4' } - dependencies: - is-fullwidth-code-point: 2.0.0 - strip-ansi: 4.0.0 - dev: false - /string-width/4.2.3: resolution: { @@ -4994,6 +4763,7 @@ packages: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + dev: true /string-width/5.1.0: resolution: @@ -5023,13 +4793,6 @@ packages: ansi-regex: 2.1.1 dev: true - /strip-ansi/4.0.0: - resolution: { integrity: sha1-qEeQIusaw2iocTibY1JixQXuNo8= } - engines: { node: '>=4' } - dependencies: - ansi-regex: 3.0.0 - dev: false - /strip-ansi/6.0.1: resolution: { @@ -5038,6 +4801,7 @@ packages: engines: { node: '>=8' } dependencies: ansi-regex: 5.0.1 + dev: true /strip-ansi/7.0.1: resolution: @@ -5324,21 +5088,6 @@ packages: readable-stream: 3.6.0 dev: false - /tar/6.1.11: - resolution: - { - integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== - } - engines: { node: '>= 10' } - dependencies: - chownr: 2.0.0 - fs-minipass: 2.1.0 - minipass: 3.1.5 - minizlib: 2.1.2 - mkdirp: 1.0.4 - yallist: 4.0.0 - dev: false - /text-table/0.2.0: resolution: { integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= } dev: true @@ -5372,10 +5121,6 @@ packages: is-number: 7.0.0 dev: true - /tr46/0.0.3: - resolution: { integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= } - dev: false - /trim-right/1.0.1: resolution: { integrity: sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= } engines: { node: '>=0.10.0' } @@ -5558,17 +5303,6 @@ packages: fsevents: 2.3.2 dev: true - /webidl-conversions/3.0.1: - resolution: { integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= } - dev: false - - /whatwg-url/5.0.0: - resolution: { integrity: sha1-lmRU6HZUYuN2RNNib2dCzotwll0= } - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - dev: false - /which/1.3.1: resolution: { @@ -5589,15 +5323,6 @@ packages: dependencies: isexe: 2.0.0 - /wide-align/1.1.5: - resolution: - { - integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== - } - dependencies: - string-width: 4.2.3 - dev: false - /word-wrap/1.2.3: resolution: { @@ -5650,6 +5375,7 @@ packages: { integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== } + dev: true /yaml/1.10.2: resolution: diff --git a/src/lib/database/users.ts b/src/lib/database/users.ts index 7e5cc481e..552b422b5 100644 --- a/src/lib/database/users.ts +++ b/src/lib/database/users.ts @@ -1,5 +1,5 @@ import cuid from 'cuid'; -import bcrypt from 'bcrypt'; +import bcrypt from 'bcryptjs'; import { prisma } from './common'; import { asyncExecShell, uniqueName } from '$lib/common'; From 823279fb60389009e6357b7731da19f034652aca Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 17:16:11 +0200 Subject: [PATCH 03/57] Updates --- Dockerfile | 11 ++--------- .../haproxy-http.Dockerfile | 0 haproxy-tcp.Dockerfile => data/haproxy-tcp.Dockerfile | 0 haproxy.Dockerfile => data/haproxy.Dockerfile | 0 data/prisma-engine.Dockerfile | 10 ++++++++++ 5 files changed, 12 insertions(+), 9 deletions(-) rename haproxy-http.Dockerfile => data/haproxy-http.Dockerfile (100%) rename haproxy-tcp.Dockerfile => data/haproxy-tcp.Dockerfile (100%) rename haproxy.Dockerfile => data/haproxy.Dockerfile (100%) create mode 100644 data/prisma-engine.Dockerfile diff --git a/Dockerfile b/Dockerfile index 28e7e820b..5c95c5398 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,6 @@ WORKDIR /app COPY package*.json . RUN yarn install - -FROM rust:1.58.1-alpine3.14 as prisma -WORKDIR /prisma -ENV RUSTFLAGS="-C target-feature=-crt-static" -RUN apk --no-cache add openssl direnv git musl-dev openssl-dev build-base perl protoc -RUN git clone --depth=1 --branch=3.11.x https://github.com/prisma/prisma-engines.git /prisma -RUN cargo build --release - FROM node:16.14.2-alpine ARG TARGETPLATFORM @@ -22,7 +14,8 @@ ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \ PRISMA_FMT_BINARY=/app/prisma-engines/prisma-fmt \ PRISMA_CLI_QUERY_ENGINE_TYPE=binary \ PRISMA_CLIENT_ENGINE_TYPE=binary -COPY --from=prisma /prisma/target/release/query-engine /prisma/target/release/migration-engine /prisma/target/release/introspection-engine /prisma/target/release/prisma-fmt /app/prisma-engines/ + +COPY --from=coollabsio/prisma-engine:arm64 /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/ COPY --from=install /app/node_modules ./node_modules COPY . . diff --git a/haproxy-http.Dockerfile b/data/haproxy-http.Dockerfile similarity index 100% rename from haproxy-http.Dockerfile rename to data/haproxy-http.Dockerfile diff --git a/haproxy-tcp.Dockerfile b/data/haproxy-tcp.Dockerfile similarity index 100% rename from haproxy-tcp.Dockerfile rename to data/haproxy-tcp.Dockerfile diff --git a/haproxy.Dockerfile b/data/haproxy.Dockerfile similarity index 100% rename from haproxy.Dockerfile rename to data/haproxy.Dockerfile diff --git a/data/prisma-engine.Dockerfile b/data/prisma-engine.Dockerfile new file mode 100644 index 000000000..086472e23 --- /dev/null +++ b/data/prisma-engine.Dockerfile @@ -0,0 +1,10 @@ +FROM rust:1.58.1-alpine3.14 as prisma +WORKDIR /prisma +ENV RUSTFLAGS="-C target-feature=-crt-static" +RUN apk --no-cache add openssl direnv git musl-dev openssl-dev build-base perl protoc +RUN git clone --depth=1 --branch=3.11.x https://github.com/prisma/prisma-engines.git /prisma +RUN cargo build --release + +FROM alpine +WORKDIR /prisma-engines +COPY --from=prisma /prisma/target/release/query-engine /prisma/target/release/migration-engine /prisma/target/release/introspection-engine /prisma/target/release/prisma-fmt /prisma-engines/ From 22ef0b5d29c30e39542d3f3549c20418f0afee6d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 17:46:08 +0200 Subject: [PATCH 04/57] Update packages --- Dockerfile | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c95c5398..4b7b67b85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \ PRISMA_CLI_QUERY_ENGINE_TYPE=binary \ PRISMA_CLIENT_ENGINE_TYPE=binary -COPY --from=coollabsio/prisma-engine:arm64 /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/ +COPY --from=coollabsio/prisma-engine:latest /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/ COPY --from=install /app/node_modules ./node_modules COPY . . diff --git a/package.json b/package.json index 7dfd0f6e8..18c3a208e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev:stop": "docker-compose -f docker-compose-dev.yaml down", "dev:logs": "docker-compose -f docker-compose-dev.yaml logs -f --tail 10", "studio": "npx prisma studio", - "start": "npx prisma migrate deploy && npx prisma generate && npx prisma db seed && node index.js", + "start": "npx prisma migrate deploy && npx prisma generate && npx prisma db seed && node build/index.js", "build": "svelte-kit build", "preview": "svelte-kit preview", "check": "svelte-check --tsconfig ./tsconfig.json", From fe17e2eaba615cb83c154837e7b7b709d7c4b526 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 17:57:37 +0200 Subject: [PATCH 05/57] Prisma Engine build script --- data/build-prisma-engine.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 data/build-prisma-engine.sh diff --git a/data/build-prisma-engine.sh b/data/build-prisma-engine.sh new file mode 100644 index 000000000..42c2af608 --- /dev/null +++ b/data/build-prisma-engine.sh @@ -0,0 +1 @@ +nohup docker build -t coollabsio/prisma-engine: --push . & \ No newline at end of file From f6858a68e0f298ec34ba95240883534a92933fd8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 22:51:08 +0200 Subject: [PATCH 06/57] Update schema --- prisma/schema.prisma | 1 + 1 file changed, 1 insertion(+) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a849ae36f..b05a6a6a4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,5 +1,6 @@ generator client { provider = "prisma-client-js" + binaryTargets = ["linux-musl"] } datasource db { From 321fb019eb544946ce3ff54ab1b77dfbcc45ed20 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 1 Apr 2022 23:02:23 +0200 Subject: [PATCH 07/57] Update dockerfiles for arm --- data/haproxy-http.Dockerfile | 6 +++--- data/haproxy-tcp.Dockerfile | 6 +++--- data/haproxy.Dockerfile | 6 +++--- data/haproxy/haproxy.cfg-http.template | 8 ++++---- data/haproxy/haproxy.cfg.template | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/data/haproxy-http.Dockerfile b/data/haproxy-http.Dockerfile index 089ae0f96..de5246628 100644 --- a/data/haproxy-http.Dockerfile +++ b/data/haproxy-http.Dockerfile @@ -1,6 +1,6 @@ FROM haproxytech/haproxy-alpine:2.5 RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe -COPY data/haproxy/haproxy.cfg-http.template /usr/local/etc/haproxy/haproxy.cfg -COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl -COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file +COPY haproxy/haproxy.cfg-http.template /usr/local/etc/haproxy/haproxy.cfg +COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl +COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file diff --git a/data/haproxy-tcp.Dockerfile b/data/haproxy-tcp.Dockerfile index bddcbe541..9b9639777 100644 --- a/data/haproxy-tcp.Dockerfile +++ b/data/haproxy-tcp.Dockerfile @@ -1,6 +1,6 @@ FROM haproxytech/haproxy-alpine:2.5 RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe -COPY data/haproxy/haproxy.cfg-tcp.template /usr/local/etc/haproxy/haproxy.cfg -COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl -COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file +COPY haproxy/haproxy.cfg-tcp.template /usr/local/etc/haproxy/haproxy.cfg +COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl +COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file diff --git a/data/haproxy.Dockerfile b/data/haproxy.Dockerfile index 45e2d9d71..3ab520a65 100644 --- a/data/haproxy.Dockerfile +++ b/data/haproxy.Dockerfile @@ -1,6 +1,6 @@ FROM haproxytech/haproxy-alpine:2.5 RUN mkdir -p /usr/local/etc/haproxy/ssl /usr/local/etc/haproxy/maps /usr/local/etc/haproxy/spoe -COPY data/haproxy/haproxy.cfg.template /usr/local/etc/haproxy/haproxy.cfg -COPY data/haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl -COPY data/haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file +COPY haproxy/haproxy.cfg.template /usr/local/etc/haproxy/haproxy.cfg +COPY haproxy/dataplaneapi.hcl /usr/local/etc/haproxy/dataplaneapi.hcl +COPY haproxy/ssl/default.pem /usr/local/etc/haproxy/ssl/default.pem \ No newline at end of file diff --git a/data/haproxy/haproxy.cfg-http.template b/data/haproxy/haproxy.cfg-http.template index 72fdece7a..f819e9be7 100644 --- a/data/haproxy/haproxy.cfg-http.template +++ b/data/haproxy/haproxy.cfg-http.template @@ -4,10 +4,10 @@ global defaults mode http log global - timeout http-request 60s - timeout connect 10s - timeout client 60s - timeout server 60s + timeout http-request 120s + timeout connect 20s + timeout client 120s + timeout server 120s frontend "${APP}" mode http diff --git a/data/haproxy/haproxy.cfg.template b/data/haproxy/haproxy.cfg.template index c39cb7878..35cb8a74d 100644 --- a/data/haproxy/haproxy.cfg.template +++ b/data/haproxy/haproxy.cfg.template @@ -5,10 +5,10 @@ global defaults mode http log global - timeout http-request 60s - timeout connect 10s - timeout client 60s - timeout server 60s + timeout http-request 120s + timeout connect 20s + timeout client 120s + timeout server 120s userlist haproxy-dataplaneapi user admin insecure-password "${HAPROXY_PASSWORD}" From 1b43976ff0b827c3d176b331a5056ee142373e1a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Apr 2022 13:39:24 +0200 Subject: [PATCH 08/57] Update proxy build commands --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 18c3a208e..922ffc220 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,9 @@ "release:staging": "cross-var docker build -t coollabsio/coolify:$npm_package_version . && docker push coollabsio/coolify:$npm_package_version", "release:pre": "cross-var docker build -t coollabsio/coolify:$npm_package_version -t coollabsio/coolify:latest .", "release:coolify": "cross-var yarn release:pre && docker push coollabsio/coolify:$npm_package_version && docker push coollabsio/coolify:latest", - "release:haproxy": "docker build -f haproxy.Dockerfile -t coollabsio/coolify-haproxy-alpine:1.0.0 -t coollabsio/coolify-haproxy-alpine:latest . && docker image push --all-tags coollabsio/coolify-haproxy-alpine", - "release:haproxy:tcp": "docker build -f haproxy-tcp.Dockerfile -t coollabsio/coolify-haproxy-tcp-alpine:1.0.0 -t coollabsio/coolify-haproxy-tcp-alpine:latest . && docker image push --all-tags coollabsio/coolify-haproxy-tcp-alpine", - "release:haproxy:http": "docker build -f haproxy-http.Dockerfile -t coollabsio/coolify-haproxy-http-alpine:1.0.0 -t coollabsio/coolify-haproxy-http-alpine:latest . && docker image push --all-tags coollabsio/coolify-haproxy-http-alpine", + "release:haproxy": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-alpine:latest -t coollabsio/coolify-haproxy-alpine:1.1.0 -f haproxy.Dockerfile --push .", + "release:haproxy:tcp": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-tcp-alpine:latest -t coollabsio/coolify-haproxy-tcp-alpine:1.1.0 -f haproxy-tcp.Dockerfile --push .", + "release:haproxy:http": "docker build --platform linux/amd64,linux/arm64 -t coollabsio/coolify-haproxy-http-alpine:latest -t coollabsio/coolify-haproxy-http-alpine:1.1.0 -f haproxy-http.Dockerfile --push .", "prepare": "husky install" }, "devDependencies": { From fd652bfce6aa18344049e6c01d1690541e1cad2f Mon Sep 17 00:00:00 2001 From: Philip Schmidt Date: Wed, 6 Apr 2022 18:33:02 +0200 Subject: [PATCH 09/57] write args at the beginning of dockerfile and inherit them for each stage --- src/lib/buildPacks/docker.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lib/buildPacks/docker.ts b/src/lib/buildPacks/docker.ts index 371ffed82..2db5d567c 100644 --- a/src/lib/buildPacks/docker.ts +++ b/src/lib/buildPacks/docker.ts @@ -26,14 +26,17 @@ export default async function ({ if (secrets.length > 0) { secrets.forEach((secret) => { if (secret.isBuildSecret) { - if (pullmergeRequestId) { - if (secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name}=${secret.value}`); - } - } else { - if (!secret.isPRMRSecret) { - Dockerfile.push(`ARG ${secret.name}=${secret.value}`); - } + if ( + (pullmergeRequestId && secret.isPRMRSecret) || + (!pullmergeRequestId && !secret.isPRMRSecret) + ) { + Dockerfile.unshift(`ARG ${secret.name}=${secret.value}`); + + Dockerfile.forEach((line, index) => { + if (line.startsWith('FROM')) { + Dockerfile.splice(index + 1, 0, `ARG ${secret.name}`); + } + }); } } }); From 5bf14f4639e188084863fc06e601cbfd096e045f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 7 Apr 2022 14:29:40 +0200 Subject: [PATCH 10/57] feat: Able to modify database passwords --- src/app.d.ts | 3 + src/lib/components/common.ts | 2 +- src/lib/database/databases.ts | 34 ++++++++ src/lib/database/destinations.ts | 4 +- .../[id]/_Databases/_Databases.svelte | 82 +++++++++++++------ .../databases/[id]/_Databases/_MongoDB.svelte | 9 +- .../databases/[id]/_Databases/_MySQL.svelte | 16 ++-- .../[id]/_Databases/_PostgreSQL.svelte | 9 +- .../databases/[id]/_Databases/_Redis.svelte | 36 ++------ src/routes/databases/[id]/__layout.svelte | 16 ++-- src/routes/databases/[id]/index.json.ts | 33 ++++++-- src/routes/databases/[id]/index.svelte | 6 +- .../destinations/[id]/_LocalDocker.svelte | 12 ++- 13 files changed, 167 insertions(+), 95 deletions(-) diff --git a/src/app.d.ts b/src/app.d.ts index a88bd7502..d432aef4a 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -15,6 +15,9 @@ declare namespace App { readOnly: boolean; source: string; settings: string; + database: Record; + versions: string; + privatePort: string; } } diff --git a/src/lib/components/common.ts b/src/lib/components/common.ts index 3e5568432..2bd962c4c 100644 --- a/src/lib/components/common.ts +++ b/src/lib/components/common.ts @@ -56,7 +56,7 @@ export const supportedDatabaseTypesAndVersions = [ name: 'postgresql', fancyName: 'PostgreSQL', baseImage: 'bitnami/postgresql', - versions: ['14.2', '13.6', '12.10', '11.15', '10.20'] + versions: ['14.2.0', '13.6.0', '12.10.0 ', '11.15.0', '10.20.0'] }, { name: 'redis', diff --git a/src/lib/database/databases.ts b/src/lib/database/databases.ts index 7fc237944..2179b5479 100644 --- a/src/lib/database/databases.ts +++ b/src/lib/database/databases.ts @@ -137,3 +137,37 @@ export async function stopDatabase(database) { } return everStarted; } + +export async function updatePasswordInDb(database, user, newPassword) { + const { + id, + type, + rootUser, + rootUserPassword, + dbUser, + dbUserPassword, + defaultDatabase, + destinationDockerId, + destinationDocker: { engine } + } = database; + if (destinationDockerId) { + const host = getEngine(engine); + if (type === 'mysql') { + await asyncExecShell( + `DOCKER_HOST=${host} docker exec ${id} mysql -u ${rootUser} -p${rootUserPassword} -e \"ALTER USER '${user}'@'%' IDENTIFIED WITH caching_sha2_password BY '${newPassword}';\"` + ); + } else if (type === 'postgresql') { + await asyncExecShell( + `DOCKER_HOST=${host} docker exec ${id} psql postgresql://${dbUser}:${dbUserPassword}@${id}:5432/${defaultDatabase} -c "ALTER role ${user} WITH PASSWORD '${newPassword}'"` + ); + } else if (type === 'mongodb') { + await asyncExecShell( + `DOCKER_HOST=${host} docker exec ${id} mongo 'mongodb://${rootUser}:${rootUserPassword}@${id}:27017/admin?readPreference=primary&ssl=false' --eval "db.changeUserPassword('${user}','${newPassword}')"` + ); + } else if (type === 'redis') { + await asyncExecShell( + `DOCKER_HOST=${host} docker exec ${id} redis-cli -u redis://${dbUserPassword}@${id}:6379 --raw CONFIG SET requirepass ${newPassword}` + ); + } + } +} diff --git a/src/lib/database/destinations.ts b/src/lib/database/destinations.ts index 5bd63c81b..7b2570d93 100644 --- a/src/lib/database/destinations.ts +++ b/src/lib/database/destinations.ts @@ -44,9 +44,7 @@ export async function configureDestinationForDatabase({ id, destinationId }) { const host = getEngine(engine); if (type && version) { const baseImage = getDatabaseImage(type); - asyncExecShell( - `DOCKER_HOST=${host} docker pull ${baseImage}:${version} && echo "FROM ${baseImage}:${version}" | docker build --label coolify.image="true" -t "${baseImage}:${version}" -` - ); + asyncExecShell(`DOCKER_HOST=${host} docker pull ${baseImage}:${version}`); } } } diff --git a/src/routes/databases/[id]/_Databases/_Databases.svelte b/src/routes/databases/[id]/_Databases/_Databases.svelte index 1820577bc..731dcd80e 100644 --- a/src/routes/databases/[id]/_Databases/_Databases.svelte +++ b/src/routes/databases/[id]/_Databases/_Databases.svelte @@ -2,6 +2,8 @@ export let database; export let privatePort; export let settings; + export let isRunning; + import { page, session } from '$app/stores'; import CopyPasswordField from '$lib/components/CopyPasswordField.svelte'; import Setting from '$lib/components/Setting.svelte'; @@ -15,24 +17,36 @@ import { browser } from '$app/env'; import { post } from '$lib/api'; import { getDomain } from '$lib/components/common'; + import { toast } from '@zerodevx/svelte-toast'; const { id } = $page.params; + let loading = false; + let publicLoading = false; + let isPublic = database.settings.isPublic || false; let appendOnly = database.settings.appendOnly; - let databaseDefault = database.defaultDatabase; - let databaseDbUser = database.dbUser; - let databaseDbUserPassword = database.dbUserPassword; - if (database.type === 'mongodb') { - databaseDefault = '?readPreference=primary&ssl=false'; - databaseDbUser = database.rootUser; - databaseDbUserPassword = database.rootUserPassword; - } else if (database.type === 'redis') { - databaseDefault = ''; - databaseDbUser = ''; + let databaseDefault; + let databaseDbUser; + let databaseDbUserPassword; + + generateDbDetails(); + + function generateDbDetails() { + databaseDefault = database.defaultDatabase; + databaseDbUser = database.dbUser; + databaseDbUserPassword = database.dbUserPassword; + if (database.type === 'mongodb') { + databaseDefault = '?readPreference=primary&ssl=false'; + databaseDbUser = database.rootUser; + databaseDbUserPassword = database.rootUserPassword; + } else if (database.type === 'redis') { + databaseDefault = ''; + databaseDbUser = ''; + } } - let databaseUrl = generateUrl(); + $: databaseUrl = generateUrl(); function generateUrl() { return browser @@ -49,28 +63,46 @@ } async function changeSettings(name) { + if (publicLoading || !isRunning) return; + publicLoading = true; + let data = { + isPublic, + appendOnly + }; if (name === 'isPublic') { - isPublic = !isPublic; + data.isPublic = !isPublic; } if (name === 'appendOnly') { - appendOnly = !appendOnly; + data.appendOnly = !appendOnly; } try { - const { publicPort } = await post(`/databases/${id}/settings.json`, { isPublic, appendOnly }); + const { publicPort } = await post(`/databases/${id}/settings.json`, { + isPublic: data.isPublic, + appendOnly: data.appendOnly + }); + isPublic = data.isPublic; + appendOnly = data.appendOnly; + databaseUrl = generateUrl(); if (isPublic) { database.publicPort = publicPort; } - databaseUrl = generateUrl(); } catch ({ error }) { return errorNotification(error); + } finally { + publicLoading = false; } } async function handleSubmit() { try { - await post(`/databases/${id}.json`, { ...database }); - return window.location.reload(); + loading = true; + await post(`/databases/${id}.json`, { ...database, isRunning }); + generateDbDetails(); + databaseUrl = generateUrl(); + toast.push('Settings saved.'); } catch ({ error }) { return errorNotification(error); + } finally { + loading = false; } } @@ -142,21 +174,21 @@ readonly disabled name="publicPort" - value={isPublic ? database.publicPort : privatePort} + value={publicLoading ? 'Loading...' : isPublic ? database.publicPort : privatePort} />
{#if database.type === 'mysql'} - + {:else if database.type === 'postgresql'} - + {:else if database.type === 'mongodb'} - + {:else if database.type === 'redis'} - + {:else if database.type === 'couchdb'} - + {/if}
@@ -168,7 +200,7 @@ name="url" readonly disabled - value={databaseUrl} + value={publicLoading || loading ? 'Loading...' : databaseUrl} />
@@ -179,10 +211,12 @@
changeSettings('isPublic')} title="Set it public" description="Your database will be reachable over the internet.
Take security seriously in this case!" + disabled={!isRunning} />
{#if database.type === 'redis'} diff --git a/src/routes/databases/[id]/_Databases/_MongoDB.svelte b/src/routes/databases/[id]/_Databases/_MongoDB.svelte index 7ec21edcd..fa73b870e 100644 --- a/src/routes/databases/[id]/_Databases/_MongoDB.svelte +++ b/src/routes/databases/[id]/_Databases/_MongoDB.svelte @@ -1,6 +1,8 @@
@@ -21,13 +23,14 @@
+
diff --git a/src/routes/databases/[id]/_Databases/_MySQL.svelte b/src/routes/databases/[id]/_Databases/_MySQL.svelte index f085b3320..27057049b 100644 --- a/src/routes/databases/[id]/_Databases/_MySQL.svelte +++ b/src/routes/databases/[id]/_Databases/_MySQL.svelte @@ -1,6 +1,8 @@
@@ -33,14 +35,15 @@
+
@@ -56,13 +59,14 @@
+
diff --git a/src/routes/databases/[id]/_Databases/_PostgreSQL.svelte b/src/routes/databases/[id]/_Databases/_PostgreSQL.svelte index 3f995cafc..d59f6bbbc 100644 --- a/src/routes/databases/[id]/_Databases/_PostgreSQL.svelte +++ b/src/routes/databases/[id]/_Databases/_PostgreSQL.svelte @@ -1,6 +1,8 @@
@@ -33,13 +35,14 @@
+
diff --git a/src/routes/databases/[id]/_Databases/_Redis.svelte b/src/routes/databases/[id]/_Databases/_Redis.svelte index fece7c837..fdd2ce5f1 100644 --- a/src/routes/databases/[id]/_Databases/_Redis.svelte +++ b/src/routes/databases/[id]/_Databases/_Redis.svelte @@ -1,6 +1,8 @@
@@ -10,40 +12,14 @@
+
-
diff --git a/src/routes/databases/[id]/__layout.svelte b/src/routes/databases/[id]/__layout.svelte index ae08d48f7..45016da69 100644 --- a/src/routes/databases/[id]/__layout.svelte +++ b/src/routes/databases/[id]/__layout.svelte @@ -15,7 +15,7 @@ const endpoint = `/databases/${params.id}.json`; const res = await fetch(endpoint); if (res.ok) { - const { database, state, versions, privatePort, settings } = await res.json(); + const { database, isRunning, versions, privatePort, settings } = await res.json(); if (!database || Object.entries(database).length === 0) { return { status: 302, @@ -35,13 +35,13 @@ return { props: { database, - state, + isRunning, versions, privatePort }, stuff: { database, - state, + isRunning, versions, privatePort, settings @@ -65,7 +65,7 @@ import { goto } from '$app/navigation'; export let database; - export let state; + export let isRunning; let loading = false; async function deleteDatabase() { @@ -91,8 +91,6 @@ return window.location.reload(); } catch ({ error }) { return errorNotification(error); - } finally { - loading = false; } } } @@ -103,8 +101,6 @@ return window.location.reload(); } catch ({ error }) { return errorNotification(error); - } finally { - loading = false; } } @@ -114,7 +110,7 @@ {:else} {#if database.type && database.destinationDockerId && database.version && database.defaultDatabase} - {#if state === 'running'} + {#if isRunning} - {:else if state === 'not started'} + {:else} -
-
- - -
-
- - -
- -
- - -
-
- - -
- -
diff --git a/src/routes/new/source/index.svelte b/src/routes/new/source/index.svelte deleted file mode 100644 index 73384561a..000000000 --- a/src/routes/new/source/index.svelte +++ /dev/null @@ -1,66 +0,0 @@ - - -
-
Add New Git Source
-
- -
-
Official providers
-
- - - -
-
-
- {#if gitSource.type === 'github'} - - {:else if gitSource.type === 'gitlab'} - - {:else if gitSource.type === 'bitbucket'} -
Not implemented yet
- {/if} -
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index 06e74873b..389ee8036 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -13,6 +13,7 @@ import Ghost from '$lib/components/svg/services/Ghost.svelte'; import MeiliSearch from '$lib/components/svg/services/MeiliSearch.svelte'; import { session } from '$app/stores'; + import { getDomain } from '$lib/components/common'; export let services; async function newService() { @@ -87,9 +88,12 @@
{service.name}
- {#if $session.teamId === '0'} + {#if $session.teamId === '0' && otherServices.length > 0}
{service.teams[0].name}
{/if} + {#if service.fqdn} +
{getDomain(service.fqdn)}
+ {/if} {#if !service.type || !service.fqdn}
Configuration missing @@ -134,6 +138,9 @@ {#if $session.teamId === '0'}
{service.teams[0].name}
{/if} + {#if service.fqdn} +
{getDomain(service.fqdn)}
+ {/if} {#if !service.type || !service.fqdn}
Configuration missing diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index 102971353..b2866d195 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -3,13 +3,19 @@ import { page, session } from '$app/stores'; import { post } from '$lib/api'; import { errorNotification } from '$lib/form'; + import { toast } from '@zerodevx/svelte-toast'; const { id } = $page.params; let loading = false; async function handleSubmit() { loading = true; try { - return await post(`/sources/${id}.json`, { name: source.name }); + await post(`/sources/${id}.json`, { + name: source.name, + htmlUrl: source.htmlUrl, + apiUrl: source.apiUrl + }); + toast.push('Settings saved.'); } catch ({ error }) { return errorNotification(error); } finally { @@ -38,7 +44,18 @@ }, 100); } - function newGithubApp() { + async function newGithubApp() { + loading = true; + try { + await post(`/sources/${id}/github.json`, { + type: 'github', + name: source.name, + htmlUrl: source.htmlUrl, + apiUrl: source.apiUrl + }); + } catch ({ error }) { + return errorNotification(error); + } const left = screen.width / 2 - 1020 / 2; const top = screen.height / 2 - 618 / 2; const newWindow = open( @@ -59,31 +76,72 @@ } -{#if !source.githubAppId} - -{:else if source.githubApp?.installationId} -
-
-
General
- {#if $session.isAdmin} - - - {/if} -
-
-
- - +
+ {#if !source.githubAppId} + +
+
General
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+ {#if source.apiUrl && source.htmlUrl && source.name} +
+ +
+ {/if} + + {:else if source.githubAppId} +
+
+
General
+ {#if $session.isAdmin} + + + {/if} +
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ {:else} +
+
- -{:else} - -{/if} + {/if} +
diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index 7823aebe9..bf3b48733 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -1,35 +1,73 @@ -{#if !source.gitlabApp?.appId} -
-
-
- - -
- {#if payload.applicationType === 'group'} -
- - -
- {/if} - -
- -
- - - -
-
-
Configuration
+
+ +
+
General
+ {#if $session.isAdmin} -
+ {#if source.gitlabAppId} + + {/if} + {/if} +
+
+ {#if !source.gitlabAppId} +
+ + +
-
-
- - + + +
+ {/if} + {/if} + +
+
+ + +
+
+ {#if source.gitlabApp.groupName} +
+ +
+ {/if} +
+ + +
+
+ + +
+
+
+ + {#if !source.gitlabAppId} + + {/if} +
- {#if payload.applicationType === 'group'} -
- - -
- {/if} +
- - + +
- - Secret +
- -
-{:else} -
-
-
-
General
- {#if $session.isAdmin} - - - {/if} -
-
-
- - -
-
-
-
-{/if} +
+ + {#if !source.gitlabAppId} + + {/if} +
diff --git a/src/routes/sources/[id]/github.json.ts b/src/routes/sources/[id]/github.json.ts new file mode 100644 index 000000000..e0f1d3b61 --- /dev/null +++ b/src/routes/sources/[id]/github.json.ts @@ -0,0 +1,18 @@ +import { getUserDetails } from '$lib/common'; +import * as db from '$lib/database'; +import { ErrorHandler } from '$lib/database'; +import type { RequestHandler } from '@sveltejs/kit'; + +export const post: RequestHandler = async (event) => { + const { teamId, status, body } = await getUserDetails(event); + if (status === 401) return { status, body }; + const { id } = event.params; + + try { + let { type, name, htmlUrl, apiUrl } = await event.request.json(); + await db.addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl }); + return { status: 201 }; + } catch (error) { + return ErrorHandler(error); + } +}; diff --git a/src/routes/sources/[id]/gitlab.json.ts b/src/routes/sources/[id]/gitlab.json.ts index 8420669e6..b1ed314bf 100644 --- a/src/routes/sources/[id]/gitlab.json.ts +++ b/src/routes/sources/[id]/gitlab.json.ts @@ -9,11 +9,23 @@ export const post: RequestHandler = async (event) => { const { id } = event.params; try { - let { oauthId, groupName, appId, appSecret } = await event.request.json(); + let { type, name, htmlUrl, apiUrl, oauthId, appId, appSecret, groupName } = + await event.request.json(); oauthId = Number(oauthId); - await db.addSource({ id, teamId, oauthId, groupName, appId, appSecret }); + await db.addGitLabSource({ + id, + teamId, + type, + name, + htmlUrl, + apiUrl, + oauthId, + appId, + appSecret, + groupName + }); return { status: 201 }; } catch (error) { return ErrorHandler(error); diff --git a/src/routes/sources/[id]/index.json.ts b/src/routes/sources/[id]/index.json.ts index 58fb7008b..cd19e6785 100644 --- a/src/routes/sources/[id]/index.json.ts +++ b/src/routes/sources/[id]/index.json.ts @@ -43,10 +43,10 @@ export const post: RequestHandler = async (event) => { const { id } = event.params; - const { name } = await event.request.json(); + const { name, htmlUrl, apiUrl } = await event.request.json(); try { - await db.updateGitsource({ id, name }); + await db.updateGitsource({ id, name, htmlUrl, apiUrl }); return { status: 201 }; } catch (error) { return ErrorHandler(error); diff --git a/src/routes/sources/[id]/index.svelte b/src/routes/sources/[id]/index.svelte index 83f171412..015c98a1f 100644 --- a/src/routes/sources/[id]/index.svelte +++ b/src/routes/sources/[id]/index.svelte @@ -29,9 +29,41 @@
@@ -40,10 +72,21 @@ {source.name}
-
- {#if source.type === 'github'} - - {:else if source.type === 'gitlab'} - +
+ {#if !source.gitlabAppId && !source.githubAppId} +
+
Select a provider
+
+ + +
+
{/if} +
+ {#if source.type === 'github'} + + {:else if source.type === 'gitlab'} + + {/if} +
diff --git a/src/routes/sources/[id]/newGithubApp.svelte b/src/routes/sources/[id]/newGithubApp.svelte index c8cb4f6f3..b6a74c3ba 100644 --- a/src/routes/sources/[id]/newGithubApp.svelte +++ b/src/routes/sources/[id]/newGithubApp.svelte @@ -36,6 +36,7 @@ export let settings; onMount(() => { const { organization, id, htmlUrl } = source; + console.log(source); const { fqdn } = settings; const host = dev ? 'http://localhost:3000' diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index c763e0b58..e07c21973 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -22,6 +22,9 @@
@@ -71,7 +78,7 @@ class:border-l-4={source.gitlabApp && !source.gitlabAppId} >
{source.name}
- {#if $session.teamId === '0'} + {#if $session.teamId === '0' && otherSources.length > 0}
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} @@ -79,7 +86,7 @@ Configuration missing
{:else} -
{source.htmlUrl}
+
{getDomain(source.htmlUrl)}
{/if}
diff --git a/src/routes/new/source/index.json.ts b/src/routes/sources/new.ts similarity index 64% rename from src/routes/new/source/index.json.ts rename to src/routes/sources/new.ts index 803b597e9..25943f8bc 100644 --- a/src/routes/new/source/index.json.ts +++ b/src/routes/sources/new.ts @@ -1,4 +1,4 @@ -import { getUserDetails } from '$lib/common'; +import { getUserDetails, uniqueName } from '$lib/common'; import * as db from '$lib/database'; import { ErrorHandler } from '$lib/database'; import type { RequestHandler } from '@sveltejs/kit'; @@ -7,9 +7,9 @@ export const post: RequestHandler = async (event) => { const { teamId, status, body } = await getUserDetails(event); if (status === 401) return { status, body }; - const { name, type, htmlUrl, apiUrl, organization } = await event.request.json(); + const name = uniqueName(); try { - const { id } = await db.newSource({ name, teamId, type, htmlUrl, apiUrl, organization }); + const { id } = await db.newSource({ teamId, name }); return { status: 201, body: { id } }; } catch (e) { return ErrorHandler(e); From a165b219500572416b7566a517a770864901d589 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:47:01 +0200 Subject: [PATCH 32/57] ui: fix --- src/routes/sources/[id]/_Github.svelte | 2 +- src/routes/sources/[id]/_Gitlab.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index b2866d195..af776cfea 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -76,7 +76,7 @@ } -
+
{#if !source.githubAppId}
diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index bf3b48733..89e43cfe3 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -121,7 +121,7 @@ } -
+
General
From 1657e5a151cd28f2b805cbf56798b8b6749ed615 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:54:40 +0200 Subject: [PATCH 33/57] fix: no line during buildLog --- src/lib/common.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/common.ts b/src/lib/common.ts index 4eec73539..57cdabba2 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -52,12 +52,14 @@ export const sentry = Sentry; export const uniqueName = () => uniqueNamesGenerator(customConfig); export const saveBuildLog = async ({ line, buildId, applicationId }) => { - if (line.includes('ghs_')) { - const regex = /ghs_.*@/g; - line = line.replace(regex, '@'); + if (line) { + if (line.includes('ghs_')) { + const regex = /ghs_.*@/g; + line = line.replace(regex, '@'); + } + const addTimestamp = `${generateTimestamp()} ${line}`; + return await buildLogQueue.add(buildId, { buildId, line: addTimestamp, applicationId }); } - const addTimestamp = `${generateTimestamp()} ${line}`; - return await buildLogQueue.add(buildId, { buildId, line: addTimestamp, applicationId }); }; export const isTeamIdTokenAvailable = (request) => { From 0b709c93a8a2fa9892b720255a87717c2741e11c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 10:57:44 +0200 Subject: [PATCH 34/57] fix: html/apiUrls cannot end with / --- src/routes/sources/[id]/_Github.svelte | 8 ++++---- src/routes/sources/[id]/_Gitlab.svelte | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte index af776cfea..6b8aa0c89 100644 --- a/src/routes/sources/[id]/_Github.svelte +++ b/src/routes/sources/[id]/_Github.svelte @@ -12,8 +12,8 @@ try { await post(`/sources/${id}.json`, { name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); toast.push('Settings saved.'); } catch ({ error }) { @@ -50,8 +50,8 @@ await post(`/sources/${id}/github.json`, { type: 'github', name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); } catch ({ error }) { return errorNotification(error); diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte index 89e43cfe3..b528b1850 100644 --- a/src/routes/sources/[id]/_Gitlab.svelte +++ b/src/routes/sources/[id]/_Gitlab.svelte @@ -38,8 +38,8 @@ await post(`/sources/${id}/gitlab.json`, { type: 'gitlab', name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl, + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, ''), oauthId: source.gitlabApp.oauthId, appId: source.gitlabApp.appId, appSecret: source.gitlabApp.appSecret, @@ -56,8 +56,8 @@ try { await post(`/sources/${id}.json`, { name: source.name, - htmlUrl: source.htmlUrl, - apiUrl: source.apiUrl + htmlUrl: source.htmlUrl.replace(/\/$/, ''), + apiUrl: source.apiUrl.replace(/\/$/, '') }); } catch ({ error }) { return errorNotification(error); From d9ba1a0b5c6fb42087cbd830263cdbfe770f1130 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 11:16:07 +0200 Subject: [PATCH 35/57] fix: typo --- src/routes/sources/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index e07c21973..f8891531d 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -94,7 +94,7 @@
{#if otherSources.length > 0 && $session.teamId === '0'} -
Other Srouces
+
Other Sources
{#each otherSources as source} From ce71dccbc1285cbe1956675706530de437b1da2e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 11:19:01 +0200 Subject: [PATCH 36/57] fix: Missing buildpack --- src/routes/applications/index.svelte | 112 ++++++++++++++------------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 0c69c47fe..5fb4979cc 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -68,60 +68,7 @@ {#each ownApplications as application}
- {#if application.buildPack.toLowerCase() === 'rust'} - - {:else if application.buildPack.toLowerCase() === 'node'} - - {:else if application.buildPack.toLowerCase() === 'react'} - - {:else if application.buildPack.toLowerCase() === 'svelte'} - - {:else if application.buildPack.toLowerCase() === 'vuejs'} - - {:else if application.buildPack.toLowerCase() === 'php'} - - {:else if application.buildPack.toLowerCase() === 'python'} - - {:else if application.buildPack.toLowerCase() === 'static'} - - {:else if application.buildPack.toLowerCase() === 'nestjs'} - - {:else if application.buildPack.toLowerCase() === 'nuxtjs'} - - {:else if application.buildPack.toLowerCase() === 'nextjs'} - - {:else if application.buildPack.toLowerCase() === 'gatsby'} - - {:else if application.buildPack.toLowerCase() === 'docker'} - - {:else if application.buildPack.toLowerCase() === 'astro'} - - {:else if application.buildPack.toLowerCase() === 'eleventy'} - - {/if} - -
{application.name}
- {#if $session.teamId === '0' && otherApplications.length > 0} -
Team {application.teams[0].name}
- {/if} - {#if application.fqdn} -
{getDomain(application.fqdn)}
- {/if} - {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn} -
- Configuration missing -
- {/if} -
-
- {/each} -
- {#if otherApplications.length > 0 && $session.teamId === '0'} -
Other Applications
-
+ {#if otherApplications.length > 0 && $session.teamId === '0'} +
Other Applications
+
+ {#each otherApplications as application} + +
+ {#if application.buildPack} + {#if application.buildPack.toLowerCase() === 'rust'} + + {:else if application.buildPack.toLowerCase() === 'node'} + + {:else if application.buildPack.toLowerCase() === 'react'} + + {:else if application.buildPack.toLowerCase() === 'svelte'} + + {:else if application.buildPack.toLowerCase() === 'vuejs'} + + {:else if application.buildPack.toLowerCase() === 'php'} + + {:else if application.buildPack.toLowerCase() === 'python'} + + {:else if application.buildPack.toLowerCase() === 'static'} + + {:else if application.buildPack.toLowerCase() === 'nestjs'} + + {:else if application.buildPack.toLowerCase() === 'nuxtjs'} + + {:else if application.buildPack.toLowerCase() === 'nextjs'} + + {:else if application.buildPack.toLowerCase() === 'gatsby'} + + {:else if application.buildPack.toLowerCase() === 'docker'} + + {:else if application.buildPack.toLowerCase() === 'astro'} + + {:else if application.buildPack.toLowerCase() === 'eleventy'} + + {/if} + {/if}
{application.name}
{#if $session.teamId === '0'} From 13acf09dcc119e42594829428e3f5c8d03ef9081 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:03:21 +0200 Subject: [PATCH 37/57] ui: fixes --- src/routes/applications/[id]/configuration/source.svelte | 8 ++++++-- src/routes/applications/index.svelte | 6 +++--- src/routes/databases/index.svelte | 2 +- src/routes/destinations/index.svelte | 2 +- src/routes/services/index.svelte | 6 +++--- src/routes/sources/index.svelte | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/routes/applications/[id]/configuration/source.svelte b/src/routes/applications/[id]/configuration/source.svelte index 953c23d69..1be6330d1 100644 --- a/src/routes/applications/[id]/configuration/source.svelte +++ b/src/routes/applications/[id]/configuration/source.svelte @@ -54,6 +54,10 @@ return errorNotification(error); } } + async function newSource() { + const { id } = await post('/sources/new', {}); + return await goto(`/sources/${id}`, { replaceState: true }); + }
@@ -64,7 +68,7 @@ {:else} diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 5fb4979cc..3221f6634 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -58,7 +58,7 @@ {/if}
- {#if !applications || applications.length === 0} + {#if !applications || ownApplications.length === 0}
No applications found
@@ -107,7 +107,7 @@
Team {application.teams[0].name}
{/if} {#if application.fqdn} -
{getDomain(application.fqdn)}
+
{getDomain(application.fqdn) || ''}
{/if} {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn}
@@ -163,7 +163,7 @@
Team {application.teams[0].name}
{/if} {#if application.fqdn} -
{getDomain(application.fqdn)}
+
{getDomain(application.fqdn) || ''}
{/if} {#if !application.gitSourceId || !application.destinationDockerId || !application.fqdn}
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index c160bc009..4ace17e27 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -46,7 +46,7 @@
- {#if !databases || databases.length === 0} + {#if !databases || ownDatabases.length === 0}
No databases found
diff --git a/src/routes/destinations/index.svelte b/src/routes/destinations/index.svelte index 84d1fc0bb..7c04f8aab 100644 --- a/src/routes/destinations/index.svelte +++ b/src/routes/destinations/index.svelte @@ -57,7 +57,7 @@ {/if}
- {#if !destinations || destinations.length === 0} + {#if !destinations || ownDestinations.length === 0}
No destination found
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index 389ee8036..e829256c4 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -52,7 +52,7 @@
- {#if !services || services.length === 0} + {#if !services || ownServices.length === 0}
No services found
@@ -92,7 +92,7 @@
{service.teams[0].name}
{/if} {#if service.fqdn} -
{getDomain(service.fqdn)}
+
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn}
@@ -139,7 +139,7 @@
{service.teams[0].name}
{/if} {#if service.fqdn} -
{getDomain(service.fqdn)}
+
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn}
diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index f8891531d..ba4e6e9c5 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -62,7 +62,7 @@ {/if}
- {#if !sources || sources.length === 0} + {#if !sources || ownSources.length === 0}
No git sources found
@@ -86,7 +86,7 @@ Configuration missing
{:else} -
{getDomain(source.htmlUrl)}
+
{getDomain(source.htmlUrl) || ''}
{/if}
From 66af12f9b5be595841f19b2263744728eb9c5455 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:12:06 +0200 Subject: [PATCH 38/57] ui: fixes --- src/routes/applications/index.svelte | 9 +++++---- src/routes/databases/index.svelte | 29 ++++++++++++++-------------- src/routes/destinations/index.svelte | 25 ++++++++++++------------ src/routes/services/index.svelte | 29 ++++++++++++++-------------- src/routes/sources/index.svelte | 29 ++++++++++++++-------------- 5 files changed, 63 insertions(+), 58 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 3221f6634..99bb67175 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -62,9 +62,10 @@
No applications found
- {:else} + {/if} + {#if ownApplications.length > 0 || otherApplications.length > 0}
-
+
{#each ownApplications as application}
@@ -119,8 +120,8 @@ {/each}
{#if otherApplications.length > 0 && $session.teamId === '0'} -
Other Applications
-
+
Other Applications
+
{#each otherApplications as application}
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index 4ace17e27..29ef54965 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -50,12 +50,13 @@
No databases found
- {:else} + {/if} + {#if ownDatabases.length > 0 || otherDatabases.length > 0}
-
+
{#each ownDatabases as database} - -
+ +
{#if database.type === 'clickhouse'} {:else if database.type === 'couchdb'} @@ -69,14 +70,14 @@ {:else if database.type === 'redis'} {/if} -
+
{database.name}
{#if $session.teamId === '0' && otherDatabases.length > 0} -
{database.teams[0].name}
+
{database.teams[0].name}
{/if} {#if !database.type} -
+
Configuration missing
{/if} @@ -85,11 +86,11 @@ {/each}
{#if otherDatabases.length > 0 && $session.teamId === '0'} -
Other Databases
-
+
Other Databases
+
{#each otherDatabases as database} - -
+ +
{#if database.type === 'clickhouse'} {:else if database.type === 'couchdb'} @@ -103,14 +104,14 @@ {:else if database.type === 'redis'} {/if} -
+
{database.name}
{#if $session.teamId === '0'} -
{database.teams[0].name}
+
{database.teams[0].name}
{/if} {#if !database.type} -
+
Configuration missing
{:else} diff --git a/src/routes/destinations/index.svelte b/src/routes/destinations/index.svelte index 7c04f8aab..6921e4db4 100644 --- a/src/routes/destinations/index.svelte +++ b/src/routes/destinations/index.svelte @@ -61,33 +61,34 @@
No destination found
- {:else} + {/if} + {#if ownDestinations.length > 0 || otherDestinations.length > 0}
-
+ {#if otherDestinations.length > 0 && $session.teamId === '0'} -
Other Destinations
-
+
Other Destinations
+
{#each otherDestinations as destination} - +
-
{destination.name}
+
{destination.name}
{#if $session.teamId === '0'} -
{destination.teams[0].name}
+
{destination.teams[0].name}
{/if} -
{destination.network}
+
{destination.network}
{/each} diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index e829256c4..f8022f14f 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -56,12 +56,13 @@
No services found
- {:else} + {/if} + {#if ownServices.length > 0 || otherServices.length > 0}
-
+
{#each ownServices as service} - -
+ +
{#if service.type === 'plausibleanalytics'} {:else if service.type === 'nocodb'} @@ -85,17 +86,17 @@ {:else if service.type === 'meilisearch'} {/if} -
+
{service.name}
{#if $session.teamId === '0' && otherServices.length > 0} -
{service.teams[0].name}
+
{service.teams[0].name}
{/if} {#if service.fqdn}
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn} -
+
Configuration missing
{/if} @@ -104,11 +105,11 @@ {/each}
{#if otherServices.length > 0 && $session.teamId === '0'} -
Other Services
-
+
Other Services
+
{#each otherServices as service} - -
+ +
{#if service.type === 'plausibleanalytics'} {:else if service.type === 'nocodb'} @@ -132,17 +133,17 @@ {:else if service.type === 'meilisearch'} {/if} -
+
{service.name}
{#if $session.teamId === '0'} -
{service.teams[0].name}
+
{service.teams[0].name}
{/if} {#if service.fqdn}
{getDomain(service.fqdn) || ''}
{/if} {#if !service.type || !service.fqdn} -
+
Configuration missing
{:else} diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index ba4e6e9c5..9bde85feb 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -66,23 +66,24 @@
No git sources found
- {:else} + {/if} + {#if ownSources.length > 0 || otherSources.length > 0}
-
+
{#each ownSources as source} - +
-
{source.name}
+
{source.name}
{#if $session.teamId === '0' && otherSources.length > 0} -
{source.teams[0].name}
+
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} -
+
Configuration missing
{:else} @@ -94,22 +95,22 @@
{#if otherSources.length > 0 && $session.teamId === '0'} -
Other Sources
-
+
Other Sources
+
{#each otherSources as source} - +
-
{source.name}
+
{source.name}
{#if $session.teamId === '0'} -
{source.teams[0].name}
+
{source.teams[0].name}
{/if} {#if (source.type === 'gitlab' && !source.gitlabAppId) || (source.type === 'github' && !source.githubAppId && !source.githubApp?.installationId)} -
+
Configuration missing
{:else} From 3449e0f8fc02ced1ce13f8b911f04d4a92bc2b1d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 14:16:14 +0200 Subject: [PATCH 39/57] ui: fix --- src/routes/sources/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index 9bde85feb..fe4063f3f 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -61,7 +61,7 @@ {/if}
-
+
{#if !sources || ownSources.length === 0}
No git sources found
From e3f78a1cf9d052ff37d870b30d4b5149d255a8c9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 15:02:48 +0200 Subject: [PATCH 40/57] ui: fixes --- src/routes/applications/index.svelte | 2 +- src/routes/databases/index.svelte | 2 +- src/routes/services/index.svelte | 2 +- src/routes/sources/index.svelte | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 99bb67175..3cfcbf141 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -57,7 +57,7 @@
{/if}
-
+
{#if !applications || ownApplications.length === 0}
No applications found
diff --git a/src/routes/databases/index.svelte b/src/routes/databases/index.svelte index 29ef54965..a47dbc66f 100644 --- a/src/routes/databases/index.svelte +++ b/src/routes/databases/index.svelte @@ -45,7 +45,7 @@
-
+
{#if !databases || ownDatabases.length === 0}
No databases found
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte index f8022f14f..998779a1f 100644 --- a/src/routes/services/index.svelte +++ b/src/routes/services/index.svelte @@ -51,7 +51,7 @@
-
+
{#if !services || ownServices.length === 0}
No services found
diff --git a/src/routes/sources/index.svelte b/src/routes/sources/index.svelte index fe4063f3f..1e2d4d510 100644 --- a/src/routes/sources/index.svelte +++ b/src/routes/sources/index.svelte @@ -61,7 +61,7 @@ {/if}
-
+
{#if !sources || ownSources.length === 0}
No git sources found
From e8516bc83193a4b4fd439aa32e76cacc4c06c824 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 8 Apr 2022 15:12:10 +0200 Subject: [PATCH 41/57] ui: fixes --- .../[id]/configuration/destination.svelte | 35 ++++++++++++-- .../[id]/configuration/source.svelte | 46 +++++++++++++++++-- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/src/routes/applications/[id]/configuration/destination.svelte b/src/routes/applications/[id]/configuration/destination.svelte index 2c796b5ed..1b0c6df5c 100644 --- a/src/routes/applications/[id]/configuration/destination.svelte +++ b/src/routes/applications/[id]/configuration/destination.svelte @@ -29,7 +29,7 @@
@@ -164,7 +161,6 @@ -

Paste .env file