
Summary
Key points of this document
- Where are the design challenges?
- How to define boundaries
- Details that matter in implementation
Overview
For small-scale web applications, it's sometimes better to choose a minimal, operable configuration rather than a complex cloud setup from the start. However, the responsibilities for files and databases should be separated from the beginning. In a small-scale configuration, a minimal setup that can explain what to check and how to recover during a failure is more valuable than an elaborate cloud design.
Where are the design challenges?
For small-scale applications, a common choice is a configuration that bundles Laravel, DB, and files on a single server. While initial costs can be kept low, problems tend to concentrate during disk failures, capacity increases, backups, and migrations.
At stages where usage scale is hard to predict, excessive availability configurations might not be cost-effective. On the other hand, changing file storage locations later can be cumbersome. Even with a minimal configuration, you need to choose the boundaries that should be separated.
When running small-scale Laravel on Lightsail, there's the ease of starting with a single server. However, if uploaded files, DB backups, logs, and certificate renewals are confined to the same server, the options for recovery become limited.
How to define boundaries
Place the Laravel core in a simple execution environment like Lightsail, and put uploaded and generated files in S3. Even if you start with the DB co-located, separate connection settings in anticipation of backups and external DB migration.
In design, separate components that fail differently: app execution on Lightsail, persistent files on S3, DB on easy-to-manage PostgreSQL, and backups stored separately. Even with a minimal configuration, operations become stable when considering recovery units.
Details that matter in implementation
Use S3 in Laravel's Filesystem configuration so that application code is unaware of the actual storage path. Switch DB, queues, mail, and storage using environment variables. Deployment procedures should include migrations, cache clearing, and permission checks.
In Laravel, separate public and private disks, placing user uploads in a private S3 bucket. Manage environment variables, queue workers, schedulers, log rotation, and DB backups with systemd or cron, keeping procedures small and fixed.
- Do not place uploaded files locally on the server to avoid them being affected by redeployments or recoveries.
- Regularly verify that backups can be restored to a different environment, not just that they are taken.
- Implement log rotation and monitoring to prevent logs and application size from overwhelming the disk.
Observe failure modes
During verification, we check restoration from DB backups, S3 file permissions, signed URLs, and recovery time during server recreation. We also check for any files that should not remain on the disk.
During verification, we confirm procedures for app restart, queue stoppage, DB restoration, S3 permission issues, and certificate renewal. Even with a small-scale configuration, performing a recovery drill once reveals single points of failure.
Discarded options and tradeoffs
While Lightsail is straightforward, its managed scaling and monitoring are limited. If there's a possibility of migrating to Cloud Run or ECS in the future, it's good to make logs, environment variables, and file storage easily portable from the start.
While moving to Cloud Run or similar services can lighten some operational load, it increases initial configuration and permission design complexity. Lightsail is straightforward, but you bear the responsibility for server maintenance. For small-scale operations, it's realistic to choose based on who can operate it and the recovery procedures.
Decision criteria to retain on-site
A minimal configuration is not one where nothing is separated. Separating the responsibilities of files, DB, and applications while keeping operational load low is the guiding principle for safely starting small-scale Laravel.
A minimal configuration is not a do-nothing configuration. By starting small and separating files, DB, and backups, you can operate a Laravel application smoothly.


