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 an access key for your IAM user โ step 3's
yolo configureturns it into a named profile with short-lived sessions. (Already have a named profile in~/.aws/config? That works too โ just don't use thedefaultprofile.) - For a web app: a domain you can manage in Route 53 on that account โ a web task requires one. (A worker app โ a standalone queue/scheduler with no web task โ needs no domain.)
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 the environment you named (e.g.production) from your answers (app name, AWS account ID, region, domain).Dockerfileand.dockerignoreโ sensible defaults you can customise. See The Container Image..env.<environment>โ a starter environment file (offered, default yes): your.env.examplewithAPP_ENV,APP_DEBUG,APP_URL, and a freshly generatedAPP_KEYcorrected for the environment.- It appends
.yoloand your environment's.envfile (plus.env.staging/.env.production) to your.gitignore, and offers to runyolo configureat the end to set up this machine's credentials (step 3).
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. If you accepted the configure offer at the end of init, this is already done โ skip to step 4. Otherwise run it now โ profile, short-lived-session credential helper, and the .env wiring in one interactive run:
yolo configure productionIt ends with a live STS verification, so when it goes green this machine is provably ready. See yolo configure for each step, and Developer Credentials for the full team-onboarding picture (IAM users, access tiers, MFA).
Already have a named profile? Point YOLO at it in your local .env instead:
# .env
YOLO_PRODUCTION_AWS_PROFILE=myapp-productionThe pattern is YOLO_<ENVIRONMENT>_AWS_PROFILE. Either way, 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. 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. On a fresh environment the very first sync needs the bootstrap flag:
yolo sync production --dangerously-skip-permissionsWhy the flag?
Normally sync caps itself to the admin tier by assuming a YOLO-provisioned role โ but on the first run that role doesn't exist yet (creating it is part of what this sync does), and the tier guard fails closed rather than silently falling back to your full identity. The flag runs this one sync uncapped to break the loop; every sync after it is capped as usual: just yolo sync production.
YOLO always shows the plan before it touches anything โ a diff grouped by scope (account โ environment โ app) of exactly what would be created or changed โ then asks you to confirm. So to preview, just run it and read the plan; decline (or Ctrl-C) if it's not what you expected, confirm when it looks right. 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.
5. Push your environment file โ
Your application's runtime .env lives in S3, not in the image source โ in the app config bucket the sync you just ran created. 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.
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"(ECS Exec is on by default โ enable-execute-command defaults to true โ so this just needs the Session Manager plugin installed locally. 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
