From 06563ef9218cced90be5a945c53daa20212e2aa9 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 20 Feb 2023 10:23:31 +0100 Subject: [PATCH 1/3] add latest tag with prod release --- .github/workflows/production-release.yml | 1 + others/scripts/bumpLatest.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 others/scripts/bumpLatest.sh diff --git a/.github/workflows/production-release.yml b/.github/workflows/production-release.yml index 12545015f..752e4fbec 100644 --- a/.github/workflows/production-release.yml +++ b/.github/workflows/production-release.yml @@ -104,6 +104,7 @@ jobs: - name: Create & publish manifest run: | docker buildx imagetools create --append coollabsio/coolify:${{steps.package-version.outputs.current-version}}-arm64 --append coollabsio/coolify:${{steps.package-version.outputs.current-version}}-aarch64 --tag coollabsio/coolify:${{steps.package-version.outputs.current-version}} + docker buildx imagetools create coollabsio/coolify:3.12.19 --tag coollabsio/coolify:latest - uses: sarisia/actions-status-discord@v1 if: always() with: diff --git a/others/scripts/bumpLatest.sh b/others/scripts/bumpLatest.sh new file mode 100644 index 000000000..6fbd227e5 --- /dev/null +++ b/others/scripts/bumpLatest.sh @@ -0,0 +1,17 @@ +#!/bin/bash +VERSION=$(cat ./package.json | jq -r .version) +IMAGE=coollabsio/coolify +echo "Pulling $IMAGE:$VERSION" +docker pull $IMAGE:$VERSION + +echo "Tagging $IMAGE:$VERSION as $IMAGE:latest" +docker tag $IMAGE:$VERSION $IMAGE:latest + +echo "Pushing $IMAGE:latest" +read -p "Are you sure you want to push $IMAGE:latest? (y/n) " -n 1 -r +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborting" + exit 1 +fi + +docker push $IMAGE:latest From 08ab7a504a63bb51d1e336a5618c8c94ccf370ce Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 20 Feb 2023 11:54:43 +0100 Subject: [PATCH 2/3] fix: applications cannot be deleted --- .github/workflows/production-release.yml | 2 +- apps/api/src/lib/common.ts | 201 +++++++++--------- .../routes/api/v1/applications/handlers.ts | 12 +- package.json | 2 +- 4 files changed, 107 insertions(+), 110 deletions(-) diff --git a/.github/workflows/production-release.yml b/.github/workflows/production-release.yml index 752e4fbec..0a0ccf089 100644 --- a/.github/workflows/production-release.yml +++ b/.github/workflows/production-release.yml @@ -104,7 +104,7 @@ jobs: - name: Create & publish manifest run: | docker buildx imagetools create --append coollabsio/coolify:${{steps.package-version.outputs.current-version}}-arm64 --append coollabsio/coolify:${{steps.package-version.outputs.current-version}}-aarch64 --tag coollabsio/coolify:${{steps.package-version.outputs.current-version}} - docker buildx imagetools create coollabsio/coolify:3.12.19 --tag coollabsio/coolify:latest + docker buildx imagetools create coollabsio/coolify:${{steps.package-version.outputs.current-version}} --tag coollabsio/coolify:latest - uses: sarisia/actions-status-discord@v1 if: always() with: diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 70776ee6e..90bdfbcb3 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common import { scheduler } from './scheduler'; import type { ExecaChildProcess } from 'execa'; -export const version = '3.12.19'; +export const version = '3.12.20; export const isDev = process.env.NODE_ENV === 'development'; export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT; @@ -517,7 +517,7 @@ export async function createRemoteEngineConfiguration(id: string) { await executeCommand({ command: `ssh-keygen -R ${Host}` }); await executeCommand({ command: `ssh-keygen -R ${remoteIpAddress}` }); await executeCommand({ command: `ssh-keygen -R localhost:${localPort}` }); - } catch (error) {} + } catch (error) { } const found = config.find({ Host }); const foundIp = config.find({ Host: remoteIpAddress }); @@ -822,97 +822,97 @@ export function generatePassword({ type DatabaseConfiguration = | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - MYSQL_DATABASE: string; - MYSQL_PASSWORD: string; - MYSQL_ROOT_USER: string; - MYSQL_USER: string; - MYSQL_ROOT_PASSWORD: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + MYSQL_DATABASE: string; + MYSQL_PASSWORD: string; + MYSQL_ROOT_USER: string; + MYSQL_USER: string; + MYSQL_ROOT_PASSWORD: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - MONGO_INITDB_ROOT_USERNAME?: string; - MONGO_INITDB_ROOT_PASSWORD?: string; - MONGODB_ROOT_USER?: string; - MONGODB_ROOT_PASSWORD?: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + MONGO_INITDB_ROOT_USERNAME?: string; + MONGO_INITDB_ROOT_PASSWORD?: string; + MONGODB_ROOT_USER?: string; + MONGODB_ROOT_PASSWORD?: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - MARIADB_ROOT_USER: string; - MARIADB_ROOT_PASSWORD: string; - MARIADB_USER: string; - MARIADB_PASSWORD: string; - MARIADB_DATABASE: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + MARIADB_ROOT_USER: string; + MARIADB_ROOT_PASSWORD: string; + MARIADB_USER: string; + MARIADB_PASSWORD: string; + MARIADB_DATABASE: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - POSTGRES_PASSWORD?: string; - POSTGRES_USER?: string; - POSTGRES_DB?: string; - POSTGRESQL_POSTGRES_PASSWORD?: string; - POSTGRESQL_USERNAME?: string; - POSTGRESQL_PASSWORD?: string; - POSTGRESQL_DATABASE?: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + POSTGRES_PASSWORD?: string; + POSTGRES_USER?: string; + POSTGRES_DB?: string; + POSTGRESQL_POSTGRES_PASSWORD?: string; + POSTGRESQL_USERNAME?: string; + POSTGRESQL_PASSWORD?: string; + POSTGRESQL_DATABASE?: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - REDIS_AOF_ENABLED: string; - REDIS_PASSWORD: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + REDIS_AOF_ENABLED: string; + REDIS_PASSWORD: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - COUCHDB_PASSWORD: string; - COUCHDB_USER: string; - }; - } + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + COUCHDB_PASSWORD: string; + COUCHDB_USER: string; + }; + } | { - volume: string; - image: string; - command?: string; - ulimits: Record; - privatePort: number; - environmentVariables: { - EDGEDB_SERVER_PASSWORD: string; - EDGEDB_SERVER_USER: string; - EDGEDB_SERVER_DATABASE: string; - EDGEDB_SERVER_TLS_CERT_MODE: string; - }; - }; + volume: string; + image: string; + command?: string; + ulimits: Record; + privatePort: number; + environmentVariables: { + EDGEDB_SERVER_PASSWORD: string; + EDGEDB_SERVER_USER: string; + EDGEDB_SERVER_DATABASE: string; + EDGEDB_SERVER_TLS_CERT_MODE: string; + }; + }; export function generateDatabaseConfiguration(database: any): DatabaseConfiguration { const { id, dbUser, dbUserPassword, rootUser, rootUserPassword, defaultDatabase, version, type } = database; @@ -1011,9 +1011,8 @@ export function generateDatabaseConfiguration(database: any): DatabaseConfigurat }; if (isARM()) { configuration.volume = `${id}-${type}-data:/data`; - configuration.command = `/usr/local/bin/redis-server --appendonly ${ - appendOnly ? 'yes' : 'no' - } --requirepass ${dbUserPassword}`; + configuration.command = `/usr/local/bin/redis-server --appendonly ${appendOnly ? 'yes' : 'no' + } --requirepass ${dbUserPassword}`; } return configuration; } else if (type === 'couchdb') { @@ -1098,12 +1097,12 @@ export type ComposeFileService = { command?: string; ports?: string[]; build?: - | { - context: string; - dockerfile: string; - args?: Record; - } - | string; + | { + context: string; + dockerfile: string; + args?: Record; + } + | string; deploy?: { restart_policy?: { condition?: string; @@ -1174,7 +1173,7 @@ export const createDirectories = async ({ let workdirFound = false; try { workdirFound = !!(await fs.stat(workdir)); - } catch (error) {} + } catch (error) { } if (workdirFound) { await executeCommand({ command: `rm -fr ${workdir}` }); } @@ -1698,7 +1697,7 @@ export async function stopBuild(buildId, applicationId) { } } count++; - } catch (error) {} + } catch (error) { } }, 100); }); } @@ -1721,7 +1720,7 @@ export async function cleanupDockerStorage(dockerId) { // Cleanup images that are not used by any container try { await executeCommand({ dockerId, command: `docker image prune -af` }); - } catch (error) {} + } catch (error) { } // Prune coolify managed containers try { @@ -1729,12 +1728,12 @@ export async function cleanupDockerStorage(dockerId) { dockerId, command: `docker container prune -f --filter "label=coolify.managed=true"` }); - } catch (error) {} + } catch (error) { } // Cleanup build caches try { await executeCommand({ dockerId, command: `docker builder prune -af` }); - } catch (error) {} + } catch (error) { } } export function persistentVolumes(id, persistentStorage, config) { diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.ts index 384cbdfa9..8d8f3ead2 100644 --- a/apps/api/src/routes/api/v1/applications/handlers.ts +++ b/apps/api/src/routes/api/v1/applications/handlers.ts @@ -640,9 +640,8 @@ export async function restartApplication( const volumes = persistentStorage?.map((storage) => { - return `${applicationId}${storage.path.replace(/\//gi, '-')}:${ - buildPack !== 'docker' ? '/app' : '' - }${storage.path}`; + return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : '' + }${storage.path}`; }) || []; const composeVolumes = volumes.map((volume) => { return { @@ -737,7 +736,7 @@ export async function deleteApplication( where: { id }, include: { destinationDocker: true, teams: true } }); - if (teamId === '0' || !application.teams.some((team) => team.id === teamId)) { + if (teamId !== '0' || !application.teams.some((team) => team.id === teamId)) { throw { status: 403, message: 'You are not allowed to delete this application.' }; } if (application?.destinationDocker?.id && application.destinationDocker?.network) { @@ -1428,9 +1427,8 @@ export async function restartPreview( const volumes = persistentStorage?.map((storage) => { - return `${applicationId}${storage.path.replace(/\//gi, '-')}:${ - buildPack !== 'docker' ? '/app' : '' - }${storage.path}`; + return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : '' + }${storage.path}`; }) || []; const composeVolumes = volumes.map((volume) => { return { diff --git a/package.json b/package.json index 682160111..b200d103f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "3.12.19", + "version": "3.12.20", "license": "Apache-2.0", "repository": "github:coollabsio/coolify", "scripts": { From 3c37d22a6e5e6edcb98c51d93545a8fa07640537 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 20 Feb 2023 11:55:08 +0100 Subject: [PATCH 3/3] typo --- apps/api/src/lib/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 90bdfbcb3..26ff479ea 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common import { scheduler } from './scheduler'; import type { ExecaChildProcess } from 'execa'; -export const version = '3.12.20; +export const version = '3.12.20'; export const isDev = process.env.NODE_ENV === 'development'; export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_PORT;