Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

WIP Persistent storage

Andras Bacsaic013764b61e6
diff --git a/package.json b/package.json
index 3e849fa1f3..fbd8c3720a 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"version": "2.0.31",
"license": "AGPL-3.0",
"scripts": {
- "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
+ "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev",
"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",
diff --git a/src/lib/buildPacks/common.ts b/src/lib/buildPacks/common.ts
index 1d2fef25f3..b1c02867bf 100644
--- a/src/lib/buildPacks/common.ts
+++ b/src/lib/buildPacks/common.ts
@@ -135,6 +135,7 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap
RewriteRule ^(.+)$ index.php [QSA,L]
`
);
+ await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R www-data /app`);
saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId });
} else if (staticDeployments.includes(buildPack)) {
await fs.writeFile(
diff --git a/src/lib/buildPacks/php.ts b/src/lib/buildPacks/php.ts
index 4903213c66..8b9617845a 100644
--- a/src/lib/buildPacks/php.ts
+++ b/src/lib/buildPacks/php.ts
@@ -13,19 +13,21 @@ const createDockerfile = async (data, image): Promise<void> => {
Dockerfile.push(`RUN chmod +x /usr/local/bin/install-php-extensions`);
Dockerfile.push(`RUN /usr/local/bin/install-php-extensions ${data.phpModules.join(' ')}`);
}
- Dockerfile.push('RUN a2enmod rewrite');
- Dockerfile.push('WORKDIR /var/www/html');
- Dockerfile.push(`COPY .${baseDirectory || ''} /var/www/html`);
- Dockerfile.push(`COPY /.htaccess /var/www/html/.htaccess`);
+ // Dockerfile.push('RUN a2enmod rewrite');
+ // Dockerfile.push(`ENV APACHE_DOCUMENT_ROOT /app`);
+ // Dockerfile.push(`RUN sed -ri -e 's!/var/www/html!/app!g' /etc/apache2/sites-available/*.conf`);
+ // Dockerfile.push(`RUN sed -ri -e 's!/var/www/!/app!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf`)
+ Dockerfile.push('WORKDIR /app');
+ Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
+ Dockerfile.push(`COPY /.htaccess .`);
+ Dockerfile.push(`COPY /entrypoint.sh /entrypoint.sh`);
Dockerfile.push(`EXPOSE 80`);
- Dockerfile.push('CMD ["apache2-foreground"]');
- Dockerfile.push('RUN chown -R www-data /var/www/html');
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
};
export default async function (data) {
try {
- const image = 'php:apache';
+ const image = 'webdevops/php-nginx';
await createDockerfile(data, image);
await buildImage(data);
} catch (error) {
diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts
index cad82bfe0e..18985a5fb4 100644
--- a/src/lib/queues/builder.ts
+++ b/src/lib/queues/builder.ts
@@ -272,7 +272,7 @@ export default async function (job) {
`DOCKER_HOST=${host} docker run ${envFound && `--env-file=${workdir}/.env`} ${labels.join(
' '
)} --name ${imageId} --network ${docker.network} --restart always ${
- volumes.length > 0 && volumes
+ volumes.length > 0 ? volumes : ''
} -d ${applicationId}:${tag}`
);
if (stderr) console.log(stderr);