Skip to content

Commit ebb35db

Browse files
Docs: keep changes out of the clone (#389)
* Docs: explain how to keep changes out of the clone Add an optional README section for running a stack from a copy of its service directory, or from a compose.override.yaml, so git pull no longer collides with local changes. Refs #317. * Docs: compare .env too when running a stack from a copy --------- Co-authored-by: Bart <57799908+crypt0rr@users.noreply.github.com>
1 parent 6411492 commit ebb35db

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ScaleTail is a collection of ready-to-run [Docker Compose](https://docs.docker.c
2222
- [Utilities](#utilities)
2323
- [Food and wellness](#food-and-wellness)
2424
- [Update a stack](#update-a-stack)
25+
- [Keep your changes out of the clone](#keep-your-changes-out-of-the-clone)
2526
- [Remove a stack](#remove-a-stack)
2627
- [Get help](#get-help)
2728
- [Tailscale Serve and Funnel](#tailscale-serve-and-funnel)
@@ -286,6 +287,47 @@ If `git stash pop` reports a conflict in `.env`, open the file, keep your values
286287

287288
Before you restart the stack, read the "Upgrading" section of the service README, if it has one.
288289

290+
## Keep your changes out of the clone
291+
292+
This section is optional. The steps in [Quick Start](#quick-start) work as they are. Use one of these options when you run several stacks, or when `git pull` or switching branches runs into your `.env` or into data that the containers wrote as root.
293+
294+
### Run the stack from a copy
295+
296+
Copy the service directory out of the clone, before the first start, and run the stack from the copy:
297+
298+
```sh
299+
cp -R ScaleTail/services/<service> ~/stacks/<service>
300+
cd ~/stacks/<service>
301+
```
302+
303+
Your `.env`, the Tailscale state, and the application data now live outside the clone, so `git pull` in the clone never conflicts with them. A copy no longer follows the repository, so to pick up changes, update the clone and compare the files:
304+
305+
```sh
306+
git -C ScaleTail pull
307+
diff ScaleTail/services/<service>/compose.yaml ~/stacks/<service>/compose.yaml
308+
diff ScaleTail/services/<service>/.env ~/stacks/<service>/.env
309+
```
310+
311+
The `.env` comparison also lists the values you set yourself. Look for variables that are new upstream, such as a new required secret, and add them to your copy.
312+
313+
Read the "Upgrading" section of the service README before you apply a change.
314+
315+
### Keep your changes in an override file
316+
317+
To stay in the clone, put your changes to `compose.yaml` in a file named `compose.override.yaml` (singular) next to it. Compose reads both files without extra options, and `git pull` never touches an untracked file. Entries in `volumes` and `environment` replace the entry with the same container path or variable name, so an override can also move data out of the clone:
318+
319+
```yaml
320+
services:
321+
tailscale:
322+
volumes:
323+
- /srv/scaletail/<service>/ts/state:/var/lib/tailscale
324+
application:
325+
volumes:
326+
- /srv/scaletail/<service>/data:/config
327+
```
328+
329+
Use the container path from the `volumes` of the application in `compose.yaml`. Check the result with `docker compose config`. The override file does not cover `.env`, which is tracked, so keep using `git stash` for it, or run the stack from a copy.
330+
289331
## Remove a stack
290332

291333
From the service directory, run `docker compose down --volumes`. To remove the stack completely, also remove the device on the [Machines](https://console.tailscale.com/admin/machines) page and delete the service directory. It contains the Tailscale state in `./ts/state` and the application data. The containers create some of these folders as root, so deleting them may need `sudo`.

0 commit comments

Comments
 (0)