Getting Started
This guide takes you from an empty Laravel app to a live deployment on AWS Fargate. With an AWS account ready, it takes under an hour — most of which is AWS provisioning your infrastructure while you wait.
You don't need prior YOLO knowledge. Each step links to a deeper page if you want the detail, but you can follow this straight through.
Prerequisites
- PHP 8.3+ and Composer
- Docker, running locally — YOLO builds your container image on your machine
- An AWS account and a named AWS profile configured on your machine (in
~/.aws/config/~/.aws/credentials). Don't use thedefaultprofile — give it a specific name likemyapp-production. - For a public app: a domain you can manage in Route 53 on that account. (You can skip this and run a headless app with no public URL.)
The whole thing in one line
Once you've done the setup below, day-to-day it's just:
yolo sync production && yolo deploy production1. Install
From your Laravel project root:
composer require codinglabsau/yoloThe CLI is now at vendor/bin/yolo. Run it with no arguments to list every command:
vendor/bin/yoloTIP
Add ./vendor/bin to your PATH and you can type yolo instead of vendor/bin/yolo. The rest of these docs use the short form.
2. Initialise
yolo initThis interactive command scaffolds everything you need:
yolo.yml— your manifest, pre-filled with aproductionenvironment from your answers (app name, AWS account ID, region, domain).Dockerfileand.dockerignore— sensible defaults you can customise. See The Container Image..env.production— a starter environment file.- It appends
.yolo,.env.staging, and.env.productionto your.gitignore, and offers to install the AWS Session Manager plugin (needed later foryolo run).
Open yolo.yml and skim it — it's short and commented. You can tweak it now or come back later. The full key reference is in the Manifest reference.
3. Point YOLO at AWS
YOLO authenticates to AWS using a named profile per environment, set in your local .env file:
# .env
YOLO_PRODUCTION_AWS_PROFILE=myapp-productionThe pattern is YOLO_<ENVIRONMENT>_AWS_PROFILE. Before YOLO touches AWS it calls STS to confirm the profile resolves to the same account ID you declared in yolo.yml — so a wrong profile fails fast instead of provisioning into the wrong account.
WARNING
Don't point this at your default profile. YOLO rejects it deliberately — a named profile makes "which account am I about to change?" unambiguous.
4. Push your environment file
Your application's runtime .env lives in S3, not in the image source. Fill in .env.production (database, cache, mail, etc.), then push it:
yolo env:push productionYOLO shows a diff of what's changing and asks for confirmation before uploading. This .env.production is baked into the image at build time. More in Environment Files.
5. Provision your infrastructure
This is the big one — yolo sync creates the VPC, load balancer, ECS cluster, IAM roles, S3 buckets, certificate, and DNS for your app. Preview it first with --dry-run:
yolo sync production --dry-runYou'll see a plan grouped by scope (account → environment → app) showing exactly what would be created or changed. Nothing is touched. When it looks right, run it for real:
yolo sync productionYOLO shows the same plan, asks you to confirm, then applies it. The first sync provisions a fair amount and can take several minutes (ACM certificate validation and load balancer provisioning are the slow parts). It's safe to re-run any time — a second sync on an unchanged manifest reports "already in sync" and does nothing.
See Provisioning for what each scope creates and how the plan/confirm/apply flow works.
6. Deploy
yolo deploy productiondeploy builds your container image, pushes it to ECR, registers a new task definition, runs your deploy hooks (e.g. php artisan migrate), rolls the ECS service over to the new version, and waits for it to go healthy before pointing DNS at it. If the new version fails its health checks, the deployment circuit breaker rolls it back automatically.
When it finishes, your app is live. 🐥
7. Visit your app
Once Route 53 has propagated, open your domain in a browser. Need a shell inside the running container?
yolo run production # interactive shell
yolo run production --command="php artisan tinker"(Requires enable-execute-command: true in your manifest and the Session Manager plugin — see yolo run.)
Where to next
You now have the full loop: sync infrastructure, deploy code. From here:
- The Container Image — what's in the Dockerfile and what YOLO generates
- Environment Files — managing
.envacross environments - Provisioning — the scope model and
syncin depth - Building & Deploying — the build/deploy pipeline and
yolo run - Domains · Multi-Tenancy · CI/CD
- Command reference · Manifest reference
