Merge pull request #1045 from coollabsio/next

v3.12.31
This commit is contained in:
Andras Bacsai
2023-04-19 08:53:20 +02:00
committed by GitHub
13 changed files with 1555 additions and 1325 deletions

View File

@@ -2,9 +2,6 @@ name: 🐞 Bug report
description: Create a bug report to help us improve coolify
title: "[Bug]: "
labels: [Bug]
assignees:
- andrasbacsai
- vasani-arpit
body:
- type: markdown
attributes:

View File

@@ -2,9 +2,6 @@ name: 🛠️ Feature request
description: Suggest an idea to improve coolify
title: '[Feature]: '
labels: [Enhancement]
assignees:
- andrasbacsai
- vasani-arpit
body:
- type: markdown
attributes:

View File

@@ -268,6 +268,13 @@
- DISABLE_REGISTRATION=$$config_disable_registration
- DATABASE_URL=$$secret_database_url
- CLICKHOUSE_DATABASE_URL=$$secret_clickhouse_database_url
- MAILER_EMAIL=$$config_mailer_email
- SMTP_HOST_ADDR=$$config_smtp_host_addr
- SMTP_HOST_PORT=$$config_smtp_host_port
- SMTP_USER_NAME=$$config_smtp_user_name
- SMTP_USER_PWD=$$config_smtp_user_pwd
- SMTP_HOST_SSL_ENABLED=$$config_smtp_host_ssl_enabled
- SMTP_HOST_RETRIES=$$config_smtp_host_retries
ports:
- "8000"
$$id-postgresql:
@@ -375,6 +382,49 @@
label: PostgreSQL Database
defaultValue: plausible
description: ""
- id: $$config_mailer_email
name: MAILER_EMAIL
label: Mailer Email
defaultValue: hello@plausible.local
description: >-
The email id to use for as from address of all communications from Plausible.
- id: $$config_smtp_host_addr
name: SMTP_HOST_ADDR
label: SMTP Host Address
defaultValue: localhost
description: >-
The host address of your smtp server.
- id: $$config_smtp_host_port
name: SMTP_HOST_PORT
label: SMTP Port
defaultValue: "25"
description: >-
The port of your smtp server.
- id: $$config_smtp_user_name
name: SMTP_USER_NAME
label: SMTP Username
defaultValue: ""
description: >-
The username/email in case SMTP auth is enabled.
- id: $$config_smtp_user_pwd
name: SMTP_USER_PWD
label: SMTP Password
defaultValue: ""
description: >-
The password in case SMTP auth is enabled.
showOnConfiguration: true
- id: $$config_smtp_host_ssl_enabled
name: SMTP_HOST_SSL_ENABLED
label: SMTP SSL
defaultValue: "false"
description: >-
If SSL is enabled for SMTP connection.
- id: $$config_smtp_host_retries
name: SMTP_HOST_RETRIES
label: SMTP Retries
defaultValue: "2"
description: >-
Number of retries to make until mailer gives up.
- id: $$config_scriptName
name: SCRIPT_NAME
label: Custom Script Name
@@ -3389,6 +3439,13 @@
- DISABLE_REGISTRATION=$$config_disable_registration
- DATABASE_URL=$$secret_database_url
- CLICKHOUSE_DATABASE_URL=$$secret_clickhouse_database_url
- MAILER_EMAIL=$$config_mailer_email
- SMTP_HOST_ADDR=$$config_smtp_host_addr
- SMTP_HOST_PORT=$$config_smtp_host_port
- SMTP_USER_NAME=$$config_smtp_user_name
- SMTP_USER_PWD=$$config_smtp_user_pwd
- SMTP_HOST_SSL_ENABLED=$$config_smtp_host_ssl_enabled
- SMTP_HOST_RETRIES=$$config_smtp_host_retries
ports:
- "8000"
$$id-postgresql:
@@ -3496,6 +3553,49 @@
label: PostgreSQL Database
defaultValue: plausible
description: ""
- id: $$config_mailer_email
name: MAILER_EMAIL
label: Mailer Email
defaultValue: hello@plausible.local
description: >-
The email id to use for as from address of all communications from Plausible.
- id: $$config_smtp_host_addr
name: SMTP_HOST_ADDR
label: SMTP Host Address
defaultValue: localhost
description: >-
The host address of your smtp server.
- id: $$config_smtp_host_port
name: SMTP_HOST_PORT
label: SMTP Port
defaultValue: "25"
description: >-
The port of your smtp server.
- id: $$config_smtp_user_name
name: SMTP_USER_NAME
label: SMTP Username
defaultValue: ""
description: >-
The username/email in case SMTP auth is enabled.
- id: $$config_smtp_user_pwd
name: SMTP_USER_PWD
label: SMTP Password
defaultValue: ""
description: >-
The password in case SMTP auth is enabled.
showOnConfiguration: true
- id: $$config_smtp_host_ssl_enabled
name: SMTP_HOST_SSL_ENABLED
label: SMTP SSL
defaultValue: "false"
description: >-
If SSL is enabled for SMTP connection.
- id: $$config_smtp_host_retries
name: SMTP_HOST_RETRIES
label: SMTP Retries
defaultValue: "2"
description: >-
Number of retries to make until mailer gives up.
- id: $$config_scriptName
name: SCRIPT_NAME
label: Custom Script Name

View File

@@ -69,7 +69,15 @@ import * as buildpacks from '../lib/buildPacks';
teams: true
}
});
if (!application) {
await prisma.build.update({
where: { id: queueBuild.id },
data: {
status: 'failed'
}
});
throw new Error('Application not found');
}
let {
id: buildId,
type,
@@ -111,7 +119,7 @@ import * as buildpacks from '../lib/buildPacks';
.replace('-app', '')}:${storage.path}`;
}
if (storage.hostPath) {
return `${storage.hostPath}:${storage.path}`
return `${storage.hostPath}:${storage.path}`;
}
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${storage.path}`;
}) || [];
@@ -163,17 +171,24 @@ import * as buildpacks from '../lib/buildPacks';
port: exposePort ? `${exposePort}:${port}` : port
});
try {
const composeVolumes = volumes.filter(v => {
if (!v.startsWith('.') && !v.startsWith('..') && !v.startsWith('/') && !v.startsWith('~')) {
return v;
}
}).map((volume) => {
return {
[`${volume.split(':')[0]}`]: {
name: volume.split(':')[0]
const composeVolumes = volumes
.filter((v) => {
if (
!v.startsWith('.') &&
!v.startsWith('..') &&
!v.startsWith('/') &&
!v.startsWith('~')
) {
return v;
}
};
});
})
.map((volume) => {
return {
[`${volume.split(':')[0]}`]: {
name: volume.split(':')[0]
}
};
});
const composeFile = {
version: '3.8',
services: {
@@ -389,14 +404,14 @@ import * as buildpacks from '../lib/buildPacks';
.replace('-app', '')}:${storage.path}`;
}
if (storage.hostPath) {
return `${storage.hostPath}:${storage.path}`
return `${storage.hostPath}:${storage.path}`;
}
return `${applicationId}${storage.path.replace(/\//gi, '-')}:${storage.path}`;
}) || [];
try {
dockerComposeConfiguration = JSON.parse(dockerComposeConfiguration);
} catch (error) { }
} catch (error) {}
let deployNeeded = true;
let destinationType;
@@ -463,7 +478,7 @@ import * as buildpacks from '../lib/buildPacks';
try {
await prisma.build.update({ where: { id: buildId }, data: { commit } });
} catch (err) { }
} catch (err) {}
if (!pullmergeRequestId) {
if (configHash !== currentHash) {
@@ -504,8 +519,9 @@ import * as buildpacks from '../lib/buildPacks';
try {
await executeCommand({
dockerId: destinationDocker.id,
command: `docker ${location ? `--config ${location}` : ''
} pull ${imageName}:${customTag}`
command: `docker ${
location ? `--config ${location}` : ''
} pull ${imageName}:${customTag}`
});
imageFoundRemotely = true;
} catch (error) {
@@ -668,8 +684,9 @@ import * as buildpacks from '../lib/buildPacks';
try {
const { stdout: containers } = await executeCommand({
dockerId: destinationDockerId,
command: `docker ps -a --filter 'label=com.docker.compose.service=${pullmergeRequestId ? imageId : applicationId
}' --format {{.ID}}`
command: `docker ps -a --filter 'label=com.docker.compose.service=${
pullmergeRequestId ? imageId : applicationId
}' --format {{.ID}}`
});
if (containers) {
const containerArray = containers.split('\n');
@@ -701,17 +718,24 @@ import * as buildpacks from '../lib/buildPacks';
await saveDockerRegistryCredentials({ url, username, password, workdir });
}
try {
const composeVolumes = volumes.filter(v => {
if (!v.startsWith('.') && !v.startsWith('..') && !v.startsWith('/') && !v.startsWith('~')) {
return v;
}
}).map((volume) => {
return {
[`${volume.split(':')[0]}`]: {
name: volume.split(':')[0]
const composeVolumes = volumes
.filter((v) => {
if (
!v.startsWith('.') &&
!v.startsWith('..') &&
!v.startsWith('/') &&
!v.startsWith('~')
) {
return v;
}
};
});
})
.map((volume) => {
return {
[`${volume.split(':')[0]}`]: {
name: volume.split(':')[0]
}
};
});
const composeFile = {
version: '3.8',
services: {

View File

@@ -86,19 +86,20 @@ export async function migrateServicesToNewTemplate() {
if (template.variables) {
if (template.variables.length > 0) {
for (const variable of template.variables) {
const { defaultValue } = variable;
let { defaultValue } = variable;
defaultValue = defaultValue.toString();
const regex = /^\$\$.*\((\d+)\)$/g;
const length = Number(regex.exec(defaultValue)?.[1]) || undefined
if (variable.defaultValue.startsWith('$$generate_password')) {
if (defaultValue.startsWith('$$generate_password')) {
variable.value = generatePassword({ length });
} else if (variable.defaultValue.startsWith('$$generate_hex')) {
} else if (defaultValue.startsWith('$$generate_hex')) {
variable.value = generatePassword({ length, isHex: true });
} else if (variable.defaultValue.startsWith('$$generate_username')) {
} else if (defaultValue.startsWith('$$generate_username')) {
variable.value = cuid();
} else if (variable.defaultValue.startsWith('$$generate_token')) {
} else if (defaultValue.startsWith('$$generate_token')) {
variable.value = generateToken()
} else {
variable.value = variable.defaultValue || '';
variable.value = defaultValue || '';
}
}
}

View File

@@ -22,7 +22,6 @@ export default async function (data) {
});
});
}
Dockerfile.push(`RUN rm -fr .git`);
await fs.writeFile(`${data.workdir}${dockerFileLocation}`, Dockerfile.join('\n'));
await buildImage(data);
}

View File

@@ -19,7 +19,7 @@ import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa';
export const version = '3.12.30';
export const version = '3.12.31';
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;

View File

@@ -412,22 +412,23 @@ export async function saveServiceType(
if (foundTemplate.variables) {
if (foundTemplate.variables.length > 0) {
for (const variable of foundTemplate.variables) {
const { defaultValue } = variable;
let { defaultValue } = variable;
defaultValue = defaultValue.toString();
const regex = /^\$\$.*\((\d+)\)$/g;
const length = Number(regex.exec(defaultValue)?.[1]) || undefined;
if (variable.defaultValue.startsWith('$$generate_password')) {
if (defaultValue.startsWith('$$generate_password')) {
variable.value = generatePassword({ length });
} else if (variable.defaultValue.startsWith('$$generate_hex')) {
} else if (defaultValue.startsWith('$$generate_hex')) {
variable.value = generatePassword({ length, isHex: true });
} else if (variable.defaultValue.startsWith('$$generate_username')) {
} else if (defaultValue.startsWith('$$generate_username')) {
variable.value = cuid();
} else if (variable.defaultValue.startsWith('$$generate_token')) {
} else if (defaultValue.startsWith('$$generate_token')) {
variable.value = generateToken();
} else {
variable.value = variable.defaultValue || '';
variable.value = defaultValue || '';
}
const foundVariableSomewhereElse = foundTemplate.variables.find((v) =>
v.defaultValue.includes(variable.id)
v.defaultValue.toString().includes(variable.id)
);
if (foundVariableSomewhereElse) {
foundVariableSomewhereElse.value = foundVariableSomewhereElse.value.replaceAll(
@@ -746,7 +747,10 @@ export async function saveService(request: FastifyRequest<SaveService>, reply: F
let { id: settingId, name, value, changed = false, isNew = false, variableName } = setting;
if (value) {
if (changed) {
await prisma.serviceSetting.update({ where: { id: settingId }, data: { value: value.replace(/\n/, "\\n") } });
await prisma.serviceSetting.update({
where: { id: settingId },
data: { value: value.replace(/\n/, '\\n') }
});
}
if (isNew) {
if (!variableName) {
@@ -1101,14 +1105,17 @@ export async function activateWordpressFtp(
shell: true
});
}
} catch (error) { }
} catch (error) {}
const volumes = [
`${id}-wordpress-data:/home/${ftpUser}/wordpress`,
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
`${
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
}/${id}.ed25519:/etc/ssh/ssh_host_ed25519_key`,
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
`${
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
}/${id}.rsa:/etc/ssh/ssh_host_rsa_key`,
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
`${
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
}/${id}.sh:/etc/sftp.d/chmod.sh`
];
@@ -1178,6 +1185,6 @@ export async function activateWordpressFtp(
await executeCommand({
command: `rm -fr ${hostkeyDir}/${id}-docker-compose.yml ${hostkeyDir}/${id}.ed25519 ${hostkeyDir}/${id}.ed25519.pub ${hostkeyDir}/${id}.rsa ${hostkeyDir}/${id}.rsa.pub ${hostkeyDir}/${id}.sh`
});
} catch (error) { }
} catch (error) {}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -51,16 +51,22 @@
async function loadLogs() {
if (logsLoading) return;
try {
const newLogs: any = await get(
`/applications/${id}/logs/${selectedService}?since=${lastLog?.split(' ')[0] || 0}`
);
const since = lastLog?.split(' ')[0] || 0;
const newLogs: any = await get(`/applications/${id}/logs/${selectedService}?since=${since}`);
if (newLogs.noContainer) {
noContainer = true;
} else {
noContainer = false;
}
if (newLogs?.logs && newLogs.logs[newLogs.logs.length - 1] !== logs[logs.length - 1]) {
logs = logs.concat(newLogs.logs);
if (since === 0) {
logs = logs.concat(newLogs.logs);
} else {
const newParsedLogs = newLogs.logs.filter((log: any) => {
return log !== logs[logs.length - 1];
});
logs = logs.concat(newParsedLogs);
}
lastLog = newLogs.logs[newLogs.logs.length - 1];
}
} catch (error) {
@@ -135,7 +141,7 @@
{:else}
<div class="relative w-full">
<div class="flex justify-start sticky space-x-2 pb-2">
<button on:click={followBuild} class="btn btn-sm " class:bg-coollabs={followingLogs}>
<button on:click={followBuild} class="btn btn-sm" class:bg-coollabs={followingLogs}>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 mr-2"

View File

@@ -43,6 +43,7 @@
return true;
}
});
let customVersion: string;
$: isDisabled =
!$appSession.isAdmin ||
$status.service.overallStatus === 'degraded' ||
@@ -111,6 +112,7 @@
setLocation(service);
forceSave = false;
$isDeploymentEnabled = checkIfDeploymentEnabledServices(service);
customVersion = null;
return addToast({
message: 'Configuration saved.',
type: 'success'
@@ -196,26 +198,12 @@
async function selectTag(event: any) {
service.version = event.detail.value;
}
async function setCustomVersion() {
service.version = customVersion;
}
onMount(async () => {
if (browser && window.location.hostname === 'demo.coolify.io' && !service.fqdn) {
service.fqdn = `http://${cuid()}.demo.coolify.io`;
// if (service.type === 'wordpress') {
// service.wordpress.mysqlDatabase = 'db';
// }
// if (service.type === 'plausibleanalytics') {
// service.plausibleAnalytics.email = 'noreply@demo.com';
// service.plausibleAnalytics.username = 'admin';
// }
// if (service.type === 'minio') {
// service.minio.apiFqdn = `http://${cuid()}.demo.coolify.io`;
// }
// if (service.type === 'ghost') {
// service.ghost.mariadbDatabase = 'db';
// }
// if (service.type === 'fider') {
// service.fider.emailNoreply = 'noreply@demo.com';
// }
// await handleSubmit();
}
});
</script>
@@ -224,7 +212,7 @@
<form id="saveForm" on:submit|preventDefault={handleSubmit}>
<div class="mx-auto w-full">
<div class="flex flex-row border-b border-coolgray-500 mb-6 space-x-2">
<div class="title font-bold pb-3 ">General</div>
<div class="title font-bold pb-3">General</div>
{#if $appSession.isAdmin}
<button
type="submit"
@@ -289,6 +277,7 @@
</div>
<div class="grid grid-cols-2 items-center">
<label for="version">Version / Tag</label>
<div class="flex gap-2">
{#if tags.tags?.length > 0}
<div class="custom-select-wrapper w-full">
<Select
@@ -303,9 +292,11 @@
isClearable={false}
/>
</div>
{:else}
{:else}
<input class="w-full border-red-500" disabled placeholder="Error getting tags..." />
{/if}
{/if}
<input class="w-full" placeholder="Custom version" on:change={setCustomVersion} bind:value={customVersion} />
</div>
</div>
<div class="grid grid-cols-2 items-center">

View File

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

2592
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff