# Set up Shipslip for a Laravel project
This guide is for a teammate making a first staging deploy. Shipslip runs on
your macOS or Linux computer and connects to a Linux server over SSH. Start
with staging; configure production separately after the staging flow works.
## 1. Get access and install Shipslip
You need a local Git checkout of the Laravel project, SSH access to its
staging server, and permission for the server to fetch the project's Git
repository. The server must already have the project checked out, in one
directory updated in place (not `releases/` folders with a `current`
symlink).
On the server:
- `bash` is installed.
- You SSH in as the user who owns the app directory and can run
`php artisan` there.
- Laravel writes its log to a file under `storage/logs` that this user can
read.
On your computer, you need macOS or Linux with Git, OpenSSH, `bash`, and
`curl`. Windows is not supported yet. Install the Shipslip CLI:
```sh
Open a new terminal, then check the install:
```sh
slip --version
```
The installer puts `slip` in `~/.local/bin` and adds that directory to your
`PATH` in your shell's startup files. If a new terminal still cannot find
`slip`, add `~/.local/bin` to your `PATH` yourself. Run the installer again to
upgrade.
If you have Rust 1.88 or newer, you can install from
[crates.io](https://crates.io/crates/shipslip) instead with
`cargo install shipslip --locked` (add `--force` to upgrade). To try
unreleased changes, install from the
[source repository](https://github.com/impruthvi/shipslip):
`cargo install --git https://github.com/impruthvi/shipslip.git --branch main --locked --bin slip`.
## 2. Configure SSH
Add an alias to `~/.ssh/config`, using the staging server's real host, user,
and your own private key path:
```sshconfig
Host my-app-staging
HostName staging.example.com
User deploy
IdentityFile ~/.ssh/id_ed25519
```
Check the connection with `ssh my-app-staging`. Verify the server's host key
before accepting it. Shipslip uses strict host key checking, so the host must
be in your `known_hosts` file. Keep your private key out of Git and out of
messages to teammates.
The server's deploy user needs permission to run the recipe commands and read
Laravel's log. Its Git checkout must be clean and on the configured branch.
For GitHub access, either configure the server to `git fetch origin` without
an interactive prompt, or use a local token as described below.
Recipe commands use the server's permission mask. Choose ownership, group
access, and a mask that let PHP-FPM read the files Composer and Artisan create.
Shipslip 0.2.0 fixes earlier versions imposing `077` on recipe commands; the
upgrade does not repair existing file permissions. If an earlier deploy left
unreadable files, review access to `vendor`, `bootstrap/cache`, and
`storage/framework`, then regenerate Laravel's caches with your recipe.
## 3. Add the project config
From the **Laravel project's Git checkout**, run:
```sh
slip init
```
It asks a few questions and writes `.shipslip.toml` at the Git root, with the
default Laravel recipe written out so you can edit it. Review the file before
the first deploy: the recipe includes `php artisan migrate --force`.
To write the file by hand instead, create `.shipslip.toml` in the **Laravel
project's Git root**. Replace every example value below. Use the exact deploy
steps that are safe for this app; the example includes a database migration.
```toml
[project]
name = "my-app"
stack = "laravel"
[env.staging]
ssh = "my-app-staging"
path = "/srv/my-app"
branch = "main"
production = false
maintenance = true
smoke_url = "https://staging.example.com/health"
[recipe.deploy]
steps = [
"composer install --no-interaction --no-dev --prefer-dist",
"php artisan migrate --force",
"php artisan config:cache",
]
```
`ssh` names the alias from step 2. `path` is the absolute path of the Git
checkout on the server. `maintenance = true` takes the app down before the
steps and brings it up after they succeed. If a step fails, the app stays
down until you recover it; use `false` if that is not your deploy procedure.
`smoke_url` is optional and must be reachable from **your computer**. Shipslip
considers an HTTP 2xx response a pass.
Shipslip watches `storage/logs/laravel.log` by default. Set `log` to a
different path if your app uses one. For Laravel daily logs, set
`log_daily = true`; its default prefix is `storage/logs/laravel`, which follows
the newest `laravel-*.log`. If you omit `[recipe.deploy]`, Shipslip uses its
default Laravel recipe; review that recipe before deploying.
You can commit `.shipslip.toml` so teammates share the same deploy settings.
Each teammate can map the same SSH alias to their own key locally.
## 4. Review and deploy staging
Push the intended app commit to the branch named in `.shipslip.toml`. From
anywhere inside your **local Laravel project checkout**, run:
```sh
slip trust staging
slip deploy staging
```
If the server has no GitHub credentials, use:
```sh
slip deploy staging --github-token
```
Paste a GitHub personal access token at the hidden prompt. Shipslip shows its
actual account username and the server's `OWNER/REPO` before asking you to use
it. Enter `r` to replace a token from the wrong account, or cancel. This works
without a GitHub CLI login and does not silently use your personal `gh` account.
The prompt includes token-creation guidance: select the repository with
Contents: Read-only and an expiry; your organization may require approval or
SSO authorization. Repository visibility is checked locally; the server fetch
verifies read access before showing the normal deployment preview.
To use existing local credentials explicitly, choose `--github-token-source
env` (`GH_TOKEN`, then `GITHUB_TOKEN`) or `--github-token-source gh` (the active
github.com GitHub CLI login). Both still show the actual account and require
confirmation. Token authentication also works with `rerun` and `from-step`.
This flow requires local `curl` and a standard github.com HTTPS or SSH origin.
The token reaches the trusted server briefly in memory over SSH and is not
saved by Shipslip. The saved Git remote remains unchanged; receipts and
detached scripts do not contain credentials. The token is used only for the
application repository's fetch. Configure private Composer dependencies and
submodules separately. See the [README](../README.md#use-a-local-github-token)
for source selection and supported remotes.
`trust` shows the config and asks you to approve it. `deploy` fetches the
configured branch on the server, previews the exact commits and steps, and
asks for confirmation before making changes. Read that preview. If you change
the config later, run `slip trust staging` again before deploying.
Leave the terminal open for the deploy and the 120-second log watch; Shipslip
prints the time left every 30 seconds, and Ctrl-C ends the watch early. Check
the final deploy outcome, the `Log watch` line, and (if configured) the smoke
check's HTTP result. `complete` means Shipslip observed the log; `no log file
found`, `log could not be read`, or `partial` means you should inspect the log
path, permissions, or format. A failed smoke check is recorded separately and does not roll back
the deploy.
Shipslip saves a receipt on your computer. On macOS, look under
`~/Library/Application Support/Shipslip/receipts/`; on Linux, under
`~/.local/share/shipslip/receipts/`. Receipts can contain command output and
should be treated as private.
## 5. Read logs
From the same local project checkout, inspect logs without deploying:
```sh
slip logs staging
slip logs staging --since 7d
slip logs staging --channels
slip logs staging --raw --grep payment
```
The command discovers `storage/logs/*.log` channels and also reads configured
`log` / `log_daily` paths. Single and daily files with the same channel name
merge. It shows grouped errors since the latest verified run by default,
falling back to the latest checkout change or 24 hours. Use `--since` to choose
a window. `NEW` means absent from the bounded comparison before that window;
`?` means no usable baseline. The header discloses that coverage. Copy a group
ID into `slip logs staging ID` to see its latest stack trace.
Set `timezone` in `[env.staging]` to Laravel's log timezone, for example
`timezone = "Asia/Kolkata"`; it defaults to UTC. The server must have Linux
`/proc`, bash, GNU coreutils, gzip and tzdata installed.
Check coverage warnings: `≥` means only part of the window was read. Use
`--channels` to inspect each channel's files, format and coverage. The default
window read limits are 4 MiB per channel and 12 MiB total, shared fairly.
A separate comparison budget allows 2 MiB per channel and 6 MiB total.
`--channels` shows both coverages.
`--max-bytes 20m` changes the window limits. Mixed or unsupported formats stay
visible through `--raw`, where their file blocks bypass timestamp and level
filtering. Configure `hide`, `rename` or `path` under
`[env.staging.logs.CHANNEL]` to override discovery (see the README). Files outside
`storage/logs` require config approval through `slip trust staging`.
Reading logs runs no deploy steps and writes no receipts or signature history.
Deploys record the run anchor in `<git dir>/shipslip.last-run`; failures to write
it are warnings, and deployment and lock release continue.
Log output can contain secrets.
## If the command is interrupted
Ctrl-C at the confirmation prompt cancels cleanly. During the steps, it stops
following the running command, which keeps running on the server. To resume,
from the **same local project checkout**, run:
```sh
slip attach staging
```
This resumes observation of an unfinished run without relaunching its active
server command. Use `slip rerun staging` only when the server is already on
the intended clean commit and repeating every recipe step is safe.
If `attach` cannot resolve an unknown outcome and the lock has gone stale,
connect with `ssh my-app-staging` and check that no command from the old run is
still running. After that, run `slip break-lock staging` to clear the stale
lock. If the app may still be in maintenance mode, run `slip up staging` to
bring it back. Both commands require the trusted project config and ask for
confirmation; `up` takes a new deploy lock.