Improve Laravel deploy support and add .env import to deploy wizard.
Set Laravel DB env vars in Helm and Kubernetes, fix default port to 80 with a storage-aware entrypoint, and let users upload a .env file during deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -997,7 +997,7 @@ CMD ["sh", "-c", "if [ \\"$(cat /app/.mode)\\" = \\"standalone\\" ] && [ -f serv
|
||||
|
||||
private laravelDockerfile(app: Application): string {
|
||||
const phpVersion = app.phpVersion || '8.3';
|
||||
const port = app.port || 8000;
|
||||
const port = app.port || 80;
|
||||
return `# --- Build stage ---
|
||||
FROM composer:2 AS composer
|
||||
WORKDIR /app
|
||||
@@ -1066,8 +1066,16 @@ RUN mkdir -p storage/logs storage/framework/cache storage/framework/sessions sto
|
||||
RUN php artisan config:cache && php artisan route:cache && php artisan view:cache || true
|
||||
RUN php artisan storage:link || true
|
||||
|
||||
RUN echo '#!/bin/sh' > /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
echo 'set -e' >> /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
echo 'cd /var/www/html' >> /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
echo 'mkdir -p storage/logs storage/framework/cache storage/framework/sessions storage/framework/views' >> /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
echo 'chown -R www-data:www-data storage' >> /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
echo 'exec /usr/bin/supervisord -c /etc/supervisord.conf' >> /usr/local/bin/cloudhost-laravel-entrypoint.sh && \\
|
||||
chmod +x /usr/local/bin/cloudhost-laravel-entrypoint.sh
|
||||
|
||||
EXPOSE ${port}
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
CMD ["/usr/local/bin/cloudhost-laravel-entrypoint.sh"]
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,6 +431,16 @@ export class KubernetesService implements OnModuleInit {
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
(ctx.runtime === AppRuntime.LARAVEL || ctx.runtime === AppRuntime.PHP) &&
|
||||
ctx.databaseType !== DatabaseType.NONE
|
||||
) {
|
||||
extraEnv.push(
|
||||
{ name: 'DB_DATABASE', value: ctx.appName.replace(/-/g, '_') },
|
||||
{ name: 'DB_USERNAME', valueFrom: { secretKeyRef: { name: `${ctx.appName}-db-secret`, key: 'username' } } },
|
||||
);
|
||||
}
|
||||
|
||||
// Redis connection env vars
|
||||
if (ctx.enableRedis) {
|
||||
const redisName = `${ctx.appName}-redis`;
|
||||
|
||||
Reference in New Issue
Block a user