fix: applications cannot be deleted

This commit is contained in:
Andras Bacsai
2023-02-20 11:54:43 +01:00
parent 06563ef921
commit 08ab7a504a
4 changed files with 107 additions and 110 deletions

View File

@@ -104,7 +104,7 @@ jobs:
- name: Create & publish manifest - name: Create & publish manifest
run: | 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 --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 - uses: sarisia/actions-status-discord@v1
if: always() if: always()
with: with:

View File

@@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common
import { scheduler } from './scheduler'; import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa'; 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 isDev = process.env.NODE_ENV === 'development';
export const proxyPort = process.env.COOLIFY_PROXY_PORT; export const proxyPort = process.env.COOLIFY_PROXY_PORT;
export const proxySecurePort = process.env.COOLIFY_PROXY_SECURE_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 ${Host}` });
await executeCommand({ command: `ssh-keygen -R ${remoteIpAddress}` }); await executeCommand({ command: `ssh-keygen -R ${remoteIpAddress}` });
await executeCommand({ command: `ssh-keygen -R localhost:${localPort}` }); await executeCommand({ command: `ssh-keygen -R localhost:${localPort}` });
} catch (error) {} } catch (error) { }
const found = config.find({ Host }); const found = config.find({ Host });
const foundIp = config.find({ Host: remoteIpAddress }); const foundIp = config.find({ Host: remoteIpAddress });
@@ -1011,8 +1011,7 @@ export function generateDatabaseConfiguration(database: any): DatabaseConfigurat
}; };
if (isARM()) { if (isARM()) {
configuration.volume = `${id}-${type}-data:/data`; configuration.volume = `${id}-${type}-data:/data`;
configuration.command = `/usr/local/bin/redis-server --appendonly ${ configuration.command = `/usr/local/bin/redis-server --appendonly ${appendOnly ? 'yes' : 'no'
appendOnly ? 'yes' : 'no'
} --requirepass ${dbUserPassword}`; } --requirepass ${dbUserPassword}`;
} }
return configuration; return configuration;
@@ -1174,7 +1173,7 @@ export const createDirectories = async ({
let workdirFound = false; let workdirFound = false;
try { try {
workdirFound = !!(await fs.stat(workdir)); workdirFound = !!(await fs.stat(workdir));
} catch (error) {} } catch (error) { }
if (workdirFound) { if (workdirFound) {
await executeCommand({ command: `rm -fr ${workdir}` }); await executeCommand({ command: `rm -fr ${workdir}` });
} }
@@ -1698,7 +1697,7 @@ export async function stopBuild(buildId, applicationId) {
} }
} }
count++; count++;
} catch (error) {} } catch (error) { }
}, 100); }, 100);
}); });
} }
@@ -1721,7 +1720,7 @@ export async function cleanupDockerStorage(dockerId) {
// Cleanup images that are not used by any container // Cleanup images that are not used by any container
try { try {
await executeCommand({ dockerId, command: `docker image prune -af` }); await executeCommand({ dockerId, command: `docker image prune -af` });
} catch (error) {} } catch (error) { }
// Prune coolify managed containers // Prune coolify managed containers
try { try {
@@ -1729,12 +1728,12 @@ export async function cleanupDockerStorage(dockerId) {
dockerId, dockerId,
command: `docker container prune -f --filter "label=coolify.managed=true"` command: `docker container prune -f --filter "label=coolify.managed=true"`
}); });
} catch (error) {} } catch (error) { }
// Cleanup build caches // Cleanup build caches
try { try {
await executeCommand({ dockerId, command: `docker builder prune -af` }); await executeCommand({ dockerId, command: `docker builder prune -af` });
} catch (error) {} } catch (error) { }
} }
export function persistentVolumes(id, persistentStorage, config) { export function persistentVolumes(id, persistentStorage, config) {

View File

@@ -640,8 +640,7 @@ export async function restartApplication(
const volumes = const volumes =
persistentStorage?.map((storage) => { persistentStorage?.map((storage) => {
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${ return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : ''
buildPack !== 'docker' ? '/app' : ''
}${storage.path}`; }${storage.path}`;
}) || []; }) || [];
const composeVolumes = volumes.map((volume) => { const composeVolumes = volumes.map((volume) => {
@@ -737,7 +736,7 @@ export async function deleteApplication(
where: { id }, where: { id },
include: { destinationDocker: true, teams: true } 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.' }; throw { status: 403, message: 'You are not allowed to delete this application.' };
} }
if (application?.destinationDocker?.id && application.destinationDocker?.network) { if (application?.destinationDocker?.id && application.destinationDocker?.network) {
@@ -1428,8 +1427,7 @@ export async function restartPreview(
const volumes = const volumes =
persistentStorage?.map((storage) => { persistentStorage?.map((storage) => {
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${ return `${applicationId}${storage.path.replace(/\//gi, '-')}:${buildPack !== 'docker' ? '/app' : ''
buildPack !== 'docker' ? '/app' : ''
}${storage.path}`; }${storage.path}`;
}) || []; }) || [];
const composeVolumes = volumes.map((volume) => { const composeVolumes = volumes.map((volume) => {

View File

@@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.12.19", "version": "3.12.20",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "github:coollabsio/coolify", "repository": "github:coollabsio/coolify",
"scripts": { "scripts": {