From 9790d2b613fcd09157ef05ec4fa8e972b81383a4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 4 Apr 2022 18:47:22 +0200 Subject: [PATCH 1/3] fix(php): If .htaccess file found use apache --- src/lib/buildPacks/common.ts | 11 ----------- src/lib/buildPacks/php.ts | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/lib/buildPacks/common.ts b/src/lib/buildPacks/common.ts index 62b7840ce..65f4d6903 100644 --- a/src/lib/buildPacks/common.ts +++ b/src/lib/buildPacks/common.ts @@ -124,18 +124,7 @@ export const setDefaultConfiguration = async (data) => { export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, applicationId) { try { - // TODO: Write full .dockerignore for all deployments!! if (buildPack === 'php') { - await fs.writeFile( - `${workdir}/.htaccess`, - ` - RewriteEngine On - RewriteBase / - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.+)$ index.php [QSA,L] - ` - ); await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`); await saveBuildLog({ line: 'Copied default configuration file for PHP.', diff --git a/src/lib/buildPacks/php.ts b/src/lib/buildPacks/php.ts index abec33b3d..14ee5d0cb 100644 --- a/src/lib/buildPacks/php.ts +++ b/src/lib/buildPacks/php.ts @@ -1,23 +1,33 @@ import { buildImage } from '$lib/docker'; import { promises as fs } from 'fs'; -const createDockerfile = async (data, image): Promise => { +const createDockerfile = async (data, image, htaccessFound): Promise => { const { workdir, baseDirectory } = data; const Dockerfile: Array = []; Dockerfile.push(`FROM ${image}`); Dockerfile.push(`LABEL coolify.image=true`); Dockerfile.push('WORKDIR /app'); Dockerfile.push(`COPY .${baseDirectory || ''} /app`); - Dockerfile.push(`COPY /.htaccess .`); + if (htaccessFound) { + Dockerfile.push(`COPY .${baseDirectory || ''}/.htaccess ./`); + } Dockerfile.push(`COPY /entrypoint.sh /opt/docker/provision/entrypoint.d/30-entrypoint.sh`); Dockerfile.push(`EXPOSE 80`); await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n')); }; export default async function (data) { + const { workdir, baseDirectory } = data; try { - const image = 'webdevops/php-nginx'; - await createDockerfile(data, image); + let htaccessFound = false; + try { + const d = await fs.readFile(`${workdir}${baseDirectory || ''}/.htaccess`); + htaccessFound = true; + } catch (e) { + // + } + const image = htaccessFound ? 'webdevops/php-apache' : 'webdevops/php-nginx'; + await createDockerfile(data, image, htaccessFound); await buildImage(data); } catch (error) { throw error; From fcf206a0817d535a21a7d134ed3645401a34409a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 4 Apr 2022 19:18:06 +0200 Subject: [PATCH 2/3] fix: Add default webhook domain for n8n --- src/routes/services/[id]/n8n/start.json.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/services/[id]/n8n/start.json.ts b/src/routes/services/[id]/n8n/start.json.ts index 4a04917c7..e5ad7e930 100644 --- a/src/routes/services/[id]/n8n/start.json.ts +++ b/src/routes/services/[id]/n8n/start.json.ts @@ -24,7 +24,9 @@ export const post: RequestHandler = async (event) => { const config = { image: `${image}:${version}`, volume: `${id}-n8n:/root/.n8n`, - environmentVariables: {} + environmentVariables: { + WEBHOOK_URL: `${service.fqdn}` + } }; if (serviceSecret.length > 0) { serviceSecret.forEach((secret) => { From f5dfaa81d3b5b8a2472b97fcf812bdfd641be19a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 4 Apr 2022 19:35:17 +0200 Subject: [PATCH 3/3] chore:version++ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 427c93281..1d9ccbdb7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "2.3.1", + "version": "2.3.2", "license": "AGPL-3.0", "scripts": { "dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev",