WIP - Persistent storage

This commit is contained in:
Andras Bacsai 2022-03-21 21:46:49 +01:00
parent f5e7a84fa6
commit a6d5316090
4 changed files with 8 additions and 3 deletions

View File

@ -135,7 +135,7 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap
RewriteRule ^(.+)$ index.php [QSA,L] 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 }); saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId });
} else if (staticDeployments.includes(buildPack)) { } else if (staticDeployments.includes(buildPack)) {
await fs.writeFile( await fs.writeFile(

View File

@ -16,7 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {
Dockerfile.push('WORKDIR /app'); Dockerfile.push('WORKDIR /app');
Dockerfile.push(`COPY .${baseDirectory || ''} /app`); Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
Dockerfile.push(`COPY /.htaccess .`); 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`); Dockerfile.push(`EXPOSE 80`);
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n')); await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
}; };

View File

@ -70,7 +70,9 @@ export default async function (job) {
let volumes = let volumes =
persistentStorage?.map((storage) => { 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 // Previews, we need to get the source branch and set subdomain
if (pullmergeRequestId) { if (pullmergeRequestId) {

View File

@ -11,6 +11,9 @@
async function saveStorage() { async function saveStorage() {
try { 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`, { await post(`/applications/${id}/storage.json`, {
path: storage.path path: storage.path
}); });