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 Bacsaia6d5316090e0
diff --git a/src/lib/buildPacks/common.ts b/src/lib/buildPacks/common.ts
index 9ded4e0f95..3214f7adf1 100644
--- a/src/lib/buildPacks/common.ts
+++ b/src/lib/buildPacks/common.ts
@@ -135,7 +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`);
+ await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /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 0db2dd0638..3ac7b46700 100644
--- a/src/lib/buildPacks/php.ts
+++ b/src/lib/buildPacks/php.ts
@@ -16,7 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {
Dockerfile.push('WORKDIR /app');
Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
Dockerfile.push(`COPY /.htaccess .`);
- Dockerfile.push(`COPY /entrypoint.sh /entrypoint.sh`);
+ 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'));
};
diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts
index 1cbef0f85c..4a34718c58 100644
--- a/src/lib/queues/builder.ts
+++ b/src/lib/queues/builder.ts
@@ -70,7 +70,9 @@ export default async function (job) {
let volumes =
persistentStorage?.map((storage) => {
- return `${applicationId}-${storage.id}:${type !== 'docker' ? '/app/' : ''}${storage.path}`;
+ return `${applicationId}${storage.path.replace(/\//gi, '-')}:${
+ type !== 'docker' ? '/app/' : ''
+ }${storage.path}`;
}) || [];
// Previews, we need to get the source branch and set subdomain
if (pullmergeRequestId) {
diff --git a/src/routes/applications/[id]/storage/_Storage.svelte b/src/routes/applications/[id]/storage/_Storage.svelte
index d9bdc9ebe4..3fa86ef21a 100644
--- a/src/routes/applications/[id]/storage/_Storage.svelte
+++ b/src/routes/applications/[id]/storage/_Storage.svelte
@@ -11,6 +11,9 @@
async function saveStorage() {
try {
+ storage.path = storage.path.startsWith('/') ? storage.path : `/${storage.path}`;
+ storage.path = storage.path.endsWith('/') ? storage.path.slice(0, -1) : storage.path;
+ storage.path.replace(/\/\//g, '/');
await post(`/applications/${id}/storage.json`, {
path: storage.path
});