Skip to content

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 the default profile — give it a specific name like myapp-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:

bash
yolo sync production && yolo deploy production

1. Install

From your Laravel project root:

bash
composer require codinglabsau/yolo

The CLI is now at vendor/bin/yolo. Run it with no arguments to list every command:

bash
vendor/bin/yolo

TIP

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

bash
yolo init

This interactive command scaffolds everything you need:

  • yolo.yml — your manifest, pre-filled with a production environment from your answers (app name, AWS account ID, region, domain).
  • Dockerfile and .dockerignore — sensible defaults you can customise. See The Container Image.
  • .env.production — a starter environment file.
  • It appends .yolo, .env.staging, and .env.production to your .gitignore, and offers to install the AWS Session Manager plugin (needed later for yolo 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:

bash
# .env
YOLO_PRODUCTION_AWS_PROFILE=myapp-production

The 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:

bash
yolo env:push production

YOLO 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:

bash
yolo sync production --dry-run

You'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:

bash
yolo sync production

YOLO 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

bash
yolo deploy production

deploy 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?

bash
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:

Released under the MIT License.