# LogiStack Docs
> LogiStack is an open-source (Apache 2.0), self-hosted platform as a service (PaaS) built on Docker Swarm. You install it on your own Linux server with one command and deploy apps from Git, a Docker image, a compose file or one of 500+ templates, with automatic HTTPS, databases, backups, S3 storage, metrics, a web dashboard, a REST API and an MCP server for AI agents.
Install: `curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash`
Website: https://stack.logicaltech.it/
Source: https://github.com/logical-tech/logistack
Full docs as one file: https://stack.logicaltech.it/docs/llms-full.txt
Every page is also available as Markdown by appending `content.md` under https://stack.logicaltech.it/docs/llms.mdx/ (for example https://stack.logicaltech.it/docs/llms.mdx/getting-started/install/content.md).
# Chat with the Agent
URL: https://stack.logicaltech.it/docs/automation/agent/
Ask the built-in Agent to check, deploy or change your services in plain language. It calls the LogiStack API with your permissions and asks before it deletes or stops anything.
The Agent is a chat inside the dashboard. You describe what you want, such as "which services use the most memory?" or "add a daily backup to every Postgres database", and it finds the right API operations and runs them for you. It acts with your own permissions, so it can do what you can do in the dashboard and nothing more. Use it for questions that span many services, and for repetitive changes you would otherwise click through one by one.
The Agent is in alpha. Check what it did in the chat and in the [audit log](../team/audit-log.mdx), especially after changes to production.
## Before you start [#before-you-start]
- Your role needs the **AI** permission. Owners and admins have it. Other members need a role that grants it, see [Roles and permissions](../team/roles-and-permissions.mdx).
- The Agent uses the models of the LogiStack AI gateway. An owner or admin adds model providers on the **AI** page, in the **Providers** tab.
- Every answer spends your AI budget, set by an owner or admin in the **Budgets** tab of the **AI** page. While a model call runs, its highest possible cost is held against the budget, so answers running side by side can't spend past it together.
## Start a conversation [#start-a-conversation]
### Open the Agent [#open-the-agent]
Select **Agent** in the sidebar. The page shows your past conversations on the left and the open conversation on the right.

### Pick a model [#pick-a-model]
Select the model button in the message box. **Auto (free first)** tries the free models of the gateway first. You can also pick a specific model, grouped by provider.
### Ask [#ask]
Type what you want in the message box, or pick one of the suggestions, and press Enter. For example:
```text
Deploy the latest commit of every service in production, then tell me which ones failed.
```
The Agent writes its answer as it works. Each API call it makes appears as a step you can expand, with the operation, its input and its output. For longer jobs it keeps a **Tasks** list at the top of the answer and checks items off as it goes.
The conversation runs on the server. You can close the page or open another one: the Agent keeps working, and the conversation is there when you come back. The open conversation is in the page URL, so a refresh lands on it again.
## Approve or deny an operation [#approve-or-deny-an-operation]
Operations that delete or stop something never run on their own. When the Agent wants to run one, it pauses and shows **The Agent wants to run** with the operation's name.
- Select **Approve** to run it.
- Select **Deny** to skip it. The Agent is told you denied it and continues without it.
While it waits, the message box says **Waiting for your approval**. If you type a reply instead, the pending operations are denied and the Agent reads your message.
## Stop, rename or delete a conversation [#stop-rename-or-delete-a-conversation]
- Select the stop button in the message box to stop the Agent while it is working. Send a new message to continue.
- Select **New chat** to start over in an empty conversation.
- To delete a conversation, select the delete button next to it in the list and confirm. A conversation that is still running stops first.
## What the Agent can do [#what-the-agent-can-do]
The Agent sees the same operations as the [REST API](./rest-api.mdx) and the [MCP server](./mcp-server.mdx): projects, services, deployments, domains, variables, backups, databases, nodes and the rest. It searches them by what you ask, then calls them as you. It cannot change its own conversations, and it cannot do anything your role does not allow: an operation you are not permitted to run fails, and the Agent tells you so.
Every change it makes appears in the [audit log](../team/audit-log.mdx) under your name.
Tools that installed [plugins](../plugins/index.mdx) add are operations too: the Agent can list them and run them through the plugin. A tool the plugin marks destructive asks for your approval first, like any destructive operation.
## Common problems [#common-problems]
- **"Your role doesn't include AI"**: ask an owner or admin to add the AI permission to your role.
- **The Agent stopped with an error**: the reason appears under **The Agent stopped**. For example, your AI budget ran out or the model provider refused the request. Fix the cause, then send a message to continue.
- **"Stopped after 40 steps without finishing"**: the Agent made 40 calls in one turn. Send a message, such as "continue", to let it go on.
- **It did the wrong thing**: deny operations you don't want, stop it, and say what to do differently. Changes it already made stay; undo them in the dashboard or ask the Agent to revert them.
# Use LogiStack with AI coding agents
URL: https://stack.logicaltech.it/docs/automation/ai-agents/
Set up Claude Code, Cursor and other AI coding agents to deploy on LogiStack with the MCP server, llms.txt docs, per-page Markdown and an AGENTS.md snippet.
AI coding agents can deploy and operate your apps on LogiStack when they have two things: a way to act, which is the [MCP server](./mcp-server.mdx) or the [REST API](./rest-api.mdx), and a way to learn, which is these docs in a form a model reads well. This page shows how to give an agent both, and what to put in your repository's agent instructions so it works safely.
## Give the agent tools [#give-the-agent-tools]
Connect the agent to `/mcp` with its own API key, as described in [MCP server](./mcp-server.mdx). In short, for Claude Code:
```sh
claude mcp add --transport http logistack https://logistack.example.com/mcp \
--header "Authorization: Bearer lsk_..."
```
Use a key made for the agent, scoped to the projects it works on, with an expiry. An agent with a `developer` key on one project can create services, set variables and deploy there, and nothing else. Every call it makes appears in the [audit log](../team/audit-log.mdx) under that key.
Agents without MCP support can call the REST API with `curl`. Point them at the OpenAPI document at `https://logistack.example.com/api/openapi.json`.
## Give the agent the docs [#give-the-agent-the-docs]
The docs are published in Markdown for language models, following the [llms.txt](https://llmstxt.org) convention:
| URL | What it contains |
| --- | --- |
| [`https://stack.logicaltech.it/docs/llms.txt`](https://stack.logicaltech.it/docs/llms.txt) | A short description of LogiStack, the install command, and a linked index of every docs page with its one-line description. |
| [`https://stack.logicaltech.it/docs/llms-full.txt`](https://stack.logicaltech.it/docs/llms-full.txt) | Every page in one file, as Markdown. Load it when the agent has room for it and needs broad context. |
| `https://stack.logicaltech.it/docs/llms.mdx//content.md` | One page as Markdown. `` is the page's path in the docs. |
For example, this page is at `https://stack.logicaltech.it/docs/llms.mdx/automation/ai-agents/content.md`, and the manifest reference is at `https://stack.logicaltech.it/docs/llms.mdx/automation/project-manifests/content.md`. Every docs page also has a **Copy Markdown** action for pasting it into a chat.
Prefer `llms.txt` plus single pages over `llms-full.txt`: the agent reads the index, then fetches only the pages it needs.
## Add LogiStack to your agent instructions [#add-logistack-to-your-agent-instructions]
Agents read a file in the repository root before they start: `AGENTS.md` for most agents, `CLAUDE.md` for Claude Code, `.cursor/rules` for Cursor, `.github/copilot-instructions.md` for GitHub Copilot. Paste this section into it and fill in your own URL, project and services:
```md title="AGENTS.md"
## Deployment: LogiStack
This app is deployed on LogiStack, a self-hosted PaaS on Docker Swarm.
- Dashboard and API: https://logistack.example.com (REST under /api, OpenAPI at /api/openapi.json)
- MCP server: https://logistack.example.com/mcp, tools are named after REST operations
- Project: storefront (prj_k3v9x2m4q8w1)
- production: env_p7d2c9a1r5t3, services api (svc_m2h5j8k1l4z9), web, orders-db
- staging: env_b4n8s6e2u0y7
- Docs for agents: https://stack.logicaltech.it/docs/llms.txt
Fetch single pages as Markdown from https://stack.logicaltech.it/docs/llms.mdx//content.md
Rules:
- Work in staging unless I name production explicitly.
- Never set `confirm: true` on a destructive tool (delete, stop, restore, rollback) without asking me first, in this conversation.
- Infrastructure is configured in storefront.logistack.yaml. Change that file and apply it with dryRun: true first; show me the plan before applying for real. Never use prune unless I ask.
- Never print or commit secret values. Secret variables are marked secret: true and have no value in the manifest.
- Applying a manifest or changing a service does not deploy it. Deploy explicitly, then poll the deployment until it is healthy or failed, and report the error on failure.
- Pushes to main deploy production automatically through the git webhook. Add [skip deploy] to a commit message to push without deploying.
```
Keep the IDs in the file: they save the agent a lookup on every task. They are not secrets. The API key is, so it belongs in the MCP client configuration or an environment variable, never in this file.
## What agents do well here [#what-agents-do-well-here]
- **Diagnose a failed deploy.** "The last deploy of api failed, find out why." The agent reads the deployment's `error`, the service overview and the logs, and proposes a fix in your code.
- **Wire up a new service.** "Add a Redis to staging and give api its URL." The agent creates the service, sets the variable and deploys api.
- **Keep config in code.** "Export the project manifest and commit it." Later, "raise api to 3 replicas in production" becomes a reviewed change to the manifest.
- **Release with checks.** "Set api to deploy on tags matching `v*.*.*` and wait for CI." The agent updates the deploy triggers.
## Keep agents safe [#keep-agents-safe]
- One key per agent and machine, scoped and expiring. Revoke it in **Settings > API keys** when you are done.
- Prefer `viewer` keys for agents that only investigate.
- Destructive tools refuse to run without `confirm: true`. Keep a human in the loop for those, as the snippet above says.
- Review the audit log, filtered by the key, to see exactly what an agent changed.
# The logistack CLI
URL: https://stack.logicaltech.it/docs/automation/cli/
Diff, apply and export project manifests, deploy services, follow logs and open a shell from your terminal or CI with the logistack command line tool.
`logistack` is a single binary for the terminal and CI. It plans and applies [project manifests](./project-manifests.mdx), exports them, queues deployments, follows logs and opens a shell in a running replica. It talks to the [REST API](./rest-api.mdx) with an [API key](../team/api-keys.mdx), so every command has that key's permissions. Every command takes `--json` for scripts.
## Install [#install]
Each release attaches `logistack-linux-amd64`, `logistack-linux-arm64`, `logistack-darwin-amd64` and `logistack-darwin-arm64`, with a `SHA256SUMS` file. Download the one for your machine and put it on your `PATH`:
```bash
sha256sum -c SHA256SUMS --ignore-missing
install -m 0755 logistack-linux-amd64 /usr/local/bin/logistack
logistack --version
```
## Log in [#log-in]
Create an API key in **Settings** › **API keys**, then run:
```bash
logistack login --url https://stack.example.com
```
The command asks for the key without echoing it, checks it against the instance and saves both to `~/.config/logistack/config.json`, readable by you only. The key is never accepted as a flag: it would end up in your shell history.
In CI, set `LOGISTACK_URL` and `LOGISTACK_API_KEY` instead. They win over the saved login.
## Plan and apply a manifest [#plan-and-apply-a-manifest]
```bash
logistack diff -f storefront.logistack.yaml
logistack apply -f storefront.logistack.yaml
```
Both validate the file locally first. `diff` prints the plan: `+` creates, `~` changes, `-` deletes, one indented line per changed field, never a secret's value. `apply` prints the same plan, asks you to type `yes`, then applies.
```text
~ service production/web
spec.replicas changed
+ domain production/web/shop.example.com
new
0 to create, 2 to change, 0 to delete.
```
A project manifest targets the project with the manifest's name. Pass `--project ` when the name is ambiguous or differs. An environment manifest needs `--environment `. Add `--prune` to also delete what the manifest leaves out.
Apply does not deploy: changed services show a pending diff until you deploy them. For deploys on every change, see [GitOps](./gitops.mdx).
## Export [#export]
```bash
logistack export --project prj_8f2k3m -o storefront.logistack.yaml
logistack export --environment env_storefront_production --format json
```
Without `-o`, the manifest goes to standard output.
## Deploy, logs and shell [#deploy-logs-and-shell]
```bash
logistack deploy --service svc_storefront_production_web --wait
logistack logs --service svc_storefront_production_web --follow --tail 200
logistack exec --service svc_storefront_production_web --shell bash
```
- `deploy --wait` prints each status change and exits with 1 unless the deployment ends `healthy`.
- `logs` prints the last lines of every running replica and exits. `--follow` (or `-F`) keeps following.
- `exec` opens an interactive shell, with the `exec` permission. With `--json` it reads commands from standard input and prints the output and exit code: `echo 'ls /app' | logistack exec --service svc_... --json`.
## Use it in CI [#use-it-in-ci]
This GitHub Actions job plans on pull requests and applies on `main`:
```yaml title=".github/workflows/logistack.yml"
name: LogiStack
on:
pull_request:
paths: [storefront.logistack.yaml]
push:
branches: [main]
paths: [storefront.logistack.yaml]
jobs:
manifest:
runs-on: ubuntu-latest
env:
LOGISTACK_URL: ${{ vars.LOGISTACK_URL }}
LOGISTACK_API_KEY: ${{ secrets.LOGISTACK_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Install logistack
# LOGISTACK_CLI_URL: where you keep the release's logistack-linux-amd64.
run: |
curl -fsSLo logistack "${{ vars.LOGISTACK_CLI_URL }}"
sudo install -m 0755 logistack /usr/local/bin/logistack
- if: github.event_name == 'pull_request'
run: logistack diff -f storefront.logistack.yaml
- if: github.event_name == 'push'
run: logistack apply -f storefront.logistack.yaml --yes
```
Without a terminal, `apply` refuses to run unless you pass `--yes`. `diff --exit-code` exits with 2 when there are changes, to fail a check that expects none.
## Exit codes [#exit-codes]
| Code | Meaning |
| --- | --- |
| `0` | Done. |
| `1` | The API refused the request, or a deployment did not end `healthy`. |
| `2` | `diff --exit-code` found changes. |
| `64` | Wrong usage: a missing flag, an invalid manifest, not logged in. |
With `--json`, an error is printed as `{"error": {"message", "status", "details"}}`.
# Git webhooks and deploys from CI
URL: https://stack.logicaltech.it/docs/automation/git-webhooks/
Deploy LogiStack services on git push, tag or release, wait for CI checks, skip commits, and trigger deploys from GitHub Actions with the REST API.
LogiStack can deploy a service whenever something happens in its repository: a push to the branch, a new tag, or a published release. It can also wait for the commit's CI checks before it deploys. When your own pipeline builds the image, or the source has no webhook, let CI call the deploy endpoint instead. This page covers both.
## How push deploys work [#how-push-deploys-work]
Each connected [Git provider](../deploy/from-git.mdx) has one webhook URL:
```txt
https://logistack.example.com/api/webhooks/git/
```
The provider calls it on every push and pull request. LogiStack checks the signature (an HMAC signature, or GitLab's secret token), then looks at every running service that builds from that repository through that provider and applies the service's deploy triggers:
- A matching event queues a `git_push` deployment of that commit.
- With **Wait for CI checks to pass**, the deployment waits in `awaiting_checks` until the commit's checks pass.
- An event the rules hold back records a `skipped` deployment with the reason, so you can see in **Deployments** why nothing deployed.
- Pull request events create, update or remove [preview environments](../deploy/preview-environments.mdx) instead.
### Where the webhook comes from [#where-the-webhook-comes-from]
| Provider | Webhook |
| --- | --- |
| GitHub | The GitHub App's webhook covers every repository the app is installed on. Nothing to add per repository. |
| GitLab, Gitea and Forgejo, Bitbucket | LogiStack registers the webhook on the repository when you create a service from it. Registering is idempotent. |
| Generic (SSH or HTTPS URL) | No API, so no webhook. Deploy by hand, or [deploy from CI](#deploy-from-ci). |
If registration fails, the service wizard says **Add the push webhook by hand**. Copy the URL from the **Webhook** column in **Integrations > Git providers** and add it in the repository's webhook settings, with the provider's secret.
On GitHub, LogiStack also reports each deployment as a `LogiStack` commit status: pending while it deploys, then success or failure.
The same webhook links commits, branches and pull requests that mention a task key such as `SHOP-42` to that task, and closes it on "Fixes SHOP-42". See [Connect commits and pull requests](../tasks/commits-and-pull-requests.mdx).
## Choose what deploys a service [#choose-what-deploys-a-service]
### Open the service settings [#open-the-service-settings]
Open the service and select the **Settings** tab. Find the **Deploy triggers** panel.

### Pick the event [#pick-the-event]
In **Deploy on**, choose:
- **Pushes to** the source branch, the default. Optionally list **Watch paths**, one per line, so only pushes that change those paths deploy.
- **Tags matching a pattern**, and set **Tag pattern**, a glob such as `v*.*.*`. `*` matches any tag.
- **Published releases**, deployed when a release is published on GitHub, GitLab or Gitea and Forgejo and its tag matches **Tag pattern**. Bitbucket has no releases.
### Optionally wait for CI [#optionally-wait-for-ci]
Turn on **Wait for CI checks to pass**. Set **Give up after** in minutes (1 to 720, default 30). A check that fails, or does not finish in time, skips the deployment.
### Save [#save]
Select **Save triggers**.
Watch paths are globs (`packages/**/*.ts`) or directory prefixes (`apps/web`). An empty list deploys on every push. In a monorepo, give each service the directories it is built from:
```txt title="Watch paths for apps/api"
apps/api
packages/db
packages/shared
```
### Skip a commit [#skip-a-commit]
A commit whose message contains `[skip ci]`, `[ci skip]` or `[skip deploy]` never deploys:
```sh
git commit -m "docs: fix typo in README [skip deploy]"
```
The same settings are available over the API: `PUT /api/services/{id}/git-trigger` and `PUT /api/services/{id}/watch-paths`.
```sh
curl -fsS -X PUT "$LOGISTACK_URL/api/services/svc_m2h5j8k1l4z9/git-trigger" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
-d '{"on": "tag", "tagPattern": "v*.*.*", "waitForChecks": true, "checksTimeoutMinutes": 45}'
```
## Check it worked [#check-it-worked]
Push a commit to the branch, then open the service's **Deployments** tab. A new deployment with the commit's message appears within seconds. If it shows as skipped, its reason says which rule held it back.

In the provider, the webhook's delivery log shows LogiStack's answer:
| Response | Meaning |
| --- | --- |
| `200` with `"outcome": "deployed"` | At least one deployment was queued or is awaiting checks. `deployments` lists their IDs. |
| `202` with `"outcome": "skipped"` | Services matched, but rules held every one back. `reason` says why. |
| `202` with `"outcome": "ignored"` | Nothing to do, for example no service builds from this repository, or the event type is not used. |
| `401` | Missing or invalid signature. The secret in the provider does not match. |
| `404` | Unknown provider. The provider was removed from LogiStack. |
## Deploy from CI [#deploy-from-ci]
Call `POST /api/services/{id}/deploy` from any pipeline. It queues a deployment with trigger `api` and returns it. Use this when:
- your CI builds and pushes the image itself and LogiStack should only run it;
- the source is a generic Git URL with no webhook;
- you want the deploy to happen only after your own tests and approvals.
Create an API key for a [service account](../team/service-accounts.mdx), limited to the service with the `developer` role. That role can update the service and deploy it.
### Redeploy a git service [#redeploy-a-git-service]
For a service that builds from git, a deploy builds the head of its branch:
```sh
curl -fsS -X POST -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/services/$SERVICE_ID/deploy"
```
### Ship a new image with GitHub Actions [#ship-a-new-image-with-github-actions]
This workflow builds an image on every push to `main`, pushes it to GitHub Container Registry with the commit SHA as the tag, points the LogiStack service at the new tag, deploys it and waits until it is healthy. The service is an image service (source **Docker image**) that pulls `ghcr.io/acme/api`.
Add these to the repository: secret `LOGISTACK_API_KEY`, variables `LOGISTACK_URL` (such as `https://logistack.example.com`) and `LOGISTACK_SERVICE_ID` (such as `svc_m2h5j8k1l4z9`). If the package is private, add a [registry](../deploy/registries.mdx) for `ghcr.io` in LogiStack so it can pull.
```yaml title=".github/workflows/deploy.yml"
name: Build and deploy
on:
push:
branches: [main]
permissions:
contents: read
packages: write
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
LOGISTACK_URL: ${{ vars.LOGISTACK_URL }}
SERVICE_ID: ${{ vars.LOGISTACK_SERVICE_ID }}
LOGISTACK_API_KEY: ${{ secrets.LOGISTACK_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.IMAGE }}
- name: Point the service at the new image
run: |
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/services/$SERVICE_ID" \
| jq --arg image "$IMAGE" '{spec: (.spec | .source.image = $image)}' > patch.json
curl -fsS -X PATCH "$LOGISTACK_URL/api/services/$SERVICE_ID" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
--data @patch.json > /dev/null
- name: Deploy
id: deploy
run: |
id=$(curl -fsS -X POST -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/services/$SERVICE_ID/deploy" | jq -r .id)
echo "id=$id" >> "$GITHUB_OUTPUT"
echo "Deployment $id queued"
- name: Wait until healthy
timeout-minutes: 15
run: |
while :; do
dep=$(curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/deployments/${{ steps.deploy.outputs.id }}")
status=$(jq -r .status <<<"$dep")
echo "status: $status"
case $status in
healthy) exit 0 ;;
failed|cancelled|superseded|skipped)
echo "::error::deployment $status: $(jq -r '.error // .reason // ""' <<<"$dep")"
exit 1 ;;
esac
sleep 5
done
```
`PATCH` replaces the whole `spec`, which is why the step reads the current spec and changes only the image. Each deployment gets its own image tag, so a [rollback](../deploy/deployments.mdx) to an earlier deployment runs exactly the image it ran before.
### Other CI systems [#other-ci-systems]
The calls are the same everywhere. A GitLab CI job:
```yaml title=".gitlab-ci.yml"
deploy:
stage: deploy
image: alpine:3.20
rules:
- if: $CI_COMMIT_BRANCH == "main"
before_script:
- apk add --no-cache curl jq
script:
- curl -fsS -X POST -H "x-api-key: $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/services/$LOGISTACK_SERVICE_ID/deploy" | jq
```
## Common problems [#common-problems]
- **Pushes do not deploy and the provider shows no delivery.** The webhook is missing. For GitHub, check the app is installed on the repository. For others, add the URL from **Integrations > Git providers** by hand.
- **The delivery log shows `401`.** The webhook secret in the provider differs from the one LogiStack stored. Re-add the webhook with the URL and secret from LogiStack.
- **`ignored: no service builds from this provider`.** The service was created from a public URL without choosing the provider. Pushes only reach services that build through a connected provider.
- **`skipped` deployments.** Read the reason: the commit message carries a skip marker, no changed file is in **Watch paths**, the tag does not match, or the checks failed or timed out.
- **The deploy endpoint returns `403`.** The key lacks `deploy` on the service, or `write` for the `PATCH` step.
- **The deployment fails with a pull error.** LogiStack cannot read the image. Add a registry with credentials for it.
# Deploy a project from a manifest in git (GitOps)
URL: https://stack.logicaltech.it/docs/automation/gitops/
Link a project to a manifest file in a git repository so every push that changes it is planned, applied and deployed, and optionally refuse manual edits.
GitOps keeps a project's desired state in a [project manifest](./project-manifests.mdx) inside a git repository. When a push changes the file, LogiStack reads it at the pushed commit, plans it against the project, applies the changes and deploys the services that changed. The file's history becomes the project's history: every change has an author, a diff and a review. Use it when a team wants changes reviewed in pull requests instead of made by hand in the dashboard.
You need a connected [git provider](../deploy/from-git.mdx) whose webhook reaches LogiStack, and a project manifest in the repository. The easiest start is to export the project you already run: open the project's actions menu (**⋯**), select **Export manifest** and commit the file.
## Link a project to a repository [#link-a-project-to-a-repository]
### Open GitOps [#open-gitops]
Open the project, open its actions menu (**⋯**) and select **GitOps…**.
### Choose the repository [#choose-the-repository]
Pick the **Git provider**, the **Repository** and the **Branch** LogiStack follows. Select **Continue**.
### Point at the manifest and test it [#point-at-the-manifest-and-test-it]
Enter the **Manifest path** inside the repository, for example `deploy/logistack.yaml`. Select **Read and plan**: LogiStack reads the file at the branch head, validates it and lists what applying it would change. Nothing is applied yet.

A file exported from this project plans no change: "it matches what the project runs".
### Choose how it applies [#choose-how-it-applies]
- **Apply on push**: a push that changes the manifest applies it and deploys the services it changed. Turned off, a push only records what would change, and you apply it with **Sync now**.
- **Managed by git**: edits to the project in the dashboard, the API and the MCP server are refused. See [Managed by git](#managed-by-git).
- **Delete what the manifest leaves out**: environments, services, domains, variables and backup policies the file does not list are removed on apply.
### Review and save [#review-and-save]
Check the summary and select **Follow this repository**. The next push that changes the file applies it. Select **Sync now** to apply the branch head at once.
With **Delete what the manifest leaves out**, a service removed from the file is deleted with its volumes. Keep it off until the manifest lists everything the project runs.
## What happens on a push [#what-happens-on-a-push]
The webhook that already deploys services from git also drives GitOps. For each project that follows the pushed repository and branch:
1. LogiStack checks the push touches the manifest path. A push that leaves the file alone does nothing to the project.
2. It reads the file at the pushed commit and validates it as a project manifest (`kind: project`).
3. It applies the manifest, or only plans it when **Apply on push** is off.
4. It queues a deployment of every running service the apply changed: the service itself, or every service under a changed environment or project variable. Services that belong to a git stack are deployed by their stack.
The apply runs as a system actor that holds the admin role on that project and nothing else, so a manifest cannot change anything outside its project. Each apply is recorded in the [audit log](../team/audit-log.mdx) as `project.apply`, with the actor `gitops-`.
## Check that it worked [#check-that-it-worked]
The **GitOps** page shows the repository, the manifest path and the last sync: its status, when it ran and the commit it read.

The project header shows **Managed by git** (or **Follows git** when edits are still allowed). It adds **sync failed** while the last sync has an error.
## When a sync fails [#when-a-sync-fails]
A manifest that does not read, does not validate or does not apply leaves the project as it was and records the error on the **GitOps** page: the message, the commit, and one line per detail, such as each invalid path or each missing organization resource. Fix the file and push again, or select **Sync now**. The next sync that works clears the error.
## Managed by git [#managed-by-git]
With **Managed by git** on, any change to the project made outside the repository gets a 409 that names the file and the repository:
```text
this project is managed by git: change deploy/logistack.yaml in acme/infra (main) instead, or turn off "Managed by git" in the project's GitOps settings
```
This covers the project, its environments, services, variables, domains, stacks and backup policies, from the dashboard, the API and the MCP server. Three things stay open:
- **Secrets**, because their values never live in the repository. Reference them from the manifest by name with `secretRef`: see [Secrets in a manifest](./project-manifests.mdx#secrets-in-a-manifest).
- **Deploys**, restarts and rollbacks, which run what the desired state already says.
- **The GitOps settings**, so an admin can turn the mode off.
## Stop following a repository [#stop-following-a-repository]
On the **GitOps** page, select **Stop following**, then **Confirm stop**. The project keeps its current state and takes edits again.
## With the API [#with-the-api]
| Route | What it does |
| --- | --- |
| `GET /api/projects/{id}/gitops` | The link and its last sync, or `null`. |
| `POST /api/projects/{id}/gitops/check` | Reads the file and returns the plan, without linking. |
| `PUT /api/projects/{id}/gitops` | Links or updates: `gitProviderId`, `repository`, `branch`, `path`, `autoApply`, `prune`, `managed`. `prune` needs `delete` on the project. |
| `POST /api/projects/{id}/gitops/sync` | Syncs the branch head now. |
| `DELETE /api/projects/{id}/gitops` | Stops following. |
Every route needs `write` on the project, except `GET`, which needs `read`.
## Common problems [#common-problems]
- **`couldn't read acme/infra@main:deploy/logistack.yaml`.** The path, branch or repository is wrong, or the provider cannot read the repository. Check the provider's access in **Integrations** › **Git providers**.
- **`… is an environment manifest`.** GitOps follows a project manifest. Export the project, not an environment.
- **`the manifest names organization resources that are not here`.** A git provider, DNS provider, S3 destination or certificate in the file has no match by name in this organization. The details list each one.
- **A push did nothing.** The push did not touch the manifest path, went to another branch, or carries a skip marker such as `[skip ci]` in its message. The webhook's response lists a `gitops` entry for every project it synced.
- **A dashboard edit returns 409.** The project is managed by git. Change the file, or turn the mode off on the **GitOps** page.
# Automate LogiStack
URL: https://stack.logicaltech.it/docs/automation/
Drive LogiStack from scripts, CI pipelines and AI agents with the REST API, the built-in MCP server, project manifests and git webhooks.
Everything you can do in the dashboard is also an HTTP call. Use the automation surfaces when you deploy from CI, keep a project's configuration in git, or let an AI coding agent operate your services. They all share one model: an [API key](../team/api-keys.mdx) authenticates the call, the key's permissions decide what it may do, and every change lands in the [audit log](../team/audit-log.mdx).
Authenticate with an `lsk_` key, browse the OpenAPI reference at `/api/docs` and call any route with curl.
Connect Claude Code, Claude Desktop, Cursor or VS Code to `/mcp`. Every REST operation is a tool.
Export a project or environment as YAML, keep it in git and apply it with a dry run first.
Deploy on push, on tags or on releases, wait for CI checks, or trigger a deploy from GitHub Actions.
Ask the built-in chat to check, deploy or change services in plain language, with your permissions.
Give an agent the MCP server, the `llms.txt` docs index and a ready-made instruction snippet.
## Which one to use [#which-one-to-use]
| You want to | Use |
| --- | --- |
| Deploy every push to a branch | [Git webhooks](./git-webhooks.mdx) with a connected Git provider |
| Deploy a new image tag after your own CI builds it | [REST API](./rest-api.mdx) from a CI job, see [Deploy from CI](./git-webhooks.mdx#deploy-from-ci) |
| Recreate a project on another server, or review config changes in pull requests | [Project manifests](./project-manifests.mdx) |
| Ask an agent to "add a Redis to staging and redeploy the API" | The built-in [Agent](./agent.mdx), or your own agent through the [MCP server](./mcp-server.mdx) |
| Write your own tooling | [REST API](./rest-api.mdx) and its OpenAPI document |
## Before you start [#before-you-start]
1. Create an API key in **Settings > API keys**. For CI, create it for a [service account](../team/service-accounts.mdx) so it does not depend on a person.
2. Limit the key to the folder, project, environment or service it needs, with the role it needs. A key that only deploys one service needs the `developer` role on that service.
3. Store the key as a secret in your CI system or agent configuration. LogiStack shows it once.
# MCP server
URL: https://stack.logicaltech.it/docs/automation/mcp-server/
Connect Claude Code, Claude Desktop, Cursor or VS Code to LogiStack's built-in MCP server and let an AI agent deploy, inspect and manage services.
LogiStack ships a Model Context Protocol (MCP) server at `/mcp` on your dashboard's URL. It lets an AI agent such as Claude Code work with your projects: list services, read deployments, change variables, deploy and roll back. Use it when you want to operate LogiStack in plain language from your editor or terminal. Nothing to install: the server is part of the API and is always on.
## How it works [#how-it-works]
- **Endpoint.** `https://logistack.example.com/mcp`, over Streamable HTTP. It is stateless and answers in JSON.
- **Authentication.** An API key in the `Authorization: Bearer lsk_...` header. The `x-api-key` header and browser sessions are not accepted here, so a logged-in browser cannot drive the API through `/mcp`.
- **Tools mirror the REST API.** Every [REST](./rest-api.mdx) operation is one tool, with the same inputs: path parameters, query parameters and a `body` object. First-run setup routes are left out.
- **Same permissions, same audit trail.** Each tool call is replayed against the API with the key, so the key's role and scopes apply exactly as they do over REST, and every change shows in the [audit log](../team/audit-log.mdx) with the key as the actor.
- **Destructive tools need `confirm: true`.** Every `DELETE`, and every operation that stops, restores or rolls back something, has a required `confirm` argument. Without it the call is refused with a message telling the agent to ask you first. The server's instructions also tell the agent to ask before setting it.
Tool names come from the operation: an audited action such as `service.create` becomes `service_create`, and a read becomes its method and path, such as `get_projects` or `get_deployments_by_id`.
| Task | Tool | REST route |
| --- | --- | --- |
| List projects | `get_projects` | `GET /api/projects` |
| Create a service | `service_create` | `POST /api/environments/{id}/services` |
| Trigger a deploy | `deployment_create` | `POST /api/services/{id}/deploy` |
| Read a deployment | `get_deployments_by_id` | `GET /api/deployments/{id}` |
| Roll back (destructive) | `deployment_rollback` | `POST /api/deployments/{id}/rollback` |
| Stop a service (destructive) | `service_stop` | `POST /api/services/{id}/stop` |
| Delete a service (destructive) | `service_delete` | `DELETE /api/services/{id}` |
| Apply a manifest | `project_apply`, `environment_apply` | `POST /api/projects/{id}/apply` |
Ask your client to list the tools to see all of them.
[Tasks](../tasks/api-and-mcp.mdx) are tools too, such as `work_task_create` and `get_work_tasks`, so an agent can create, triage and summarize tasks with a key that holds the Tasks actions.
Tools that installed [plugins](../plugins/index.mdx) contribute are reached the same way: `get_plugins_tools` lists them with their input schemas, `plugin_tool_call` runs one, and `plugin_tool_call_destructive` runs one the plugin marks destructive. The destructive one needs the Delete action and `confirm: true`.
## Create a key for the agent [#create-a-key-for-the-agent]
### Open the API keys page [#open-the-api-keys-page]
Go to **Settings > API keys**. The **MCP server** panel at the bottom shows your endpoint and a ready-made Claude Code command.

### Create the key [#create-the-key]
Select **Create API key**. In **Name and owner**, name it after the agent and machine, such as `claude-laptop`. In **Access**, choose **Limit to scopes** and grant the smallest role that does the job: `viewer` for an agent that only reads, `developer` on one project for an agent that deploys it. Pick an **Expiry**, then select **Create key**.

### Copy the key [#copy-the-key]
The next screen shows the key once, with the Claude Code command already filled in. Copy it now.
The agent can do anything the key allows. Give an agent its own key with narrow scopes and an expiry, never an owner's unscoped key. Revoke it from **Settings > API keys** when you stop using it.
## Connect your client [#connect-your-client]
Replace `logistack.example.com` with your dashboard's host and `lsk_...` with the key.
Run this in a terminal. It is the same command the dashboard shows after you create a key:
```sh
claude mcp add --transport http logistack https://logistack.example.com/mcp \
--header "Authorization: Bearer lsk_..."
```
Add `--scope project` to save it in the repository's `.mcp.json` for your team. Do not commit a real key: keep the header value in an environment variable, as below, and have each person export their own.
```json title=".mcp.json"
{
"mcpServers": {
"logistack": {
"type": "http",
"url": "https://logistack.example.com/mcp",
"headers": { "Authorization": "Bearer ${LOGISTACK_API_KEY}" }
}
}
}
```
Check the connection with `claude mcp list`, or `/mcp` inside a session.
Claude Desktop starts local MCP servers from its configuration file. Bridge to the remote endpoint with `mcp-remote`, which needs Node.js. Open **Settings > Developer > Edit Config** and add:
```json title="claude_desktop_config.json"
{
"mcpServers": {
"logistack": {
"command": "npx",
"args": [
"-y", "mcp-remote",
"https://logistack.example.com/mcp",
"--header", "Authorization:${LOGISTACK_AUTH}"
],
"env": { "LOGISTACK_AUTH": "Bearer lsk_..." }
}
}
}
```
The header is passed through `env` because some platforms split arguments on spaces. Restart Claude Desktop. LogiStack's tools appear under the tools menu in a new chat.
Add the server to `~/.cursor/mcp.json` for every project, or `.cursor/mcp.json` for one:
```json title="~/.cursor/mcp.json"
{
"mcpServers": {
"logistack": {
"url": "https://logistack.example.com/mcp",
"headers": { "Authorization": "Bearer lsk_..." }
}
}
}
```
Open **Cursor Settings > MCP** and check that `logistack` shows a green dot and its tools.
Add `.vscode/mcp.json` to the workspace. The `inputs` entry makes VS Code prompt for the key once and store it, so it never lands in the file:
```json title=".vscode/mcp.json"
{
"inputs": [
{
"type": "promptString",
"id": "logistack-key",
"description": "LogiStack API key (lsk_...)",
"password": true
}
],
"servers": {
"logistack": {
"type": "http",
"url": "https://logistack.example.com/mcp",
"headers": { "Authorization": "Bearer ${input:logistack-key}" }
}
}
}
```
Select **Start** above the server entry, then use the tools from Copilot Chat in agent mode.
Any other client that supports Streamable HTTP with custom headers works the same way.
## Check it worked [#check-it-worked]
Ask the agent a read-only question:
```txt
Using LogiStack, list my projects and the status of each service.
```
The agent calls `get_projects` and answers with your project names and service statuses. If it replies that it has no such tool, the client did not load the server: check the URL ends in `/mcp` and the header starts with `Bearer lsk_`.
## Example prompts [#example-prompts]
```txt
Show the last five deployments of the API service in storefront production, with their status and commit.
```
```txt
The checkout service in staging is unhealthy. Read its overview and its latest failed deployment, and tell me why.
```
```txt
Add a Postgres 17 database called orders-db to storefront staging.
```
```txt
Set LOG_LEVEL=debug on the API service in staging, then deploy it and wait until it is healthy.
```
```txt
Export the storefront project as a YAML manifest, add a Redis service to staging, and apply it as a dry run first. Show me the plan before applying.
```
```txt
Roll the API service in production back to the deployment before the current one.
```
For the last one, the agent finds the deployment, calls `deployment_rollback` without `confirm`, gets refused, and asks you. It runs the rollback only after you agree.
## Common problems [#common-problems]
- **`401 send an API key as Authorization: Bearer lsk_...`.** The client sent no header, used `x-api-key`, or dropped the `Bearer ` prefix.
- **`401 invalid, revoked or expired API key`.** Create a new key and update the client configuration.
- **A tool returns `403 forbidden`.** The key's role or scopes do not cover that resource. Widen the key's scopes, or ask the agent to work in a scope it has.
- **The agent tries a destructive tool again and again.** It is missing `confirm: true`. Tell it you approve, and it calls the tool again with the flag.
- **The client cannot reach the server.** `/mcp` is served on the dashboard's URL. Before setup is complete, or when the dashboard is only reachable through an SSH tunnel, use the tunnel address, such as `http://localhost:3000/mcp`.
# Project manifests (configuration as code)
URL: https://stack.logicaltech.it/docs/automation/project-manifests/
Export a LogiStack project or environment as a YAML or JSON manifest, keep it in git, and apply it from the dashboard, CI or an agent with a dry run first.
A manifest is the desired state of one project, or one environment, as a YAML or JSON file. It lists environments, variables, services with their spec, mounts, domains and backup policies, and git stacks. Use manifests to review configuration changes in pull requests, to recreate a project on another server, or to copy staging's setup into a new environment. Applying a manifest is idempotent: apply the same file twice and the second run changes nothing.
## What a manifest holds [#what-a-manifest-holds]
`version` is `1`. `kind` is either:
- `project`: a `project` (name and description), project-wide `variables`, and a list of `environments`.
- `environment`: one `environment`.
An environment holds `variables`, git `stacks` and `services`. A service holds its `spec`, `variables`, `mounts`, `domains`, `backups` and, for an application, `autoscale` ([automatic scaling](../deploy/autoscaling.mdx#use-the-api)).
| Rule | What it means |
| --- | --- |
| Identity | Apply matches environments and services by `slug`, variables by `key`, domains by hostname plus path prefix, backups by target, volume, destination and cron, stacks by name. Rename a service's `name` freely; changing its `slug` means a different service. |
| Secrets | Never exported with a value. A service's own secret is exported as `secret: true`; a reference to a secret defined elsewhere as `secretRef: {key, scope}`. See [Secrets in a manifest](#secrets-in-a-manifest). |
| Organization resources | Git providers, backup destinations (S3 or any other kind), DNS providers and uploaded certificates are referenced by name: `gitProvider`, `destination`, `dnsProvider`, `certificate`. A name that matches nothing, or more than one resource, fails with a 400 listing each such name. |
| Specs | A service's `spec` is the same object the [REST API](./rest-api.mdx) takes, except that a git source names its provider in the service's `gitProvider` field instead of `gitProviderId`. |
Export leaves out: secret values, generated domains, basic auth and domain access rules (they hold password hashes), node pins and adopted volumes. Stacks made from a pasted compose file or a template are exported as their individual services, because the compose file can hold credentials. Git stacks are exported by repository, and their services carry `stack: `.
## Example [#example]
```yaml title="storefront.logistack.yaml"
# yaml-language-server: $schema=https://logistack.example.com/api/manifest/schema.json
version: 1
kind: project
project:
name: Storefront
description: Shop frontend, API and database
variables:
- key: SENTRY_ENVIRONMENT_PREFIX
value: storefront
environments:
- name: Production
slug: production
kind: production
variables:
- key: LOG_LEVEL
value: info
services:
- name: API
slug: api
gitProvider: GitHub (acme)
spec:
kind: application
source:
type: git
repository: acme/storefront
branch: main
path: /apps/api
build:
type: dockerfile
dockerfilePath: Dockerfile
context: .
ports: []
replicas: 2
resources:
cpu: 1
memoryMb: 1024
healthcheck:
type: http
port: 8080
path: /healthz
placement: []
drainTimeout: 30
variables:
- key: PORT
value: "8080"
- key: DATABASE_URL
secret: true
- key: NEXT_PUBLIC_API_URL
value: https://api.shop.example.com
buildTime: true
domains:
- hostname: api.shop.example.com
port: 8080
https: true
cert: auto
- name: Web
slug: web
spec:
kind: application
source:
type: image
image: ghcr.io/acme/storefront-web:2.3.0
build:
type: image
ports: []
replicas: 2
resources:
memoryMb: 512
placement: []
domains:
- hostname: shop.example.com
port: 3000
https: true
cert: auto
- hostname: www.shop.example.com
port: 3000
https: true
cert: auto
redirectTo: shop.example.com
- name: Orders DB
slug: orders-db
spec:
kind: database
engine: postgres
version: "17"
credentialsRef: env
resources:
memoryMb: 1024
backups:
- target: database
destination: Backups (Hetzner)
cron: 0 3 * * *
timezone: Europe/Rome
retention:
count: 14
encrypt: true
- name: Staging
slug: staging
kind: staging
color: amber
variables:
- key: LOG_LEVEL
value: debug
services: []
```
Field defaults you can leave out: `desiredState` is `running`, `variables`, `mounts`, `domains`, `backups`, `stacks` and `services` are empty lists, a variable's `secret` and `buildTime` are `false`, a domain's `tunnel` is `false`, a backup's `timezone` is `UTC`, `enabled` is `true`, and `pauseService` and `encrypt` are `false`.
## Editor support [#editor-support]
The server publishes the manifest's JSON Schema at `/api/manifest/schema.json`, without authentication. A YAML export starts with a modeline that points at it, so editors with the YAML language server (VS Code's YAML extension, JetBrains IDEs, Zed, Neovim) give completion and validation as you type:
```yaml
# yaml-language-server: $schema=https://logistack.example.com/api/manifest/schema.json
```
## Export a manifest [#export-a-manifest]
### Open the project [#open-the-project]
Go to **Projects** and open the project.
### Export it [#export-it]
Open the project's actions menu and select **Export manifest** to download the whole project. To export one environment, open that environment's menu and select **Export manifest** there.
The file is named after the project or environment, such as `storefront.logistack.yaml`. From the API:
```sh
# The whole project, as YAML
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/projects/prj_k3v9x2m4q8w1/manifest?format=yaml" -o storefront.logistack.yaml
# One environment, as JSON (the default format)
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/environments/env_p7d2c9a1r5t3/manifest" -o production.logistack.json
```
Export needs the `read` permission.
## Apply a manifest from the dashboard [#apply-a-manifest-from-the-dashboard]
### Open Import manifest [#open-import-manifest]
Open the project's actions menu and select **Import manifest…**. To start from one environment, use **Import manifest…** in that environment's menu.

### Add the manifest [#add-the-manifest]
Drop a `.yaml`, `.yml` or `.json` file, select **Choose file**, or paste it into **Manifest**. For an environment manifest, choose the target environment in **Apply to**.
### Review changes [#review-changes]
The **Review changes** step shows a dry-run plan: each environment, variable, stack, service, domain and backup that would be created, updated or deleted, with one line per changed field and never a secret's value. Turn on **Prune** only if you also want to delete what the manifest does not list.
### Apply [#apply]
Select **Apply changes**. If the manifest created encrypted backup policies, the result shows each policy's age key once. Copy them now: you need them to restore those backups.
## Apply a manifest from the API [#apply-a-manifest-from-the-api]
`POST /api/projects/{id}/apply` takes a project manifest. `POST /api/environments/{id}/apply` takes an environment manifest. The body is:
```json
{ "manifest": "", "prune": false, "dryRun": true }
```
Plan first with `dryRun: true`, then apply:
```sh title="apply.sh"
set -euo pipefail
body=$(jq -Rs '{manifest: ., dryRun: true}' storefront.logistack.yaml)
curl -fsS -X POST "$LOGISTACK_URL/api/projects/$PROJECT_ID/apply" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
--data "$body" | jq '.changes[] | "\(.op) \(.resource) \(.environment // "")/\(.service // "") \(.name)"'
body=$(jq -Rs '{manifest: ., dryRun: false}' storefront.logistack.yaml)
curl -fsS -X POST "$LOGISTACK_URL/api/projects/$PROJECT_ID/apply" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
--data "$body" | jq '{applied, warnings, backupKeys}'
```
```json title="Response (abridged)"
{
"applied": true,
"changes": [
{
"op": "update",
"resource": "service",
"environment": "production",
"name": "api",
"changes": ["spec changed"]
},
{
"op": "create",
"resource": "domain",
"environment": "production",
"service": "web",
"name": "www.shop.example.com",
"changes": ["new"]
}
],
"warnings": [],
"backupKeys": []
}
```
Over MCP the same routes are the `project_apply` and `environment_apply` tools.
## What apply does [#what-apply-does]
- It converges phase by phase: project, environments, variables, stacks, services, domains, backups. Each phase reads the current state again.
- It deletes nothing unless `prune` is `true`. With prune it deletes environments (project manifests only), variables, stacks, services, domains and backups the manifest does not list.
- It calls the same routes a person uses, as the caller, so their permission checks and audit entries apply. Apply needs `write` on the project or environment, creating a stack needs `deploy`, and prune needs `delete`.
- It does not deploy. A changed service shows a pending diff until you deploy it. Stacks and config files roll out the way their own routes do.
- It cannot change the volume mounts of an existing service, the git source of an existing stack, or turn backup encryption off. It reports a warning for each instead.
With `prune: true`, apply deletes every service, domain, variable, stack and backup policy that the manifest does not list, including databases. Always run a dry run with prune first and read every `delete` in the plan.
## Secrets in a manifest [#secrets-in-a-manifest]
A manifest carries secret references, never values. A service variable can reference a managed secret by its key and, optionally, the level that defines it. Without `scope`, apply picks the most specific secret of that key on the service's chain, as the **Environment** tab does:
```yaml title="storefront.logistack.yaml (excerpt)"
variables:
- key: DB_PASSWORD
secretRef: { key: PG_PASSWORD, scope: environment }
- key: STRIPE_SECRET_KEY
secretRef: { key: STRIPE_SECRET_KEY }
asFile: true
- key: DATABASE_URL
value: postgres://app:${{ secrets.PG_PASSWORD }}@db:5432/app
- key: SESSION_SECRET
secret: true
```
- `secretRef` names the secret; the variable's `key` is the name the container sees. The secret must exist on the chain, or apply stops with `no secret PG_PASSWORD at environment scope on this service's chain that you can read`. Create secrets in **Secrets & variables** or with `POST /api/secrets` first.
- `asFile: true` mounts the secret at `/run/secrets/`: see [Mount a secret as a file](../deploy/environment-variables.mdx#mount-a-secret-as-a-file).
- `${{ secrets.KEY }}` inside a plain value resolves at deploy time: see [Use a secret inside a value](../deploy/environment-variables.mdx#use-a-secret-inside-a-value).
- `secret: true` without a value is the service's own secret: apply keeps the stored value. A new one without a value is a warning: set it afterwards.
References belong to service variables; on a project or environment variable, apply skips them with a warning. Duplicating an environment keeps references as references.
## Apply from CI [#apply-from-ci]
The [logistack CLI](./cli.mdx) does this in one line: `logistack apply -f storefront.logistack.yaml --yes`. To apply on every push without CI, link the project with [GitOps](./gitops.mdx). With plain `curl`, keep the manifest in the repository and apply it on merge. This GitHub Actions job plans on pull requests and applies on `main`. Store the key as the `LOGISTACK_API_KEY` secret and the project ID and URL as repository variables. The key needs `write` on the project.
```yaml title=".github/workflows/logistack-manifest.yml"
name: LogiStack manifest
on:
pull_request:
paths: [storefront.logistack.yaml]
push:
branches: [main]
paths: [storefront.logistack.yaml]
jobs:
apply:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Plan or apply
env:
LOGISTACK_URL: ${{ vars.LOGISTACK_URL }}
LOGISTACK_API_KEY: ${{ secrets.LOGISTACK_API_KEY }}
PROJECT_ID: ${{ vars.LOGISTACK_PROJECT_ID }}
DRY_RUN: ${{ github.event_name == 'pull_request' }}
run: |
body=$(jq -Rs --argjson dry "$DRY_RUN" '{manifest: ., dryRun: $dry}' storefront.logistack.yaml)
curl -fsS -X POST "$LOGISTACK_URL/api/projects/$PROJECT_ID/apply" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
--data "$body" | tee result.json | jq .
jq -e '.warnings | length == 0' result.json >/dev/null || echo "::warning::apply reported warnings"
```
To supply a secret that the manifest leaves empty, fill it in before applying, for example with `yq`:
```sh
yq -i '(.environments[] | select(.slug == "production") | .services[] | select(.slug == "api") | .variables[] | select(.key == "DATABASE_URL")).value = strenv(DATABASE_URL)' storefront.logistack.yaml
```
## Common problems [#common-problems]
- **`not a valid manifest`.** The `details` list each failing path, such as `environments.0.services.1.spec.build.type`. Validate in your editor with the schema modeline.
- **`this is an environment manifest: apply it to an environment`.** You sent `kind: environment` to a project's apply route, or the reverse.
- **A 400 naming a git provider, destination or certificate.** No resource has that name, or more than one does. Rename one in the dashboard so the name is unique.
- **`a variable that is not secret needs a value`.** Add `value`, or mark the variable `secret: true`.
- **Changes applied but nothing changed in the running app.** Apply does not deploy. Deploy the services that show a pending diff.
# REST API
URL: https://stack.logicaltech.it/docs/automation/rest-api/
Call the LogiStack REST API with an lsk_ API key. Base URL, authentication, OpenAPI reference, errors and curl examples to create and deploy services.
The REST API is the same API the dashboard uses. Every page, wizard and button calls it, so anything you can do in the browser you can script. Use it from CI jobs, from your own tools, or to debug what a request returns. The [MCP server](./mcp-server.mdx) and [manifests](./project-manifests.mdx) are built on it.
## Base URL [#base-url]
The API lives under `/api` on your dashboard's URL, the instance URL you chose in the [setup wizard](../getting-started/setup-wizard.mdx):
```txt
https://logistack.example.com/api
```
The examples below read the URL and the key from environment variables:
```sh
export LOGISTACK_URL=https://logistack.example.com
export LOGISTACK_API_KEY=lsk_xxxxxxxxxxxxxxxxxxxxxxxx
```
## Interactive reference [#interactive-reference]
Two routes describe every operation. Neither needs a key to open:
| URL | What it is |
| --- | --- |
| `/api/openapi.json` | The OpenAPI 3.1 document. Generate a client from it, or import it into Postman or Insomnia. |
| `/api/docs` | An interactive reference (Scalar) built from that document. Try requests from the browser. |
The document is generated from the server's route definitions, so it always matches the release you run.
## Authenticate with an API key [#authenticate-with-an-api-key]
Create a key in **Settings > API keys** with **Create API key**. The wizard asks for a name and owner, the access (everything the owner can do, or a list of scopes) and an expiry. Keys start with `lsk_` and are shown once. See [API keys](../team/api-keys.mdx) for the full walkthrough.

Send the key in one of two headers:
```sh
curl -H "x-api-key: $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/me"
```
```sh
curl -H "Authorization: Bearer $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/me"
```
A key acts as its owner, narrowed to its scopes: a scoped key may do an action only where both the owner and the key's scopes allow it. Every call is recorded in the [audit log](../team/audit-log.mdx) with the key as the actor, and the key list shows when and from which IP each key was last used.
Keys are exempt from the organization's two-factor requirement, and a key acts in the organization it was created in. To automate several organizations, create one key in each.
## Requests and responses [#requests-and-responses]
- Bodies are JSON. Send `content-type: application/json` with every `POST`, `PUT` and `PATCH`.
- IDs are prefixed strings: `prj_` for projects, `env_` for environments, `svc_` for services, `dep_` for deployments.
- Timestamps are ISO 8601 strings.
- `PATCH` takes any subset of the fields, but at least one. A field you send replaces the stored value: `spec` is replaced whole, not merged.
- Request bodies are limited to 128 MB, except object storage uploads and database restores, which stream.
### Lists and pagination [#lists-and-pagination]
Most list routes return a plain JSON array with every item the key can see, for example `GET /api/projects`. Two kinds of routes page:
- `GET /api/services/{id}/deployments` returns the newest deployments first and takes `?limit=` (1 to 100, default 20).
- `GET /api/audit-log` is cursor-paginated: pass the cursor from the previous page as `?cursor=` to read the next one.
### Errors [#errors]
Every error has the same shape:
```json
{
"error": {
"code": "validation_failed",
"message": "request validation failed",
"details": [
{ "path": ["spec", "replicas"], "message": "Too small: expected number to be >=0" }
]
}
}
```
| HTTP | `code` | Meaning |
| --- | --- | --- |
| 400 | `bad_request` | The request is malformed or not allowed in this state. `message` says why. |
| 400 | `validation_failed` | The body, query or path failed validation. `details` lists each issue with its path. |
| 401 | `unauthorized` | No key, or the key is invalid, revoked or expired. |
| 403 | `forbidden` | The key is valid but may not do this action on this resource. |
| 403 | `two_factor_required` | A signed-in user must set up a second factor first. Keys never get this. |
| 404 | `not_found` | The resource does not exist, or is in another organization. |
| 409 | `conflict` | A unique name is taken, or the resource is busy (for example a node being removed). |
| 413 | `bad_request` | The body is larger than 128 MB. |
| 422 | `unprocessable` | The request is valid but cannot be done, for example a variable named `LOGISTACK_*`, which is reserved. |
| 500 | `internal` | A server error. The server log has the details under the request's ID. |
## Examples [#examples]
Each example is a complete command. Pipe the output through `jq` to read it.
### Check the key [#check-the-key]
`GET /api/me` returns the user or service account behind the key and its organization:
```sh
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/me" | jq
```
### List projects [#list-projects]
```sh
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" "$LOGISTACK_URL/api/projects" | jq
```
```json title="Response (abridged)"
[
{
"id": "prj_k3v9x2m4q8w1",
"name": "Storefront",
"slug": "storefront",
"description": null,
"folderId": null,
"archivedAt": null,
"environments": [
{ "id": "env_p7d2c9a1r5t3", "name": "Production", "kind": "production", "color": null },
{ "id": "env_b4n8s6e2u0y7", "name": "Staging", "kind": "staging", "color": "amber" }
],
"services": [
{ "id": "svc_m2h5j8k1l4z9", "name": "API", "status": "running", "environmentId": "env_p7d2c9a1r5t3" }
]
}
]
```
Add `?archived=true` to list archived projects instead, or `?folderId=` to list one folder's projects.
### Create a project [#create-a-project]
A new project gets a **Production** environment automatically:
```sh
curl -fsS -X POST "$LOGISTACK_URL/api/projects" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
-d '{"name": "Storefront", "description": "Shop frontend and API"}' | jq
```
List its environments to get the production environment's ID:
```sh
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/projects/prj_k3v9x2m4q8w1/environments" | jq '.[] | {id, name, kind}'
```
### Create a service [#create-a-service]
Services are created in an environment with `POST /api/environments/{id}/services`. The `spec` is the same object the dashboard builds. This one runs a prebuilt image:
```sh
curl -fsS -X POST "$LOGISTACK_URL/api/environments/env_p7d2c9a1r5t3/services" \
-H "x-api-key: $LOGISTACK_API_KEY" -H "content-type: application/json" \
-d @- <<'JSON' | jq
{
"name": "API",
"spec": {
"kind": "application",
"source": { "type": "image", "image": "ghcr.io/acme/api:1.4.2" },
"build": { "type": "image" },
"ports": [],
"replicas": 2,
"resources": { "cpu": 0.5, "memoryMb": 512 },
"healthcheck": { "type": "http", "port": 8080, "path": "/healthz" },
"placement": []
}
}
JSON
```
To build from a repository instead, use a git source and a build type. `gitProviderId` is the ID of a connected [Git provider](../deploy/from-git.mdx) (list them with `GET /api/git-providers`):
```json title="spec for a git service"
{
"kind": "application",
"source": {
"type": "git",
"gitProviderId": "git_r8f3w6t1y9u2",
"repository": "acme/storefront",
"branch": "main",
"path": "/"
},
"build": { "type": "dockerfile", "dockerfilePath": "Dockerfile", "context": "." },
"ports": [],
"replicas": 1,
"resources": {},
"placement": []
}
```
`build.type` is `dockerfile`, `railpack`, `static` (with `publishDir`) or, only with an image source, `image`. The response is the created service with its `id`. Creating a service does not deploy it.
### Trigger a deploy [#trigger-a-deploy]
```sh
curl -fsS -X POST -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/services/svc_m2h5j8k1l4z9/deploy" | jq
```
The response is `202 Accepted` with the queued deployment. Its `trigger` is `api` when a key calls it:
```json
{
"id": "dep_w5q2e8r4t1y6",
"serviceId": "svc_m2h5j8k1l4z9",
"status": "queued",
"trigger": "api",
"commitSha": null,
"imageRef": null,
"error": null,
"createdAt": "2026-11-06T09:14:03.512Z"
}
```
The key needs the `deploy` permission on the service. A deploy into an archived project is refused.
### Read a deployment [#read-a-deployment]
```sh
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/deployments/dep_w5q2e8r4t1y6" | jq '{status, imageRef, commitSha, error, finishedAt}'
```
`status` moves through `queued`, `cloning`, `building`, `pushing` (git builds only), `releasing`, `deploying`, and ends at `healthy`, `failed`, `cancelled`, `superseded` or `skipped`. `awaiting_checks` means the deployment waits for the commit's CI checks. On failure, `error` says why.
To wait for the result in a script, poll until the status is final:
```sh title="wait-for-deploy.sh"
dep=dep_w5q2e8r4t1y6
while :; do
status=$(curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/deployments/$dep" | jq -r .status)
echo "status: $status"
case $status in
healthy) exit 0 ;;
failed|cancelled|superseded|skipped) exit 1 ;;
esac
sleep 5
done
```
List a service's recent deployments:
```sh
curl -fsS -H "x-api-key: $LOGISTACK_API_KEY" \
"$LOGISTACK_URL/api/services/svc_m2h5j8k1l4z9/deployments?limit=5" | jq '.[] | {id, status, trigger, createdAt}'
```
### Roll back, restart and cancel [#roll-back-restart-and-cancel]
| Action | Route |
| --- | --- |
| Roll back to a previous deployment's image | `POST /api/deployments/{id}/rollback` |
| Cancel a running deployment | `POST /api/deployments/{id}/cancel` |
| Restart a service's tasks | `POST /api/services/{id}/restart` |
| See what a deploy would change | `GET /api/services/{id}/pending-diff` |
## Common problems [#common-problems]
- **401 with a key you just created.** Check the header name and that the whole key, starting with `lsk_`, is sent. An expired or revoked key also returns 401.
- **403 on a deploy.** The key's owner or its scopes lack `deploy` on that service. A viewer key can read but not deploy.
- **404 for an ID you can see in the dashboard.** The key belongs to another organization, or its scopes do not include that resource.
- **CORS errors from a browser app.** The API only allows the dashboard's own origin. Call it from a server or a CI job.
# Back up to SFTP, WebDAV, Azure, Google Drive or a disk
URL: https://stack.logicaltech.it/docs/data/backup-destinations/
Send database and volume backups to an SFTP server, a WebDAV share, Azure Blob Storage, Google Drive, Backblaze B2's native API or a folder on a node.
Backups don't have to go to S3. A backup destination can also be a NAS or storage box over SFTP, a Nextcloud or other WebDAV share, an Azure Blob Storage container, a Google Drive folder, a Backblaze B2 bucket through B2's own API, or a folder on one of your nodes. Backup policies, retention, verify restores and restores work the same on every kind. Use this page when your off-site storage isn't an S3 bucket; for buckets, see [Add an S3 destination](./s3-destinations.mdx).
## How it works [#how-it-works]
- SFTP, WebDAV, Azure Blob, Google Drive and B2 go through [rclone](https://rclone.org), which ships in the LogiStack images. LogiStack hands rclone its settings through environment variables only: nothing is written to disk and no secret appears on a command line.
- A folder on a node is reached through that node's agent. The bytes stream between the database's node and the folder's node; they never land on the control plane's disk.
- Backups stream in both directions. LogiStack holds a bounded window of a backup in memory (tens of megabytes at most), however large the backup and however slow the destination.
- Every destination is tested before it's saved: LogiStack writes a probe file, reads it back and deletes it.
## Before you start [#before-you-start]
- Only organization admins can add destinations.
- Create the place backups go first: the folder on the server or share, the Azure container, the B2 bucket, or the folder on the node. LogiStack doesn't create it for you.
- Use an account that reaches this place and nothing else.
## Add a destination [#add-a-destination]
### Open Backup destinations [#open-backup-destinations]
In the sidebar, under **Integrations**, select **Backup destinations**, then **Add destination**.
### Pick the kind [#pick-the-kind]
In **Where should backups go?**, under **Servers, drives and disks**, pick **SFTP**, **WebDAV**, **Azure Blob Storage**, **Google Drive**, **Backblaze B2 native** or **Folder on a node**. Select **Continue**.

### Say where backups go [#say-where-backups-go]
Fill in **Location** for the kind you picked. The fields are listed under [Kinds](#kinds). Backups land under `/backups//`.
### Sign in [#sign-in]
In **Sign-in**, enter the password, key or token for the kind. Secrets are encrypted at rest and never shown again. **Folder on a node** has no sign-in step.
### Test the destination [#test-the-destination]
In **Test the destination**, select **Run test**. LogiStack writes `.logistack-probe-…` at the destination's root, reads it back and deletes it. A pass means it can write, read and delete there: the three things backups, restores and retention do. Nothing is saved until the test passes.
### Name and save [#name-and-save]
In **Name and review**, keep the suggested **Name** (such as `SFTP · nas.example.com`) or type your own, check the summary and select **Add destination**.
## Kinds [#kinds]
| Field | Example |
| --- | --- |
| Host | `nas.example.com` |
| Port | `22` |
| User | `backup` |
| Folder | `/volume1/backups`, or a path relative to the user's home |
| Sign in with | **Password**, or **Private key** (an unencrypted PEM key) |
For a private key, add its public half to the user's `~/.ssh/authorized_keys` on the server. Chrooted SFTP-only accounts work: LogiStack doesn't run shell commands on the server.
| Field | Example |
| --- | --- |
| WebDAV URL | `https://cloud.example.com/remote.php/dav/files/backup` |
| Server | **Nextcloud**, **ownCloud** or **Other** |
| Folder | `LogiStack` |
| User, Password | optional, for shares that ask for them |
On Nextcloud, create an app password under **Settings** > **Security** > **Devices & sessions** instead of using the account password.
| Field | Example |
| --- | --- |
| Storage account | `acmebackups` |
| Container | `logistack` |
| Folder | `prod` |
| Access key | **key1** from the storage account |
The key is under **Security + networking** > **Access keys** in the storage account.
| Field | Example |
| --- | --- |
| Root folder ID | optional: the last part of the folder's URL |
| Folder | `LogiStack` |
| Sign in with | **Your Google account** or **Service account** |
For **Your Google account**, run `rclone authorize "drive"` on a computer with a browser, sign in, and paste the JSON it prints into **Token**. For **Service account**, paste the account's JSON key and share the folder or Shared Drive with the service account's email; set **Root folder ID** to that folder.
| Field | Example |
| --- | --- |
| Bucket | `acme-backups` |
| Folder | `logistack` |
| keyID, applicationKey | from **Application Keys** > **Add a New Application Key** |
Allow **Read and Write** on this bucket only. Retention deletes old backups for real rather than hiding them as old versions, so they stop counting toward your storage. Keys with S3 access can use the [S3 destination](./s3-destinations.mdx) for B2 instead.
| Field | Example |
| --- | --- |
| Node | `fra-4-data` |
| Folder on the node | `/mnt/backups` |
The folder must already exist on that node and survive a reboot: a mounted disk, not `/tmp`. Backups written here are lost with the node, so keep an off-site destination too.
A folder on a node is not an off-site backup. Pair it with a policy that writes to another provider or region.
## Check it worked [#check-it-worked]
The destination shows under **Destinations** with its kind and location, such as `sftp://backup@nas.example.com:22/volume1/backups`, and **Not used yet**. Pick it in a [backup policy](./backups.mdx), select **Run now**, and check that a file appears under `backups//` in the folder.
## Remove a destination [#remove-a-destination]
Select the trash icon on its row, then **Remove destination**. LogiStack forgets the credentials; backups already written stay where they are. A destination still used by a policy can't be removed.
## Troubleshooting [#troubleshooting]
- **Host not allowed**: the SFTP or WebDAV host resolves to a private address, or a WebDAV URL uses `http://`. An instance owner can allow private hosts in **Settings**.
- The SFTP test fails with `unable to authenticate`: check the user and password, or that the public key is in `authorized_keys`.
- The WebDAV test fails on a Nextcloud server: check that the URL is the WebDAV endpoint, ending in `/remote.php/dav/files/`, not the web interface's address.
- The Google Drive test fails after it once passed: the token was revoked. Run `rclone authorize "drive"` again and add the destination with the new token.
- The node folder test fails and the detail mentions the bind source path: create the folder on that node first.
# Back up a database or volume
URL: https://stack.logicaltech.it/docs/data/backups/
Create a backup policy that dumps a database or archives a volume to S3, SFTP or another destination on a cron, with retention, encryption and verifies.
A backup policy copies one thing from a service to a backup destination on a schedule: a dump of the database, or an archive of one volume. It deletes old copies by your retention rules, can encrypt every backup before it leaves the server, and can test the newest backup on its own schedule. Set one up on every service whose data you can't rebuild, before you go to production.
## Before you start [#before-you-start]
- Add at least one destination: an [S3 bucket](./s3-destinations.mdx), or an [SFTP server, WebDAV share, Azure container, Google Drive folder, B2 bucket or node folder](./backup-destinations.mdx). Pick a destination that doesn't live on the same server: a backup on the machine you lose doesn't help.
- You need write access to the service.
## What a policy backs up [#what-a-policy-backs-up]
| Target | What is written | File |
| --- | --- | --- |
| PostgreSQL database | `pg_dump` in custom format, compressed | `.dump` |
| MySQL database | `mysqldump --single-transaction`, all databases | `.sql` |
| MariaDB database | `mariadb-dump --single-transaction`, all databases | `.sql` |
| MongoDB database | `mongodump --archive` | `.archive` |
| Redis database | an RDB snapshot | `.rdb` |
| libSQL database | an SQL dump from sqld | `.sql` |
| A volume | the volume's files as a compressed tar | `.tar.zst` |
A dump is small and restores anywhere. A volume archive is a byte-for-byte copy of the files. Each policy covers one target; add a second policy for a volume, or for another volume.
Backups are written to `//backups//-.`, with `.age` added when encryption is on. For example:
```text
acme-backups/logistack/backups/bkp_7f3a/2026-11-06T03-00-00-000Z-bkr_91c2.dump.age
```
## Create a backup policy [#create-a-backup-policy]
### Open the Backups tab [#open-the-backups-tab]
Open the service and select **Backups**. On a service without backups, select **Set up backups**. Otherwise select **Add policy**.
### Choose what to back up [#choose-what-to-back-up]
In **What to back up**, pick the database (marked **Recommended**) or one of the volumes. Select **Continue**.

### Choose where it goes [#choose-where-it-goes]
In **Where it goes**, pick a destination. If there is none, select **Add a destination**; the wizard keeps your answers, so come back when it's saved.
### Set the schedule [#set-the-schedule]
In **When it runs**, set when it runs, and the **Time zone**. Use the **Simple** editor (**Minutes**, **Hourly**, **Daily**, **Weekly**, **Monthly**) or switch to **Cron** and type an expression. The default is `0 3 * * *`, every day at 03:00. The **Next 5 runs** preview shows when it fires in the chosen zone.
### Set retention [#set-retention]
In **How long to keep them**, fill in **Keep the newest** (default 14) backups, **Delete after** a number of days, or both. Retention runs after every backup.
### Test restores (databases) [#test-restores-databases]
In **Test restores**, keep **Verify on a schedule** on and set when it runs. The default is `0 5 * * 0`, Sundays at 05:00. A verify restores the newest backup into a throwaway container and runs a sanity query; the live database is never touched.
### Choose consistency (volumes) [#choose-consistency-volumes]
For a volume, **Consistency** offers **Stop <service> while archiving**. The service is scaled to zero for the copy, then back. Turn it on when the service writes to the volume all the time, such as SQLite or a file-based queue.
### Choose encryption [#choose-encryption]
In **Encryption**, keep **Encrypt before upload** on. Each backup is encrypted with age on the server, so the bucket only ever holds ciphertext.
### Review and start [#review-and-start]
Check the summary and select **Start backing up**. With encryption on, the next page is **Save the backup key**. Select **Download key file** or copy the key, store it outside the server (a password manager works), then select **I've saved the key**.
The backup key is shown once. LogiStack keeps a sealed copy to restore, but if the server is lost, the key is the only way to read your backups. Lose both and the backups are gone. Encryption can't be turned off later.
## How retention works [#how-retention-works]
A backup is kept if either rule keeps it. With **Keep the newest** `14` and **Delete after** `30` days, the policy keeps the 14 newest backups plus any backup up to 30 days old. With only a count, it keeps exactly that many. Deleted backups show **Pruned by retention** in the run history and can't be restored.
Some providers bill deleted objects for a minimum period (Wasabi bills 90 days), so short retention there costs the same as the minimum.
## Read the Backups tab [#read-the-backups-tab]

Each policy under **Policies** shows:
- Its title, such as **Database dump (pg_dump)** or **Volume /var/lib/postgresql/data**, the schedule in words, the time zone and the destination.
- **Next run**, **Retention**, **Verify** (databases) or **While archiving** (volumes), and **Last run**.
- **Encrypted with age** with a **Decrypt without LogiStack** section, or **Stored unencrypted in the bucket** with an **Encrypt backups** link.
**Recent runs** lists backups, verifies and restores, newest first, with their **Status**, **Size**, how long they **Took** and the **SHA-256** checksum of the file. A running backup shows its phase and bytes so far. Finished backups that retention still keeps have a **Restore** button. See [Restore a backup](./restore.mdx).
## Run a backup now [#run-a-backup-now]
Select **Run now** on a policy. The run appears under **Recent runs** and writes to the policy's destination. Select **Verify now** on a database policy to test the newest backup right away.
## Pause, resume or delete a policy [#pause-resume-or-delete-a-policy]
- Use the switch on a policy to pause it. **Next run** then shows **Paused**. Turn it back on to resume.
- Select the trash icon to delete a policy. The policy and its run history are removed. Backups already in the bucket stay there and can be restored by hand.
## Turn on encryption later [#turn-on-encryption-later]
On an unencrypted policy, select **Encrypt backups**, then **Encrypt and show the key**. Backups from then on are encrypted; earlier ones stay as they are and still restore. Save the key as described above.
If you turned encryption on but didn't save the key, and no encrypted backup exists yet, select **Generate a new key** under **Encrypted with age**. The old key stops working. Once an encrypted backup exists, the key can't be replaced or removed.
## Decrypt a backup without LogiStack [#decrypt-a-backup-without-logistack]
Under **Encrypted with age**, open **Decrypt without LogiStack**. It shows a ready command for the newest backup, built from the destination's bucket, prefix and endpoint:
```bash title="Decrypt the newest backup"
aws s3 cp "s3://acme-backups/logistack/backups/bkp_7f3a/2026-11-06T03-00-00-000Z-bkr_91c2.dump.age" - \
--endpoint-url https://7c2f9e0a41b84d0f.r2.cloudflarestorage.com \
| age -d -i backup-key.txt > "2026-11-06T03-00-00-000Z-bkr_91c2.dump"
```
Save the key as `backup-key.txt`, and run the command with the [age](https://age-encryption.org) CLI and the AWS CLI. For a destination that isn't S3, copy the `.age` file off it first (with `scp`, the share or the Drive web page); the command is then `age -d -i backup-key.txt < .age > `. See [Restore a backup](./restore.mdx#decrypt-and-restore-a-backup-by-hand) for the rest.
## Alerts [#alerts]
Failed backups and failed verifies are sent to the channels whose rules include them. See [Alerts and notifications](../operations/alerts-and-notifications.mdx).
## Troubleshooting [#troubleshooting]
- **No backup destination yet** in the wizard: add one first under **Backup destinations** ([S3](./s3-destinations.mdx) or [other kinds](./backup-destinations.mdx)).
- A run fails with an access error: the destination's keys lost a permission. Backups need put, get, delete and list on the bucket. Run the destination's test again.
- A volume backup of a busy service restores with half-written files: turn on **Stop <service> while archiving**, or back up the database with a dump instead.
- A backup you want is missing: check the run's status for **Pruned by retention**, and raise **Keep the newest**.
# Browse and edit a database
URL: https://stack.logicaltech.it/docs/data/database-editor/
Use the Database tab to browse tables, filter and edit rows, run SQL, view the schema diagram, manage roles, dump and restore, and edit Redis keys or MongoDB documents.
Every database service has a **Database** tab: an explorer built into the dashboard. Use it to look at data, fix a row, run a query, create a role for a new app, or take a dump, without installing a client or opening a port. It works with PostgreSQL, MySQL, MariaDB and libSQL tables, MongoDB collections and Redis keys. Every operation goes through LogiStack's permission checks, and writes are recorded in the [audit log](../team/audit-log.mdx).

## Open the explorer [#open-the-explorer]
### Open the service [#open-the-service]
Open the project, then select the database service.
### Select the Database tab [#select-the-database-tab]
Select **Database**. For SQL engines the explorer opens on **Data**, with the views **Data**, **Diagram**, **SQL** and **Roles** at the top. libSQL has no **Roles** view. MongoDB shows collections and documents. Redis shows **Keys** and **Command**.
Select the expand icon at the top right to show the explorer full screen. Press **Esc** to leave.
Each organization's databases share a private network that only they and the explorer join, so a database of another organization can't reach yours. A database deployed before the explorer existed isn't on it yet. The tab then shows **Redeploy to open the explorer**. Select **Redeploy**. The data stays on its volume, and the explorer connects as soon as the new deployment is healthy. Databases that were already running on the older shared network move to their organization's network on their next deploy, never on their own.
## Browse tables [#browse-tables]
The left panel is the schema tree. It lists every schema with its tables, views, materialized views and foreign tables, plus groups for **Enums**, **Sequences** and **Functions**. The number next to each table is its approximate row count.
- Type in **Filter tables** to narrow the tree.
- Use the database picker at the top of the tree to switch database on a PostgreSQL, MySQL or MariaDB instance. The **+** button next to it creates a database.
- Open a schema's menu to create a **Table…**, **View**, **Enum** or **Function** in it. A table's menu has **Copy name** and **Drop table…**.
- The tree works with the keyboard: arrow keys move, **Enter** opens, **Delete** drops the selected object after a confirmation.
### Create a table [#create-a-table]
### Start a new table [#start-a-new-table]
Open the schema's menu and select **Table…**, or select **Create table** when the database is empty.
### Name the table and its columns [#name-the-table-and-its-columns]
Enter a **Table name**, such as `orders`. For each column set **Name**, **Type**, **Default**, whether it can be **Null** and whether it is part of the primary **Key**. Select **Add column** for more.
### Review the statement [#review-the-statement]
Select **Review**. The dialog shows the exact `CREATE TABLE` statement that runs. Select **Create table**.
## Read and edit rows [#read-and-edit-rows]
Select a table to open its rows in the grid. Rows load as you scroll. The header shows `schema.table` and the approximate row count.
### Sort and filter [#sort-and-filter]
- Select a column header to sort by it. **Shift**-click another header to add a second sort.
- Select **Filter**, pick a column and an operator, enter a **Value**, then select **Add filter**. Operators are `=`, `≠`, `<`, `>`, `≤`, `≥`, **contains**, **starts with**, **is null** and **is not null**.
- Filters show as chips above the grid. Remove one with its **×**, or select **Clear filters**.
Sort and filters are part of the page URL, so you can bookmark or share a filtered view. For example, `country = IT` and `created_at > 2026-10-01` on `public.customers`.
### Edit, add and delete rows [#edit-add-and-delete-rows]
### Stage your changes [#stage-your-changes]
Double-click a cell, or move to it and press **Enter** or **F2**, to edit it. **Enter** keeps the value, **Tab** keeps it and moves right, **Esc** drops it. Nullable columns offer a Null value. Select **Add row** for a new row. Select rows with their checkboxes and select **Delete** to mark them for deletion.
### Save in one transaction [#save-in-one-transaction]
The footer counts the unsaved changes. Select **Save changes** to apply them all in one transaction, or **Discard** to drop them. When the batch deletes rows, LogiStack asks you to confirm with **Save and delete**.
If someone else changed or deleted one of your rows since you loaded it, nothing is saved. Select **Reload rows** to see the current data; your edits stay staged.
A table without a primary key is read-only, because a single row can't be addressed. Views are read-only too.
### Generate test rows [#generate-test-rows]
Select **Generate** above a table to fill it with fake rows. Choose how many **Rows**, a **Locale**, and a generator for each column (LogiStack suggests one from the column's name and type, such as Email or City). Preview, then insert.
## Run SQL [#run-sql]
Select **SQL** to open the editor. It completes table and column names for the engine's dialect.
1. Write one or more statements.
2. Press **Cmd+Enter** (**Ctrl+Enter** on Windows and Linux), or select **Run**, to run the selection or the statement at the cursor.
3. Press **Shift+Cmd+Enter**, or select **Run all**, to run the whole script.
```sql title="Find the best customers this month"
select c.email, count(*) as orders, sum(o.total_cents) / 100.0 as revenue
from public.orders o
join public.customers c on c.id = o.customer_id
where o.created_at >= date_trunc('month', now())
group by c.email
order by revenue desc
limit 20;
```
Results appear below, one tab per statement, with typed columns. Copy a result as **CSV** or **JSON**.
- **Read only** is on by default. Statements then run in a read-only transaction. Turn it off to let writes commit; the toggle then reads **Writes commit**.
- Each run is one transaction, stops after 30 seconds and returns up to 1,000 rows per statement.
- Select **Cancel** to stop a long query.
- On an instance with several databases, the editor shows which database the run goes to.
## View the schema diagram [#view-the-schema-diagram]
Select **Diagram** to see the tables and the foreign keys between them. Pick one schema or **All schemas**, use **Zoom in**, **Zoom out** and **Fit to view**, and select a table to open its rows.
## Manage roles [#manage-roles]
Select **Roles** to list PostgreSQL roles, or MySQL and MariaDB accounts. Select a role to edit it:
- **Can log in**, **Create databases**, **Create roles** and **Superuser** for PostgreSQL.
- Group membership, with **Add to role…**.
- Access per schema: no access, read, or read and write on every table. Select **Review SQL** to see the statements before you save.
- Set a new password. LogiStack generates one and doesn't store it, so copy it before you close the dialog.
- Drop the role, after typing its name.
The role the explorer itself signs in as is marked. Its password lives in the service's environment.
### Create a role for an app [#create-a-role-for-an-app]
### Start the wizard [#start-the-wizard]
In **Roles**, select **+** (**New role**).
### Name the role [#name-the-role]
Enter a **Name**, such as `storefront_web`. For PostgreSQL pick **Login role** (signs in with a password) or **Group role** (others inherit its privileges). For MySQL and MariaDB set the **Host**; `%` allows any host and is usually right, because services reach the database over its private network.
### Set the password and access [#set-the-password-and-access]
Copy the generated **Password**. Then choose the access for each schema.
### Review and create [#review-and-create]
Check the summary and select **Create role** (or **Create account**).
## Dump and restore [#dump-and-restore]
Use the **Dump & restore** menu at the top right.
**Download dump** streams a full dump straight to your downloads:
| Engine | File | Tool |
| --- | --- | --- |
| PostgreSQL | `.dump` | `pg_dump` custom format |
| MySQL | `.sql` | `mysqldump`, all databases |
| MariaDB | `.sql` | `mariadb-dump`, all databases |
| MongoDB | `.archive` | `mongodump` archive |
| Redis | `.rdb` | RDB snapshot |
| libSQL | `.sql` | SQL dump from sqld |
**Restore from file…** replaces everything the database holds with a dump file:
### Download a dump first [#download-a-dump-first]
Select **Download dump**, so you can go back if the restore isn't what you wanted.
### Choose the file [#choose-the-file]
Select **Restore from file…**, then **Choose a dump file**.
### Confirm [#confirm]
Type the service name, for example `postgres`, and start the restore. The dialog shows the upload, then the restore tool's progress.
A restore from file can't be undone. Redis and libSQL dumps can't be restored here; restore them from a [volume backup](./restore.mdx). The file can be up to 20 GiB; the instance owner changes the limit with `MAX_RESTORE_BYTES` on the api. The upload streams straight into the restore tool, so nothing is buffered in between.
## Add a sample dataset [#add-a-sample-dataset]
On PostgreSQL, MySQL, MariaDB and libSQL, select **Sample dataset** to create demo tables filled with realistic fake data, foreign keys included. Pick a **Dataset** (**Users**, **E-commerce**, **Blog**, **Projects and tasks** or **Analytics events**), a **Table prefix** such as `demo_`, and a **Size** (**Small**, **Normal** or **Large**), then select **Create dataset**. Use it to try queries or a new app without touching real data.
## Browse Redis keys [#browse-redis-keys]

1. Pick the logical database, such as `db0`.
2. Type a pattern, such as `session:*` or `cart:*`, and select **Scan**.
3. Select a key. Its value opens on the right, paged by type: strings, hashes, lists, sets, sorted sets and streams.
From the key view you can edit the value, set or remove fields and members, rename the key, set an expiry in seconds, or delete it. Streams are read-only here. Binary values show as base64 and are read-only.
Select **Command** to run one Redis command against the current database, such as `HGETALL session:42`. Reads and key writes are allowed; `FLUSHALL`, `CONFIG`, `KEYS`, `EVAL` and other server commands are refused.
## Browse MongoDB documents [#browse-mongodb-documents]
Select a collection to list its documents as Extended JSON. Use the find bar to query:
| Field | Example |
| --- | --- |
| **Filter** | `{ "status": "paid" }` |
| **Sort** | `{ "_id": -1 }` |
| **Fields** | `{ "name": 1 }` |
Select **Find** to run it and **Reset** to clear it. `$where`, `$function` and `$accumulator` are not allowed.
Select **Insert** to add a document, or the edit icon on a document to replace it. Saving replaces the whole document, so clear **Fields** before you edit. Views are read-only.
## Permissions [#permissions]
What you can do depends on your role on the service. See [Roles and permissions](../team/roles-and-permissions.mdx).
| Action | Permission |
| --- | --- |
| Browse schema, rows, documents and keys | `read` |
| Edit rows, documents and keys; create a database | `write` |
| Run SQL or a Redis command, read-only included | `write` |
| Download a dump | `read:secrets` |
| Restore from a file, create roles, set passwords, drop a database | `admin` |
With read access only, the grid and editors are read-only and say so. SQL writes, row changes and restores appear in the audit log; a SQL write records the statement text.
## Troubleshooting [#troubleshooting]
- **Couldn't read the schema**: the service may be starting or unhealthy. Check its status and [logs](../operations/logs-and-terminal.mdx).
- **Redeploy to open the explorer**: the database predates the explorer. Redeploy it once.
- **Roles aren't readable** on MySQL: the explorer's login needs `SELECT` on `mysql.user`.
- A query stops after 30 seconds. Run long maintenance from a [schedule](./schedules.mdx) instead.
# Expose, forward and upgrade a database
URL: https://stack.logicaltech.it/docs/data/database-operations/
Open a database to the internet with TLS and an IP allowlist, give a local tool a temporary port forward, or upgrade to a new major version with automatic rollback.
A database service is reachable only from the services in its environment. The **Operations** tab of a database service changes that when you need to: it exposes the database on a hostname with a certificate, opens a temporary port for a tool on your laptop, and upgrades the engine to a new major version. Each task is a guided wizard. All three need the `admin` permission on the service.

## How connections from outside work [#how-connections-from-outside-work]
A small gateway service runs on the database's node and holds the public port. It drops every connection whose source address is not on the allowlist, and every connection that does not start by asking for TLS. The database itself serves TLS with a certificate that Caddy issues for your hostname, beside its usual plain port, so your apps keep connecting as before.
Public access and port forwards work for PostgreSQL, MySQL, MariaDB, MongoDB and Redis. libSQL has no TLS of its own and can't be exposed.
## Expose a database publicly [#expose-a-database-publicly]
### Point a hostname at the database's node [#point-a-hostname-at-the-databases-node]
Create a DNS record, such as `db.example.com`, that resolves to the public address of the node the database runs on. The gateway binds the port on that node only.
### Open the wizard [#open-the-wizard]
Open the database service, select **Operations**, then **Expose publicly**.
### Set the address [#set-the-address]
Enter the **Hostname** and the **Port**, for example `db.example.com` and `5432`. The port must be 1024 or higher and free on that node.

### Choose who can connect [#choose-who-can-connect]
Under **Allowed addresses**, enter one address or CIDR range per line, such as `203.0.113.7` or `198.51.100.0/24`. The wizard fills in the address you are connecting from. Connections from anywhere else are dropped before they reach the database.
### Review and expose [#review-and-expose]
Check the summary and select **Expose**.
The row under **Public access** shows **Waiting for certificate** until Caddy has issued it. The database then restarts once to load the certificate, and the row turns **Open**. Copy the connection string from the row. It includes the engine's TLS parameter, with `PASSWORD` in place of the password:
```text
postgres://postgres:PASSWORD@db.example.com:5432/orders?sslmode=verify-full
```
| Engine | TLS parameter |
| --- | --- |
| PostgreSQL | `sslmode=verify-full` |
| MySQL, MariaDB | `ssl-mode=VERIFY_IDENTITY` |
| MongoDB | `tls=true` |
| Redis | the `rediss://` scheme |
Expose a database to `0.0.0.0/0` only if you must: anyone can then try passwords against the port. The wizard warns you when the allowlist is open to the whole internet.
To change the hostname, port or allowlist, select **Change**. To close the port, select **Close** on the row. Clients connected through it are cut off; services in the environment are not affected.
### Renewals [#renewals]
Caddy renews the certificate before it expires. When a new one is ready, LogiStack redeploys the database to load it, which restarts it once, about every 60 days.
## Open a temporary port forward [#open-a-temporary-port-forward]
A port forward gives a local tool, such as `psql`, TablePlus or MongoDB Compass, a port that is open to your address only and closes on its own.
### Open the wizard [#open-the-wizard-1]
Select **Operations**, then **Open a port forward**.
### Choose how long [#choose-how-long]
Pick **15 minutes**, **1 hour**, **4 hours** or **8 hours**.
### Choose who can connect [#choose-who-can-connect-1]
The wizard fills in your address. Add up to 10 addresses or ranges.
### Open the port [#open-the-port]
Select **Open port**. LogiStack picks a free port between 15000 and 15999 on the database's node.
The forward appears under **Port forwards** with the time left and a connection string to the node's address. At the deadline the gateway closes the port and drops anything still connected. Select **Close** to end it sooner.
A forward requires TLS when the database has public access, because the database then serves a certificate. Without public access the forward is plain, and the review step says so. The connection string uses `sslmode=require` rather than `verify-full`, because the node's address is not the name on the certificate.
## Upgrade to a new major version [#upgrade-to-a-new-major-version]
The upgrade assistant moves a PostgreSQL, MySQL, MariaDB or MongoDB service to a new major version, such as PostgreSQL 16 to 17. It never writes to the old data, so it can always go back.
1. A new instance on the target version starts on its own volume, on the same node.
2. Every database is copied into it. PostgreSQL copies the whole instance with `pg_dumpall`, so roles come along.
3. The exact row count of every table (documents per collection on MongoDB) must match the original.
4. The service switches to the new version and the new volume, and restarts once.
5. The counts are checked again on the running service.
If a check fails or the new version doesn't start after the switch, the service goes back to the old version and the old volume on its own, and the upgrade shows **Rolled back**. A failure before the switch leaves the database untouched.
### Stop writes [#stop-writes]
Scale the apps that write to the database to zero, or put them in maintenance mode. Writes made after the copy starts are not carried over.
### Open the wizard [#open-the-wizard-2]
Select **Operations**, then **Upgrade**.
### Pick the version [#pick-the-version]
Enter the **Target version**, the tag of the engine's official image, or pick a suggestion such as `17`. Keep the variant you run: from `16-alpine`, choose `17-alpine`.

### Confirm writes are stopped [#confirm-writes-are-stopped]
Under **Before you start**, check **Nothing writes to the database now**. Make sure the node has room for a second copy of the data.
### Start the upgrade [#start-the-upgrade]
Review the steps and select **Start upgrade**.
Follow the progress under **Version**: **Check**, **New instance**, **Copy**, **Verify**, **Switch** and **Verify again**. When it finishes, the panel shows **Upgraded** and the number of tables verified. Start your apps again.
The old volume stays on the node after a successful upgrade, as a way back. Delete it from the node once you are sure you don't need it.
Redis and libSQL have no upgrade assistant. Take a [volume backup](./backups.mdx) before you upgrade them another way.
## Common problems [#common-problems]
- **Waiting for certificate doesn't end**: the hostname doesn't resolve to the node yet, or Caddy can't complete the ACME challenge. Check the DNS record, or set up a wildcard certificate with DNS validation in the setup wizard.
- **Redeploy the database to move it onto its organization's network**: the database was deployed before organizations got their own database network. Redeploy it from **Deployments**; the gateway starts once it is healthy.
- **The connection is closed right away**: the client is not using TLS, or its address is not on the allowlist. Check the connection string's TLS parameter and the address you connect from.
- **port … is already published on that node**: another service, a game server or another gateway holds the port. Pick another.
- **The upgrade failed at Verify**: the copy didn't match, often because something kept writing. Stop the writers and run it again; the original was never changed.
# Data, backups and storage
URL: https://stack.logicaltech.it/docs/data/
Browse and edit databases, back them up on a cron, restore them, run object storage and scheduled jobs, and manage files in volumes.
This section covers everything that holds state in LogiStack: the databases you run, the backups that protect them, the destinations those backups go to, object storage for your apps, files in volumes, and cron jobs. Read it when you need to look inside a database, set up backups before going to production, or recover from a mistake.
## What each part does [#what-each-part-does]
- The **Database** tab of a database service is a built-in explorer. You browse tables, edit rows, run SQL, manage roles and download or restore a dump without a separate client.
- A **backup policy** dumps a database, or archives a volume, to a backup destination on a cron. It keeps as many copies as you choose and can encrypt them with [age](https://age-encryption.org).
- The **restore wizard** brings a backup back, into the service itself or into a copy beside it.
- **Backup destinations** are where backups go: an S3 bucket (AWS S3, Cloudflare R2, Backblaze B2, Hetzner, MinIO, Wasabi or any S3-compatible store), an SFTP server, a WebDAV share, Azure Blob Storage, Google Drive, B2's native API or a folder on a node.
- **Object storage** services run an S3-compatible server (MinIO, RustFS, Garage or SeaweedFS) in your project, with a file browser, scoped keys and share links.
- The **Files** tab shows a service's config files and volumes, and lets you browse the running container's filesystem.
- **Schedules** run a shell script on a cron, in a fresh container, inside a service or on a node.
## A typical setup [#a-typical-setup]
1. Deploy a database, for example PostgreSQL. See [Databases](../deploy/databases.mdx).
2. Add a destination that lives off the server, such as an [R2 or B2 bucket](./s3-destinations.mdx) or a [storage box over SFTP](./backup-destinations.mdx).
3. Create a [backup policy](./backups.mdx) on the database with encryption on, and save the key somewhere outside the server.
4. Turn on scheduled verifies, so LogiStack restores the newest backup into a throwaway container every week and tells you if it fails.
5. Practice a [restore into a copy](./restore.mdx) once, before you need it.
# Run S3-compatible object storage
URL: https://stack.logicaltech.it/docs/data/object-storage/
Run MinIO, RustFS, Garage or SeaweedFS as a service, then manage buckets, upload files, create share links and give each app a scoped access key.
An object storage service is an S3-compatible server that runs in your project, next to your apps. Use it for user uploads, product images, exports or anything else your app stores as files through the S3 API, when you don't want a cloud bucket. LogiStack creates the root credentials, and its **Storage** tab gives you a file browser, scoped access keys, share links and ready-to-paste connection settings.
## Choose an engine [#choose-an-engine]
| Engine | Good at |
| --- | --- |
| MinIO | Most complete S3 API, web console, versioning and policies |
| RustFS | MinIO-compatible API, web console, permissive license |
| Garage | Tiny memory footprint, scoped keys |
| SeaweedFS | Many small files, versioning and policies, IAM keys |
## Create an object storage service [#create-an-object-storage-service]
### Start a new service [#start-a-new-service]
Open the project and select **New service**. Pick **Object storage**.
### Choose an engine [#choose-an-engine-1]
In **Choose an engine**, pick MinIO, RustFS, Garage or SeaweedFS, and name the service, such as `media`. LogiStack creates the root credentials and keeps them encrypted.
### Decide on public access [#decide-on-public-access]
In **Public access**, choose whether the **S3 endpoint** gets a domain, such as `s3.acme-retail.it`, and whether the **Web console** gets one, such as `console.s3.acme-retail.it` (MinIO and RustFS only). Apps in the same environment always reach the internal endpoint, and buckets start private either way.
### Review and create [#review-and-create]
Check the summary and create the service. LogiStack then opens its **Storage** tab.
## Find all storage [#find-all-storage]
Select **Storage** in the sidebar to see every object storage service in the organization, with its **Engine**, **Project** and **Status**. Select a service to open its **Storage** tab.

The **Storage** tab has three sections: **Browser**, **Access keys** and **Connection**. It shows content once the service reports healthy.
## Create a bucket [#create-a-bucket]
### Open the browser [#open-the-browser]
Open the storage service, select **Storage**, then **Browser**.

### Add the bucket [#add-the-bucket]
Select **+** (**New bucket**). Enter a **Name** of 3 to 63 lowercase letters, digits, dots and dashes, such as `product-images`, and create it.
### Set its options [#set-its-options]
Select the settings icon next to the bucket name:
- **Versioning** keeps every version of an object, so overwrites and deletes can be undone from an S3 client. Not every engine supports it.
- **Public read** lets anyone download any object by its URL. Listing stays private. It takes effect once the S3 endpoint has a public domain.
- Delete the bucket by typing its name to confirm.
## Upload and manage files [#upload-and-manage-files]
- Drop files on the browser, or select **Upload** to pick them. They stream through LogiStack, so the bucket stays private. An upload tray shows each file's progress and lets you cancel.
- Select **New folder** to create a folder. Use a slash in the name to nest folders, such as `2026/11`.
- Select an object to open its details: a preview for images, text and JSON, its **Size**, **Type**, **Modified** time, **ETag** and **S3 URL**.
- Open an object's **…** menu for **Download**, **Share link**, **Rename** and **Delete**. Rename with a slash in the new name to move it into a folder.
- Select several rows with their checkboxes and select **Delete** to remove them at once. Deleting a folder deletes everything inside it. There is no undo.
### Share a file with a link [#share-a-file-with-a-link]
### Open the share dialog [#open-the-share-dialog]
Open the object's **…** menu and select **Share link**.
### Choose the expiry [#choose-the-expiry]
Set **Expires after** to **1 hour**, **1 day** or **7 days**, and select **Create link**.
### Copy the link [#copy-the-link]
Select **Copy share link** and send it. Anyone with the link can download the file until it expires.
When the S3 endpoint has a public domain, the link is signed for it. Without one, the file is served through LogiStack.
## Give an app its own access key [#give-an-app-its-own-access-key]
Give each app its own key, limited to the buckets it needs. Revoking one never affects the others.
### Open Access keys [#open-access-keys]
In the **Storage** tab, select **Access keys**, then **New access key**.
### Scope the key [#scope-the-key]
Enter a **Name** after what uses it, such as `storefront web`. Tick the buckets it may reach, and set **Access** to **Read only** or **Read and write**. Select **Create key**.
### Copy the secret [#copy-the-secret]
Copy the access key ID and the secret access key, or select **Copy environment variables**. The engine keeps the secret and LogiStack doesn't, so it is not shown again. Select **I've saved it**.
The environment variables look like this, ready for the app's [environment](../deploy/environment-variables.mdx):
```bash title=".env"
S3_ENDPOINT=http://media:9000
S3_REGION=us-east-1
S3_BUCKET=product-images
AWS_ACCESS_KEY_ID=LSK8D2F0QX7M
AWS_SECRET_ACCESS_KEY=s8H1pQ...
S3_FORCE_PATH_STYLE=true
```
To revoke a key, select its trash icon, then **Revoke key**. Apps using it get access denied on their next request.
## Connect from an app [#connect-from-an-app]
Select **Connection** to see:
- **Endpoints**: **Internal** (for services in the same environment), **Public** (when the S3 endpoint has a domain), **Console**, **Region** and **Addressing**.
- **Root credentials**: the root access key ID and secret. Use them for administration only.
- **Environment variables**: pick **Same environment** or **Internet** as the **Endpoint**, pick a bucket, and copy the block. It uses the root key; for an app, paste a scoped key's pair instead.
Most S3 SDKs need path-style addressing for these engines, as in this Node.js example:
```ts title="storage.ts"
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
const s3 = new S3Client({
endpoint: process.env.S3_ENDPOINT,
region: process.env.S3_REGION,
forcePathStyle: true,
});
await s3.send(
new PutObjectCommand({
Bucket: process.env.S3_BUCKET,
Key: "products/sku-1042.webp",
Body: image,
ContentType: "image/webp",
}),
);
```
## Use it as a backup destination [#use-it-as-a-backup-destination]
Under **Connection**, **Use as backup destination** turns a bucket into an [S3 destination](./s3-destinations.mdx) in one step. Select **Use for backups**, enter a **Bucket**, and select **Add destination**. LogiStack creates the bucket if it's missing, a read and write key for it, and the destination. Only organization admins can do this.
Backups stored on the same server don't protect you from losing that server. Keep an off-site destination too.
## Troubleshooting [#troubleshooting]
- **The engine isn't running**: the tab waits for the service to report healthy. Check its [logs](../operations/logs-and-terminal.mdx).
- An app gets access denied: the key was revoked, isn't scoped to that bucket, or is read-only and the app writes.
- A public URL returns 403: turn on **Public read** for the bucket, and make sure the S3 endpoint has a domain.
# Restore a database or volume from a backup
URL: https://stack.logicaltech.it/docs/data/restore/
Restore an S3 backup into the service or into a new copy beside it with the restore wizard, or decrypt and restore a backup by hand with age and the AWS CLI.
The restore wizard brings back a backup made by a [backup policy](./backups.mdx). You can restore into a new service beside the original, which is the safe default, or overwrite the original. Use it after a bad migration, an accidental delete, or to check what the data looked like on a given day. When LogiStack itself is gone, you can still decrypt and restore a backup by hand.
## What you can restore [#what-you-can-restore]
- Finished backups that retention hasn't deleted. Running, failed and pruned backups can't be restored.
- Database dumps of PostgreSQL, MySQL, MariaDB and MongoDB. Redis and libSQL dumps come back through a volume backup instead.
- Volume archives of any service.
The wizard lists the 10 newest restorable backups.
## Restore with the wizard [#restore-with-the-wizard]
### Start from a backup [#start-from-a-backup]
Open the service, select **Backups**, and select **Restore** on a row under **Recent runs**. The wizard opens with that backup selected.
### Pick a backup [#pick-a-backup]
In **Pick a backup**, each backup shows its date, size, what it contains (such as **Database dump (pg_dump)** or a volume) and the start of its SHA-256 checksum. Choose one and select **Continue**.

### Choose where it goes [#choose-where-it-goes]
In **Restore into**, pick one:
- **A new service beside it** (marked **Safe**) for a database: same engine, version and credentials as the original, in the same environment. LogiStack deploys it, then restores into it. Enter its **Service name**; the default is `-restore-`, such as `postgres-restore-06-nov`.
- **A new volume** for a volume backup: restored into a fresh volume next to the current one. Enter a **Name for the copy**.
- **Overwrite <service>**: for a database, objects are dropped and recreated from the dump. For a volume, the volume is emptied and filled from the archive. Anything written since the backup is lost.
### Confirm [#confirm]
Read the summary, then type the name shown in **Type <name> to confirm**: the copy's name, or the service's own name when you overwrite. Select **Restore now**.
### Follow the progress [#follow-the-progress]
The page shows each phase, the bytes restored and the time so far. You can leave; the restore keeps going and shows under **Recent runs** as a **Restore** run. When it finishes, select **Open <project>** to find the copy, or **Back to backups**. If it fails, the error is shown, and **Try again** reopens the wizard on the same backup.
Overwriting has no undo. Select **Run now** on the policy first, so the current state is backed up too.
## Check the result [#check-the-result]
- For a copy, open the new service's [Database tab](./database-editor.mdx) and compare it with the original, for example with `select count(*) from orders;` in both.
- When the copy is right, point your app at it, or restore into the original. Then delete the copy: it is billed and backed up like any other service.
## Restore into another service [#restore-into-another-service]
The wizard restores into the original or a new copy. To load a database backup into a different existing service, for example production data into a staging database of the same engine:
1. Get the backup file from the bucket and decrypt it, as shown below.
2. Open the target service, select **Database**, then **Dump & restore** > **Restore from file…**.
3. Choose the file and type the target service's name to confirm.
Backups and the explorer's dumps use the same format, so a `.dump` from a PostgreSQL backup, an `.sql` from MySQL or MariaDB, or an `.archive` from MongoDB restores this way. See [Dump and restore](./database-editor.mdx#dump-and-restore).
## Decrypt and restore a backup by hand [#decrypt-and-restore-a-backup-by-hand]
You need the backup key you saved when you turned on encryption, the [age](https://age-encryption.org) CLI and the AWS CLI configured with keys that can read the bucket. This works with no LogiStack server at all.
### Save the key [#save-the-key]
Save the key as `backup-key.txt`. The file you downloaded with **Download key file** works as is.
### Find the file [#find-the-file]
Backups live under `//backups//`. List them:
```bash
aws s3 ls s3://acme-backups/logistack/backups/bkp_7f3a/ \
--endpoint-url https://7c2f9e0a41b84d0f.r2.cloudflarestorage.com
```
On a policy's **Backups** tab, **Decrypt without LogiStack** shows the exact command for the newest backup.
### Download and decrypt [#download-and-decrypt]
```bash
aws s3 cp "s3://acme-backups/logistack/backups/bkp_7f3a/2026-11-06T03-00-00-000Z-bkr_91c2.dump.age" - \
--endpoint-url https://7c2f9e0a41b84d0f.r2.cloudflarestorage.com \
| age -d -i backup-key.txt > backup.dump
```
Leave out `--endpoint-url` for AWS S3. For an unencrypted backup, drop the `age` step.
### Restore with the engine's tool [#restore-with-the-engines-tool]
```bash
pg_restore --clean --if-exists --no-owner \
-d "postgres://app:secret@db.example.com:5432/storefront" backup.dump
```
```bash
mysql -h db.example.com -u root -p < backup.sql
```
```bash
mongorestore --uri "mongodb://root:secret@db.example.com:27017" --archive=backup.archive
```
```bash
mkdir restored
tar --zstd -xf backup.tar.zst -C restored
```
## Troubleshooting [#troubleshooting]
- **No backup to restore yet**: run a backup first, or wait for the first scheduled one.
- A backup has no **Restore** button: it failed, is still running, or was pruned by retention. Redis and libSQL database dumps also have none; restore their volume backup.
- age reports that no identity matched: the key file belongs to another policy, or the key was replaced before this backup was made.
- The restore fails on a copy: check the copy's [logs](../operations/logs-and-terminal.mdx), then select **Try again**.
# Add an S3 destination for backups
URL: https://stack.logicaltech.it/docs/data/s3-destinations/
Connect an S3-compatible bucket such as AWS S3, Cloudflare R2, Backblaze B2, Hetzner, MinIO or Wasabi, and test the connection before backup policies use it.
An S3 destination is a bucket that backup policies write to. It holds the endpoint, bucket, region, an optional prefix and a key pair. Any S3-compatible store works. Add one before you create your first [backup policy](./backups.mdx), and prefer a bucket at another provider or region than your server, so a lost server doesn't take its backups with it.

## Before you start [#before-you-start]
- Create the bucket at your provider. LogiStack doesn't create it for you.
- Create a key pair that reaches only this bucket, with permission to put, get, delete and list objects.
- Only organization admins can add destinations.
## Add a destination [#add-a-destination]
### Open Backup destinations [#open-backup-destinations]
In the sidebar, under **Integrations**, select **Backup destinations**, then **Add destination**.
### Pick the provider [#pick-the-provider]
In **Where should backups go?**, under **Object storage**, pick **Amazon S3**, **Cloudflare R2**, **Backblaze B2**, **Hetzner Object Storage**, **MinIO**, **Wasabi** or **S3-compatible**. The preset fills in the endpoint, region and addressing. Select **Continue**.

### Describe the bucket [#describe-the-bucket]
In **Bucket**, fill in:
- **Endpoint**: the full URL, starting with `https://`.
- **Bucket**: 3 to 63 lowercase letters, digits, dots and dashes, such as `acme-backups`.
- **Region**: the bucket's region, or `us-east-1` when the store doesn't care.
- **Prefix** (optional, default `logistack`): a folder inside the bucket, so one bucket can serve several LogiStack instances.
- **Path-style addressing**: puts the bucket in the path (`host/bucket/key`) instead of the hostname. MinIO and most self-hosted stores need it.
### Paste the keys [#paste-the-keys]
In **Access keys**, paste the **Access key ID** and the **Secret access key**. The secret is encrypted at rest and never shown again. The step explains where to create keys for the provider you picked.
### Test the bucket [#test-the-bucket]
In **Test the destination**, select **Run test**. LogiStack writes a small probe object under `//.logistack-probe-…`, reads it back and deletes it. A pass means the keys can put, get and delete: the three things backups, restores and retention do. Nothing is saved until the test passes.
### Name and save [#name-and-save]
In **Name and review**, keep the suggested **Name** (such as `Cloudflare R2 · acme-backups`) or type your own. It's what you pick when setting up a backup policy. Check the summary and select **Add destination**.
## Provider examples [#provider-examples]
| Field | Value |
| --- | --- |
| Endpoint | `https://s3.eu-central-1.amazonaws.com` |
| Bucket | `acme-backups` |
| Region | `eu-central-1` |
| Path-style addressing | Off |
Create the keys in IAM: open a user meant only for backups, then **Security credentials** > **Create access key**. Give it a policy limited to the bucket:
```json title="backup-user-policy.json"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject"],
"Resource": "arn:aws:s3:::acme-backups/*"
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::acme-backups"
}
]
}
```
| Field | Value |
| --- | --- |
| Endpoint | `https://.r2.cloudflarestorage.com` |
| Bucket | `acme-backups` |
| Region | `auto` |
| Path-style addressing | Off |
Your account ID is on the R2 overview page, next to the S3 API endpoint. In R2, open **Manage API tokens** > **Create API token** with **Object Read & Write**, scoped to this bucket. Copy the **Access Key ID** and **Secret Access Key**; Cloudflare shows the secret once. R2 has no egress fees, which keeps restores cheap.
| Field | Value |
| --- | --- |
| Endpoint | `https://s3.eu-central-003.backblazeb2.com` |
| Bucket | `acme-backups` |
| Region | `eu-central-003` |
| Path-style addressing | Off |
The endpoint is shown as **Endpoint** on the bucket's page; the region is its middle part. Under **Application Keys** > **Add a New Application Key**, allow **Read and Write** on this bucket only. The **keyID** is the access key and the **applicationKey** is the secret.
| Field | Value |
| --- | --- |
| Endpoint | `https://minio.example.com` |
| Bucket | `acme-backups` |
| Region | `us-east-1` |
| Path-style addressing | On |
Use the API address (port 9000 by default), not the console. The region is `us-east-1` unless `MINIO_REGION` is set. In the MinIO Console, open **Access Keys** > **Create access key**, with a policy that allows put, get and delete on this bucket.
For Hetzner, use `https://fsn1.your-objectstorage.com` (or `nbg1`, `hel1`) with the matching region. For Wasabi, use the service URL of the bucket's region, such as `https://s3.eu-central-1.wasabisys.com`; Wasabi bills deleted objects for 90 days. **S3-compatible** covers Ceph, Garage, SeaweedFS and any store that signs requests with Signature V4.
Not on S3? A NAS over SFTP or WebDAV, Azure Blob Storage, Google Drive, Backblaze B2's native API and a folder on a node work too: see [Other backup destinations](./backup-destinations.mdx).
An [object storage service](./object-storage.mdx) on LogiStack can become a destination in one step with **Use for backups**. Keep an off-site destination too: backups on the same server don't survive losing it.
## Check it worked [#check-it-worked]
The destination shows under **Destinations** with its provider, its location (`s3:///`) and **Not used yet**. Once a policy writes to it, the row shows **Used by 1 policy**. Select **Run now** on a policy and check that a file appears in the bucket under the prefix.
## Remove a destination [#remove-a-destination]
Select the trash icon on its row, then **Remove destination**. LogiStack forgets the credentials; backups already in the bucket stay there. A destination still used by a policy can't be removed: move those policies to another destination or delete them first.
## Troubleshooting [#troubleshooting]
- **Use the full URL, starting with https://**: paste the endpoint with its scheme. Plain `http://` works only for a store on a private address, such as a MinIO on your LAN, and only after an instance admin allows private hosts in **Settings > General**.
- The test fails with a private address error: the endpoint's name resolves to a private or loopback address. LogiStack checks the address on every request and connects only to the one it checked.
- **Fill in your account ID**: replace `` in the R2 endpoint.
- The test fails with access denied: the key lacks put, get or delete on the bucket, or is scoped to another bucket.
- The test fails with a DNS or bucket-not-found error on a self-hosted store: turn on **Path-style addressing**.
- The test fails with a signature error: check the **Region**.
# Run scheduled jobs with cron
URL: https://stack.logicaltech.it/docs/data/schedules/
Create schedules that run a shell script on a cron in a fresh container, inside a service or on a node, with a timezone, timeout, overlap rule and run history.
A schedule runs a shell script on a cron. It can run in a fresh container from any image, inside a running service with that service's environment, or on a node's host. Every run keeps its exit code, duration and output. Use schedules for maintenance (`VACUUM`, cache warm-up, pruning), reports, data syncs and any job your app needs on a clock. For database and volume backups, use a [backup policy](./backups.mdx) instead.

## Create a schedule [#create-a-schedule]
### Start a new schedule [#start-a-new-schedule]
In the sidebar, select **Schedules**, then **New schedule**.

### Name it [#name-it]
In **Name it**, enter a **Name**, such as `Nightly VACUUM ANALYZE`. It appears in run history and failure notifications. Pick a **Project**, or **None, the whole organization**. People with access to the project can see and run it; without a project, only organization members can. Select **Continue**.
### Set when it runs [#set-when-it-runs]
In **When it runs**, use the **Simple** editor (**Minutes**, **Hourly**, **Daily**, **Weekly**, **Monthly**) or switch to **Cron** and type an expression. Pick the **Time zone**; runs follow that zone's clock, daylight saving included. The default is your browser's zone. **Next 5 runs** shows the upcoming fire times.
### Choose where it runs [#choose-where-it-runs]
In **Where it runs**, pick one:
- **A fresh container**: pulled from an **Image**, such as `alpine:3.22` or `postgres:17`, started for this run and removed after. Nothing it writes survives. Pin a tag; the image needs `/bin/sh`.
- **Inside a service**: runs in a running replica of the **Service** you pick, with its environment, network and volumes. With several replicas, one is picked per run.
- **On a node's host** (**Admins only**): a root shell on the **Node**, outside every container. Use it only for jobs that need the host itself, such as rotating logs or pruning images.
### Write the script [#write-the-script]
In **Script**, write the commands. It runs with `/bin/sh`. Scripts can be up to 64 KiB, and output is kept up to 1 MiB per run. Inside a service, the service's environment variables, secrets included, are set.
### Set limits and alerts [#set-limits-and-alerts]
In **Limits and alerts**:
- **Timeout**: **Stop after** a number of minutes, from 1 to 1440 (default 60). A run still going then is stopped and marked failed.
- **When a run is still going**: **Skip if still running** (default, safest for jobs that write), **Run in parallel**, or **Replace the running one** (the running job is cancelled).
- **Notify on failure**: failed runs reach the notification channels whose rules include schedule failures.
- **Enabled**: paused schedules keep their history and can still be run by hand.
### Review and create [#review-and-create]
Check the summary and select **Create schedule**. The schedule's page opens and a message shows the next run time.
## Script examples [#script-examples]
```sh title="Inside the postgres service: vacuum and reindex"
#!/bin/sh
set -eu
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -c 'VACUUM (ANALYZE, VERBOSE) orders'
psql "$DATABASE_URL" -c 'REINDEX TABLE CONCURRENTLY order_items'
```
```sh title="Inside the web service: run a Laravel command"
#!/bin/sh
set -eu
php artisan queue:prune-failed --hours=72
```
```sh title="In a fresh curlimages/curl:8.11.1 container: ping a health check"
#!/bin/sh
set -eu
curl -fsS --retry 3 https://hc.example.com/ping/5b2c1e7a
```
Start scripts with `set -eu`, so a failing command fails the run and an unset variable stops it.
## Cron syntax [#cron-syntax]
An expression has five fields: minute, hour, day of month, month and day of week. Seconds and `@daily`-style shortcuts aren't accepted.
```text
┌───────── minute (0-59)
│ ┌─────── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌─── month (1-12)
│ │ │ │ ┌─ day of week (0-6, Sunday = 0)
│ │ │ │ │
15 2 * * *
```
| Expression | Runs |
| --- | --- |
| `*/15 * * * *` | Every 15 minutes |
| `0 * * * *` | Every hour, on the hour |
| `15 2 * * *` | Every day at 02:15 |
| `30 9 * * 1-5` | Weekdays at 09:30 |
| `0 3 * * 0` | Sundays at 03:00 |
| `0 6 1 * *` | The 1st of every month at 06:00 |
| `0 0,12 * * *` | Every day at 00:00 and 12:00 |
Times are in the schedule's time zone. With `Europe/Rome`, `15 2 * * *` runs at 02:15 Rome time all year.
## Follow a schedule [#follow-a-schedule]
Select a schedule to open its page.

- The header shows where it runs, the schedule in words and the next run.
- The run panel shows the latest run's **Trigger** (**Schedule** or **By hand**), **Exit code**, **Duration**, **Output** size, and the full output. A running job streams its output live.
- **History** lists runs with **Started**, **Status**, **Trigger**, **Exit**, **Duration** and **Output**. Select a run's start time to show its output.
Run statuses are **Running**, **Succeeded**, **Failed**, **Skipped** (a tick arrived while the previous run was still going) and **Cancelled** (replaced by a newer run).
## Run, edit, pause or delete [#run-edit-pause-or-delete]
- **Run now** starts a run right away, even when the schedule is paused. If a run is still going and the rule is **Skip if still running**, the new run is recorded as skipped.
- **Edit** opens the same wizard with the current values. Select **Save changes** at the end.
- The **Enabled** switch pauses and resumes the schedule. On the **Schedules** page, each row has the same switch and a run button.
- The trash icon deletes the schedule. Its run history and output are deleted too. Nothing it changed is undone.
## Troubleshooting [#troubleshooting]
- **Fix the cron expression**: use exactly five fields, such as `0 3 * * *`.
- A run fails after exactly the timeout: the job took longer than **Stop after**. Raise the timeout or split the job.
- Runs show **Skipped**: the previous run was still going. Shorten the job, space the schedule out, or pick **Run in parallel**.
- `not found` errors in a fresh container: the image lacks the tool. Use an image that has it, such as `postgres:17` for `psql`.
- **On a node's host** is missing: only organization admins can run jobs on a host.
# Manage volumes and files of a service
URL: https://stack.logicaltech.it/docs/data/volumes-and-files/
Use the Files tab to edit mounted config files, upload and delete files in named volumes, and browse, view, download or upload files in a running container.
A service keeps data that must survive a redeploy in named volumes, and can mount config files that LogiStack stores for it. The **Files** tab shows both, and lets you browse the running container's whole filesystem. Use it to change an `nginx.conf`, upload a build of a static site, pull a log file out of a container, or drop a file into place without a shell.
## Volumes, config files and bind mounts [#volumes-config-files-and-bind-mounts]
- A **named volume** is Docker storage that outlives containers. Database services keep their data directory on one, and templates and static sites create their own. Volumes live on the node that runs the service. Deleting a service keeps its named volumes until you remove them.
- A **config file** is a file LogiStack stores encrypted and mounts into the container. Editing it rolls out a new deployment.
- A **bind mount** maps a host directory into the container. Set bind mounts in **Settings** > **Host access** > **Add bind mount**. Host paths bypass LogiStack's volumes, so they aren't listed in the Files tab or archived by volume backups. See [Service settings](../deploy/service-settings.mdx).
To back up a volume, create a [backup policy](./backups.mdx) for it.
## Open the Files tab [#open-the-files-tab]
Open the service and select **Files**. At the top, **Files from** switches between:
- **Volumes**: the service's config files, each in an editor, then each named volume's files. This is the default when the service has any.
- **Container**: the running replica's filesystem.
## Edit a config file [#edit-a-config-file]
### Find the file [#find-the-file]
In **Volumes**, each config file has its own **Configuration** panel, titled with its path in the container, such as `/etc/nginx/conf.d/default.conf`, and when it was last saved.
### Edit it [#edit-it]
Change the text in the editor. For an imported HAProxy load balancer, the panel is called **Load balancer** and also offers **Form** next to **Raw config**.
### Save and deploy [#save-and-deploy]
Select **Save and deploy**, or press **Cmd+S** (**Ctrl+S**). LogiStack stores the file and deploys the service with it; the new config rolls out with a fresh replica. Select **Discard changes** to drop your edits instead.
If the server in the container rejects the config, the deployment fails and Swarm keeps the running replica. Check the deployment's [logs](../deploy/deployments.mdx).
## Upload files to a volume [#upload-files-to-a-volume]
Each named volume has a panel with its mount path, such as `/usr/share/nginx/html`.
### Make sure a replica runs [#make-sure-a-replica-runs]
Files are read and written through a running replica, so the service must be running.
### Upload [#upload]
Select **Upload files** to pick files, or **Upload folder** to pick a folder. You can also drag files or a folder onto the panel. A dropped folder uploads what is inside it, so dropping a `dist/` folder puts `index.html` at the volume root.
### Check the result [#check-the-result]
The panel lists each file's **Path**, **Size** and when it was **Modified**, and a total at the bottom. Static sites serve the files as soon as they land.
Each file can be up to 50 MB. An existing file at the same path is replaced, and missing folders are created. To delete a file, select its trash icon, then **Delete file**. It is removed from the volume right away; there is no undo.
The list shows the first 1,000 files.
## Browse a running container [#browse-a-running-container]
Select **Container** to open the **Filesystem** panel.
- Select folders to move down, and use the breadcrumbs to go back up. Folders come first.
- Select a text file to view it. The first 1 MB is shown; binary files aren't shown.
- Select the download icon next to a file to download it. Downloads are limited to 50 MB.
- Select **Upload here** to write files into the current folder. Each file can be up to 50 MB. An existing file is replaced; a folder never is.
- With several replicas, pick one in the replica menu, or keep **First running replica**.
Files you write into the container's own layer disappear on the next deploy. Write into a folder that is a mounted volume to keep them.
Browsing the container needs the **Terminal** permission on the service. Files are read and written by the Docker daemon as root, so this is as powerful as a shell and is granted the same way. Downloads and uploads are recorded in the [audit log](../team/audit-log.mdx).
## Examples [#examples]
**Replace a static site's build.** Run `npm run build` locally, open the static site's **Files** tab, and drop the `dist` folder on its volume panel.
**Grab a log file.** Select **Container**, open `/var/log/nginx`, and download `error.log`.
**Put a license file in place.** Select **Container**, open the folder that the app's volume is mounted on, such as `/data`, and select **Upload here**.
## Troubleshooting [#troubleshooting]
- **No files**: the service mounts no config files or volumes. Switch to **Container**.
- **Files show here once a replica is running**: start the service, or wait for the deploy to finish.
- **Browsing the container needs the Terminal permission**: ask an admin to add Terminal to your role for this service. See [Roles and permissions](../team/roles-and-permissions.mdx).
- An upload is skipped with **Files are limited to 50 MB each**: copy large files with a [schedule](./schedules.mdx) or from inside the container instead.
# Archive a project
URL: https://stack.logicaltech.it/docs/deploy/archive-projects/
Archive a project to stop all its services and hide it from the projects list without deleting anything, then unarchive it to start the same services again.
Archiving puts a project to sleep. Every running service stops, the project leaves the projects list, and deploys pause. Nothing is deleted: data, volumes, variables, domains, configuration and replica counts stay. Use it for a demo, a client project on hold or anything you may need again, when you want its memory and CPU back but don't want to lose it.
## Archive a project [#archive-a-project]
### Open the project's actions [#open-the-projects-actions]
Open the project and select the actions menu next to its name.
### Archive it [#archive-it]
Select **Archive project…**, then **Archive project** to confirm.
The project's services scale to zero replicas. The project page shows **This project is archived**, and the project disappears from the default projects list.
## What an archived project refuses [#what-an-archived-project-refuses]
While a project is archived, LogiStack refuses everything that would start something in it:
- Deploys, redeploys, restarts and rollbacks.
- Starting a stopped service.
- Creating a service. The **New service** button is hidden.
- Restoring a backup into a new database.
Deployments that were already queued when you archived the project, or that a trigger queues later, such as a git push or a schedule, fail with the reason `the project is archived; unarchive it to deploy`.
## Find archived projects [#find-archived-projects]
On the **Projects** page, select **Archived**. The list then shows only archived projects. Select **Archived** again to go back to the active ones.
## Unarchive a project [#unarchive-a-project]
Open the archived project and select **Unarchive** in the banner, or **Unarchive project** in the actions menu.
LogiStack starts again exactly the services that archiving stopped, at their configured replica counts. Services that were already stopped before you archived the project stay stopped. Deploys work again right away.
## Common problems [#common-problems]
- **"the project is archived; unarchive it to deploy"**: a deploy, a new service or a restore into a new database was refused, or a queued deployment failed. Unarchive the project first.
- **A service did not start after unarchiving**: it was stopped before the project was archived. Start it from its page; that works again once the project is unarchived.
# Scale a service automatically
URL: https://stack.logicaltech.it/docs/deploy/autoscaling/
Let LogiStack add and remove copies of a service as its CPU load changes, between a minimum and maximum you choose, with a replay of the last day before you turn it on.
Automatic scaling runs more copies of a service when it is busy and fewer when it is quiet. You choose the fewest and the most copies, and how quickly it reacts; LogiStack watches each copy's CPU and changes the count on its own. Use it for a web app or API whose traffic rises and falls during the day, so it has room at peak and doesn't hold idle copies at night.
Automatic scaling works on application services. Databases, object storage, game servers and compose stacks keep a fixed number of copies.
## Before you start [#before-you-start]
The service needs:
- **A CPU limit.** Usage is measured as a percentage of each copy's limit. Pick a profile or set **CPU** under **Resources** in [Service settings](./service-settings.mdx#resources).
- **No volumes and no host paths.** Copies of a service with a volume would split or share its data. Keep files in [object storage](../data/object-storage.mdx) and state in a database.
- **No port published on its node.** Two copies can't bind the same host port on one server. Reach the service through a [domain](../networking/domains.mdx), or publish the port on **Every node**.
These are also recommended, but not required:
- **A health check**, so a new copy gets traffic only once it is ready. Without one, requests can fail for a few seconds after each scale-up. A service behind a [domain](../networking/domains.mdx) already gets one: LogiStack checks that its port accepts connections, unless the image has no shell (see [Images without a shell](./service-settings.mdx#images-without-a-shell)). For such an image, the check stays a warning after its first deploy.
- **More than one server**, so copies spread out instead of sharing one server's CPU. See [Nodes](../operations/nodes.mdx).
## Turn on automatic scaling [#turn-on-automatic-scaling]
### Open Scaling [#open-scaling]
Open the service, select **Settings**, and find the **Scaling** section. Select **Automatic**, then **Set up automatic scaling**.
### Check the service [#check-the-service]
The first step lists the checks from [Before you start](#before-you-start). A red mark blocks the setup. An orange mark is a warning you can continue past. When a check shows **AutoFix** on its right, you can fix it from here; see [Fix setup problems with AutoFix](#fix-setup-problems-with-autofix). Otherwise fix it in the service settings, then come back.

### Choose how many copies [#choose-how-many-copies]
Drag the two handles to set the minimum and maximum, from 1 to 20 copies. The service never runs fewer than the minimum, even when idle, and never more than the maximum, even under a spike. The line below shows the CPU and memory the service uses at the maximum, so you know how much the servers need to spare.
With the keyboard, focus a handle and press the arrow keys.

### Choose how quickly it reacts [#choose-how-quickly-it-reacts]
Each behavior sets the CPU level each copy should stay around:
| Behavior | CPU target | Use it when |
| --- | --- | --- |
| **Balanced** | 60% | Most web apps and APIs. |
| **Responsive** | 45% | Traffic arrives in sudden bursts and response time matters more than cost. |
| **Economical** | 75% | The service tolerates being slower during spikes and you want the fewest copies. |
| **Custom target** | 10% to 95% | You know the level your app runs best at. |

### Review and turn it on [#review-and-turn-it-on]
The last step sums up your choices and replays the service's last 24 hours with them: how many copies it would have run, and the CPU of each copy against the target. If the service has run for less than about an hour, there is not enough history and the preview says so.
Select **Turn on automatic scaling**.

The **Scaling** section now shows how many copies run, the range, the behavior and the last change with its reason. The service header shows **Scales** with the range, linking back to it.

## Fix setup problems with AutoFix [#fix-setup-problems-with-autofix]
Some checks can be fixed in one click. Those checks show **AutoFix** on their right:
| Check | What AutoFix changes |
| --- | --- |
| No CPU limit | Gives each copy a size from your [resource profiles](./service-settings.mdx#resources). It starts from the organization's default size, or the smallest one, and moves up until the size covers one copy's peak use with 30% to spare. The peak is the 95th percentile of its per-minute CPU and memory over the last day; with under an hour of history, AutoFix uses the starting size. A memory limit you already set stays as it is. |
| Port published on one server | Publishes the port on every server, so each copy can receive traffic wherever it runs. Clients keep the same address. AutoFix is not offered when another service already uses that port on the cluster. |
| No health check | Adds an HTTP health check that requests `/` on the service's first port. Before you can apply it, LogiStack requests that URL inside a running copy, with `wget` or `curl` as the check itself will. If no copy is running, the request fails, or the image has neither tool, AutoFix explains why and you add a health check in the service settings instead. When the service declares no port, the check says so instead of offering AutoFix. |
Volumes can't be fixed this way: moving data out of a volume is a migration. The single-server warning shows **Add a server** instead, which opens [Monitoring](../operations/nodes.mdx).
### Select AutoFix [#select-autofix]
Select **AutoFix** next to the check. A dialog lists what will change, from its current value to the new one, and why that value was chosen, for example the peak CPU and memory of the last day.

### Apply it [#apply-it]
Select **Apply and redeploy**, or **Cancel** to leave the service as it is. LogiStack saves the change and starts a new deployment. Copies are replaced one at a time; if a new copy fails its health check, the previous version keeps running.
The check turns green and the setup continues. To undo a fix, change the setting back in [Service settings](./service-settings.mdx) and deploy, or roll back from the **Deployments** tab.
AutoFix needs permission to change and to deploy the service. Each fix is recorded in the [audit log](../team/audit-log.mdx) with the settings before and after.
## How it decides [#how-it-decides]
Every 30 seconds LogiStack reads the average CPU of the service's copies, as a percentage of each copy's limit, and compares it with the target:
- **Up, quickly.** When the average over the last minute is more than 10% above the target, it adds enough copies to bring each one back to the target. It at most doubles the count, and adds at most 4 copies, in one step, and waits a minute before the next step.
- **Down, slowly.** When the average over the last 5 minutes is low enough that one copy fewer would still run at or under the target, it removes one copy. It waits at least 3 minutes after any change before removing another. With 2 copies and a 60% target, that means each copy at 30% or less.
- **Holds** while a deployment runs, while a backup has paused the service, and while new copies are still starting. If a copy stays pending because no server has room, it doesn't ask for more.
Within 10% of the target nothing changes, so the count doesn't flap. A change takes effect within about 30 seconds, without a deployment.
### Example [#example]
The `api` service has a 0.5 CPU limit, a range of 2 to 6 and the Balanced behavior (60%). It runs 2 copies at 35% each. A campaign starts and each copy climbs to 90%. Within a minute LogiStack moves to 3 copies, bringing each back to about 60%. In the evening each copy drops to 20% for five minutes: two copies would run at 30%, under the target, so it removes one and is back at the minimum of 2.
## Change or turn it off [#change-or-turn-it-off]
- To change the range or behavior, select **Edit scaling** in the **Scaling** section and go through the steps again. The current count stays if it fits the new range; otherwise it moves to the nearest end.
- To turn it off, select **Fixed**, then **Switch to fixed**. The service goes back to the number of copies it had before you turned automatic scaling on.
## Get notified [#get-notified]
Each change sends a `service.scaled` event with the old and new count and the reason. Add **Service scaled automatically** to a notification rule to receive it in Slack, email or another channel. See [Alerts and notifications](../operations/alerts-and-notifications.mdx). Each change is also recorded in the audit log.
## Use the API [#use-the-api]
The **Scaling** settings are also available through the API and the manifest:
- `GET /api/services/{id}/autoscale` returns the settings, the current count and the readiness checks.
- `PUT /api/services/{id}/autoscale` saves them. Over MCP this is the `service_autoscale` tool.
- `GET /api/services/{id}/autoscale/preview?minReplicas=1&maxReplicas=6&behavior=balanced` returns the replay of the last day.
```json title="PUT /api/services/svc_.../autoscale"
{
"enabled": true,
"minReplicas": 2,
"maxReplicas": 6,
"behavior": "balanced"
}
```
With `behavior: "custom"`, also send `targetCpu`. The API also accepts `targetMemory`, a percentage of the memory limit: the service then scales up when either CPU or memory is over its target, and scales down only when both are under. It needs a memory limit.
In a [project manifest](../automation/project-manifests.mdx), add `autoscale` with the same fields to an application service. Apply saves it only when it changed; leaving it out keeps the current setting.
## Common problems [#common-problems]
- **The setup stops at Check the service**: a red check fails. The message names it: set a CPU limit, remove the volume or host path, or publish the port on **Every node**.
- **The count stays at the maximum**: the service needs more than the maximum at its current load. Raise the maximum, or the CPU limit per copy.
- **The count doesn't go up under load**: new copies are still pending, usually because no server has the CPU or memory the limits ask for. Check **Monitoring** › **Nodes**, or lower the limits.
- **Errors for a few seconds after scaling up**: the service has no health check, so new copies get traffic before they are ready. Add one under **Healthcheck and drain**.
- **The preview says there is not enough history**: the service has run for under an hour, or it was stopped. Turn scaling on anyway, or come back later to see the replay.
# Build for amd64 and arm64
URL: https://stack.logicaltech.it/docs/deploy/build-platforms/
Choose which CPU architectures LogiStack builds images for, build multi-architecture images for mixed amd64 and arm64 swarms, and set up QEMU emulation.
Build platforms decide which processor architectures your images are built for: `amd64` (Intel and AMD servers) or `arm64` (ARM servers such as Graviton, Ampere or Apple silicon). A service only runs on servers of the architectures its image was built for. You need this page when your swarm mixes both kinds of server, or when BuildKit runs on a different architecture from the servers that run your apps.
## How a build picks its architectures [#how-a-build-picks-its-architectures]
- **Automatic**: a service builds for every architecture in the swarm. This is the default.
- **Both at once**: a Dockerfile built for amd64 and arm64 becomes one image, a manifest list, that every server pulls its own half of. BuildKit pushes it straight to the registry, so it needs one.
- **Placement**: a service only runs on servers of the architectures its image was built for. A single-architecture image never lands on the other kind.
- **Emulation**: BuildKit builds a foreign architecture through QEMU, several times slower than on its own CPU. Nothing is set up without you asking.
Railpack builds one architecture per image. On a mixed swarm, **Automatic** with Railpack builds BuildKit's own architecture.
## Check what BuildKit can build [#check-what-buildkit-can-build]
### Open Builds [#open-builds]
Select **Builds** under **Settings** in the sidebar.

### Read the Architectures table [#read-the-architectures-table]
Each row shows an architecture, whether it has **Servers in this swarm** (**In this swarm** or **No servers**), and whether **BuildKit** can build it: **Native**, through emulation, or **Can't build**.
### Refresh it [#refresh-it]
Select **Check BuildKit** to ask BuildKit for its platforms again. BuildKit also reports them the first time it builds.
## Set up cross-architecture builds [#set-up-cross-architecture-builds]
If an architecture in your swarm shows **Can't build**, set up QEMU emulation. You need to be an admin.
### Start the setup [#start-the-setup]
On **Builds**, select **Set up emulation**.

### Check BuildKit [#check-buildkit]
On **Check BuildKit**, select **Check BuildKit**. It lists the platforms BuildKit can build and what is missing, for example "BuildKit can't build arm64 yet". If nothing is missing, there is nothing to set up. Select **Continue**.
### Review what runs [#review-what-runs]
**Review what runs** lists exactly what the setup does:
- **Runs**: `tonistiigi/binfmt`, once, as a Swarm job.
- **Where**: the server BuildKit runs on.
- **Access**: `CAP_SYS_ADMIN` with the default seccomp and AppArmor profiles off, to mount `binfmt_misc`. Never a privileged container.
- **Registers**: QEMU for the missing architectures, in that server's kernel.
- **Then**: BuildKit restarts to pick the emulators up.
- **Lasts**: until that server reboots. Run the setup again after a reboot.
Builds running when BuildKit restarts fail. Pick a quiet moment, or deploy them again afterwards.
### Run it [#run-it]
On **Set up emulation**, select **Run setup**. The worker runs the job, restarts BuildKit and checks it again. When it finishes, select **Done**. You see "Cross-architecture builds are on".
### Rebuild [#rebuild]
Deploy each service again to build it for its new architectures.
## Choose a service's architectures [#choose-a-services-architectures]
### Open the service settings [#open-the-service-settings]
Open the service, select **Settings**, and find **Architectures** under **Source and build**.
### Pick the architectures [#pick-the-architectures]
- **Automatic (amd64 and arm64)**: every architecture in the swarm.
- **amd64 only** or **arm64 only**: one architecture. The service runs only on those servers.
- **amd64 and arm64**: one image for both kinds of server. Dockerfile builds only; needs a registry.
If BuildKit can't build a chosen architecture, the field says so and links to **Set up emulation**.
### Save and deploy [#save-and-deploy]
Select **Save**, then **Deploy**.
## Check that it worked [#check-that-it-worked]
The deployment log names the targets:
```text
==> building registry.example.com/acme/web:dep_8k2p1q for linux/amd64, linux/arm64 (dockerfile)
==> registry.example.com/acme/web:dep_8k2p1q was pushed by BuildKit as a manifest list
```
## Common problems [#common-problems]
- **`BuildKit cannot build linux/arm64: set up cross-architecture emulation in Settings > Builds, or build for linux/amd64 only`**: run the emulation setup, or pick one architecture.
- **`a multi-platform build pushes a manifest list: configure a registry first`**: add a registry. See [Registries](./registries.mdx).
- **Builds fail after a server reboot**: emulation lasts until the BuildKit server reboots. Run **Set up emulation** again.
- **Emulated builds are slow**: expected, QEMU is several times slower than native. Build only for the architectures your servers run.
# Build types for Git services
URL: https://stack.logicaltech.it/docs/deploy/build-types/
How LogiStack builds Git services with BuildKit using a Dockerfile or Railpack, with build variables, secrets, multi-stage targets and example Dockerfiles.
A Git service needs a build type: how LogiStack turns the checked-out repository into an image. Every build runs on BuildKit, which LogiStack runs as a rootless system service. Pick **Dockerfile** when your repository has one or you want full control, and **Railpack** when you want LogiStack to detect the language and build it for you.
## Choose a build type [#choose-a-build-type]
You choose it in the **Build with** field when you create the service, and change it later under **Settings** › **Source and build** › **Builder**.
| In the wizard | In Settings | What it does |
|---|---|---|
| **Dockerfile** | **Dockerfile** | Builds your Dockerfile with BuildKit. |
| **Railpack (no Dockerfile needed)** | **Railpack (detect)** | Detects the language and framework, and builds an image without a Dockerfile. |
| **Static site** | **Static site** | Runs your `build` script if there is one, then serves the publish folder with Caddy. See [Static site](#static-site). |
## How a build runs [#how-a-build-runs]
1. **Cloning**: the worker checks out the exact commit the trigger named, in the **Root directory** you set.
2. **Building**: BuildKit builds the image for the target architectures. The log streams to the **Deployments** tab.
3. **Pushing**: the image is pushed to the default registry as `//:`. Tags are immutable and never `:latest`, so a rollback runs exactly the image it names.
On a single-node server with no registry, the image is loaded straight into the local Docker engine. A swarm with more than one node needs a registry, because every node must pull the image. See [Registries](./registries.mdx).
## Dockerfile [#dockerfile]
### Choose Dockerfile [#choose-dockerfile]
Under **Settings** › **Source and build**, set **Builder** to **Dockerfile**.

### Point at the file [#point-at-the-file]
- **Dockerfile**: the path of the file, relative to the **Root directory**. Default `Dockerfile`.
- **Build context**: the folder sent to BuildKit, relative to the **Root directory**. Default `.`.
- **Target stage** (optional): the stage of a multi-stage Dockerfile to build, such as `runtime`.
### Save and deploy [#save-and-deploy]
Select **Save**, then **Deploy**. Source and build settings apply from the next deployment.
### Example: Node.js app [#example-nodejs-app]
```dockerfile title="Dockerfile"
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN corepack enable && pnpm build
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/.output ./.output
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
```
Set **Container port** to `3000` and, if you want to stop before an extra test stage, **Target stage** to `runtime`.
### Example: Go API [#example-go-api]
```dockerfile title="Dockerfile"
FROM golang:1.23 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /out/api ./cmd/api
FROM gcr.io/distroless/static-debian12
COPY --from=build /out/api /api
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/api"]
```
The distroless image has no shell, so the HTTP and TCP health checks cannot run in it. With the check set to **None**, the service deploys without one. To gate rollouts on a real check, give the binary a health flag and set a **Command** check such as `/api -healthcheck`. See [Images without a shell](./service-settings.mdx#images-without-a-shell).
### Static site with your own Caddy image [#static-site-with-your-own-caddy-image]
The **Static site** builder below does this for you. Write it yourself only when you need a custom Caddy configuration.
```dockerfile title="Dockerfile"
FROM node:22-alpine AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM caddy:2.10-alpine
COPY --from=build /app/dist /usr/share/caddy
EXPOSE 80
```
Set **Container port** to `80`. Caddy serves `/usr/share/caddy` by default.
### Monorepo [#monorepo]
For a repository like this, set **Root directory** to `/` and **Dockerfile** to `apps/web/Dockerfile`, so the build context includes the shared packages:
```text
/
├── apps/web/Dockerfile
├── apps/api/Dockerfile
└── packages/ui/
```
Or set **Root directory** to `/apps/web` when the app needs nothing outside its folder. Add **Watch paths** so only relevant pushes build. See [Deploy from Git](./from-git.mdx#set-the-root-directory-and-watch-paths).
## Static site [#static-site]
**Static site** builds a website that compiles to plain files (Vite, Astro, Docusaurus, Hugo output committed to the repository, a hand-written `index.html`) and serves it with Caddy. You need no Dockerfile.
### Choose the builder [#choose-the-builder]
In the new service wizard, choose **Static site** in **Build with**. On an existing service, set **Builder** to **Static site** under **Settings** › **Source and build**.
### Set the publish directory [#set-the-publish-directory]
The wizard uses `dist`. To change it, open **Settings** › **Source and build** and set **Publish directory** to the folder that holds the built files, relative to the **Root directory**: `dist` for Vite, `build` for Create React App and Docusaurus, `out` for a Next.js static export, `public` for Hugo, or `.` for files at the root of the repository.
### Set the container port to 80 [#set-the-container-port-to-80]
Caddy listens on port `80` inside the container. Set **Container port** to `80`, then select **Save** and **Deploy**.
What the build does:
1. If the root directory has a `package.json`, it installs dependencies with the package manager your lockfile names: `pnpm-lock.yaml` uses pnpm, `yarn.lock` uses Yarn, `bun.lock` or `bun.lockb` uses Bun, `package-lock.json` uses `npm ci`, and no lockfile uses `npm install`. Node.js 22 runs the install.
2. If `package.json` has a `build` script, it runs it.
3. It copies the publish directory into a Caddy image. Caddy compresses responses with zstd or gzip and serves `index.html` for any path that matches no file, so the client-side routes of a single-page app work on reload.
Build-time variables reach the build as environment variables: mark a variable **Build** to use it in your `build` script, for example `VITE_API_URL=https://api.example.com`. A variable that is both **Build** and **Secret** is mounted for the build step only and never stored in the image. The `LOGISTACK_*` variables, such as `LOGISTACK_COMMIT_SHA`, are available too.
Because every unknown path returns `index.html`, a missing page shows your home page instead of a `404`. If you need real 404 pages, use your own Dockerfile as in [Static site with your own Caddy image](#static-site-with-your-own-caddy-image).
## Railpack [#railpack]
Railpack inspects the repository, detects its language and framework, and writes a build plan that BuildKit then builds. No Dockerfile is needed.
1. Under **Settings** › **Source and build**, set **Builder** to **Railpack (detect)**.
2. Set **Container port** to the port your app listens on. If your app reads its port from `PORT`, set a `PORT` variable to the same value.
3. Select **Save**, then **Deploy**.
Railpack builds one architecture per image. On a swarm with both amd64 and arm64 servers, **Automatic** builds BuildKit's own architecture. See [Build platforms](./build-platforms.mdx).
## Build-time variables and secrets [#build-time-variables-and-secrets]
A variable reaches the build only when its **Build** box is checked in the **Environment** tab.
- A **non-secret** build variable is passed as a build argument. Declare it with `ARG` in the Dockerfile.
- A **secret** build variable is passed as a BuildKit secret, never as an argument, so it doesn't end up in the image history. Mount it in the step that needs it.
```dockerfile title="Dockerfile"
ARG NEXT_PUBLIC_SHOP_NAME
RUN --mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN \
pnpm install --frozen-lockfile
RUN NEXT_PUBLIC_SHOP_NAME="$NEXT_PUBLIC_SHOP_NAME" pnpm build
```
The `LOGISTACK_*` deployment variables, like `LOGISTACK_COMMIT_SHA`, are also build arguments. BuildKit only hands an argument to a Dockerfile that declares it:
```dockerfile
ARG LOGISTACK_COMMIT_SHA
RUN echo "$LOGISTACK_COMMIT_SHA" > /app/REVISION
```
See [Environment variables](./environment-variables.mdx).
## Common problems [#common-problems]
- **`a multi-node swarm needs a registry: configure one before building`**: add a registry under **Integrations** › **Registries**.
- **`BuildKit cannot build linux/arm64`**: the service targets an architecture BuildKit can't build. Set up emulation, or build for one architecture. See [Build platforms](./build-platforms.mdx).
- **A build argument is empty**: the variable's **Build** box is not checked, or the Dockerfile has no `ARG` for it.
- **`COPY` can't find a file**: the **Build context** doesn't include it. Widen the context or move the **Root directory** up.
# Deploy a Docker Compose stack
URL: https://stack.logicaltech.it/docs/deploy/compose-stacks/
Paste a docker-compose.yml or follow one in a Git repository, and LogiStack deploys every compose service as one stack with domains, volumes and logs.
A stack is a group of services created from one Docker Compose file. Each compose service becomes a LogiStack service that you can scale, give a domain and inspect on its own, while the stack lets you deploy, restart and edit them together. Use a stack when an app already ships a `docker-compose.yml`, or when you want several containers to move as one unit.
## Two ways to create a stack [#two-ways-to-create-a-stack]
- **Paste a file**: you paste the compose file once. Edit it later from the stack's **Compose** tab.
- **From a repository**: LogiStack reads the file from a branch of a connected repository. Every push re-syncs the stack and rebuilds services that use `build:`. This option appears when you have a GitHub, GitLab, Gitea or Bitbucket provider; an **Any Git host over SSH** provider can't serve a compose file.
## Create a stack [#create-a-stack]
### Start a new service [#start-a-new-service]
Open the project and environment, select **New service**, choose **Docker Compose** and select **Continue**.
### Provide the compose file [#provide-the-compose-file]
On **Configure**, under **Compose file**, choose **Paste a file** or **From a repository**.
- **Paste a file**: paste the YAML into **Compose file**. It needs a top-level `services:` key.
- **From a repository**: pick the **Git provider**, the **Repository** and the **Branch**, and enter the **Compose file path** from the repository root, such as `docker-compose.yml` or `deploy/compose.yaml`.
Optionally set a **Service name** for the stack. It defaults to `stack`.
### Test the source [#test-the-source]
For a repository, **Test the source** checks that LogiStack can read the branch. A pasted file skips this step.
### Review and deploy [#review-and-deploy]
Check the summary and select **Create and deploy**. If the file has parts LogiStack can't run, the error lists every one of them, so you can fix them all at once.
## Check that it worked [#check-that-it-worked]
The stack page opens with the toast "`` is deploying" and the number of containers that start in dependency order.

The **Overview** tab lists each **Container** with its **Status**, **CPU**, **Memory**, where it is **Reached at** (a domain, an internal `name:port`, or **Internal only**) and when it was **Deployed**. Below are **CPU by container**, **Memory by container** and **Recent deployments**.
The **Logs** tab follows the output of **All containers** or one **Container**, over a time window you pick in **Since**.

## A real compose example [#a-real-compose-example]
This file runs Plausible Analytics with its PostgreSQL and ClickHouse databases:
```yaml title="docker-compose.yml"
services:
plausible:
image: ghcr.io/plausible/community-edition:v3.1
ports: ["8000"]
environment:
BASE_URL: https://stats.example.com
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-change-me}
DATABASE_URL: postgres://postgres:postgres@plausible-db:5432/plausible
CLICKHOUSE_DATABASE_URL: http://clickhouse:8123/plausible
depends_on: [plausible-db, clickhouse]
plausible-db:
image: postgres:16.4
environment:
POSTGRES_PASSWORD: postgres
volumes: ["db-data:/var/lib/postgresql/data"]
clickhouse:
image: clickhouse/clickhouse-server:25.8-alpine
volumes: ["event-data:/var/lib/clickhouse"]
volumes:
db-data: {}
event-data: {}
```
What LogiStack does with it:
- `plausible`, `plausible-db` and `clickhouse` become three services. They reach each other by those names, so `plausible-db:5432` and `clickhouse:8123` work unchanged.
- `postgres:16.4` is an official database image with a pinned tag, so `plausible-db` becomes a managed database with backups and the database editor.
- `depends_on` sets the start order.
- `db-data` and `event-data` become named volumes.
- `${SECRET_KEY_BASE:-change-me}` takes its default. Replace it by setting `SECRET_KEY_BASE` on the `plausible` service.
To keep a credential out of the compose file, reference a managed secret: `SECRET_KEY_BASE: ${{ secrets.PLAUSIBLE_SECRET_KEY_BASE }}`. The service stores the expression as a plain variable and resolves it at deploy time from the most specific secret of that name on its chain. See [Use a secret inside a value](./environment-variables.mdx#use-a-secret-inside-a-value).
After it runs, open the `plausible` container and add `stats.example.com` in its **Domains** tab, pointing at port `8000`. See [Domains](../networking/domains.mdx).
## What is converted [#what-is-converted]
| Compose | In LogiStack |
|---|---|
| `services.` | One service named after it (lowercased), reachable by that name on the environment network |
| `image` | The image, which must not be built from a variable |
| Official `postgres`, `mysql`, `mariadb`, `mongo` images with a pinned tag | A managed database |
| `build` | A Dockerfile build from the stack's repository (stacks from a repository only) |
| `environment`, `${VAR:-default}` | Service variables; a default is taken, any other unset variable is empty |
| `ports`, `expose` | Container ports; a published port binds on the node (`host` mode) unless it says `mode: ingress` |
| `volumes` (named, or a relative path) | A named volume; a relative bind like `./data` becomes a volume named after its path |
| `depends_on` | Start order |
| `command`, `entrypoint`, `healthcheck`, `user`, `cap_add`, `cap_drop`, `restart` | The matching service settings |
| `mem_limit`, `cpus`, `deploy.resources` | Resource limits |
| `stop_grace_period` | The service's drain timeout, rounded up to whole seconds, at most 3600 |
Keys that don't change behavior, such as `container_name`, `hostname`, `labels`, `logging`, `networks` and `x-*` extensions, are accepted and ignored.
## Limits [#limits]
LogiStack refuses the file, and lists every reason, when it contains:
- `build:` in a pasted file. Builds need a repository: create the stack **From a repository** instead.
- A host path bind mount such as `/srv/data:/data` or `~/data:/data`.
- `privileged: true` or `network_mode`. Swarm services can't run privileged.
- `security_opt` other than `no-new-privileges`, or `links` with an alias.
- `env_file`.
- Ports with a host IP or a range, such as `127.0.0.1:8080:80` or `3000-3005:3000-3005`.
- `tmpfs` volumes.
- A volume shared by two services.
- A non-numeric `user`, such as `node`. Use `1000:1000`.
- Top-level keys other than `services`, `volumes`, `networks`, `version`, `name` and `x-*`, for example `configs` or `secrets`.
- Two service names that collide once lowercased.
Domains are not read from the compose file. Add them per container once the stack runs.
## Edit the compose file [#edit-the-compose-file]
### Open the Compose tab [#open-the-compose-tab]
Open the stack and select **Compose**. **Compose file** shows the file last applied; **Effective** shows what LogiStack runs now, written as compose from each container's settings, with secrets shown as `` unless you can read secrets.

### Edit and review [#edit-and-review]
Select **Edit**, change the file, then select **Review changes**. The **Review compose changes** dialog lists each container as **New**, **Changed** or **Removed**.
### Apply [#apply]
Select **Apply and deploy**, or **Keep editing**. Services are matched by compose service name: new ones are created, removed ones deleted (their volumes are kept), and changed ones updated and redeployed. Settings you changed on a service since the last apply survive, because only what the file itself changed is written.
For a stack from a repository, push to the branch, or select **Sync now** on the **Compose** tab to read the file at the head of the branch, review the changes and apply them.
When a push brings a compose file LogiStack can't run, the stack keeps running the previous file and the stack page shows **The last push was not applied** above the tabs, with the commit, every reason from [Limits](#limits) that applies, and when it was pushed. In the environment's service list, the stack's row says **Last push not applied**. The notice stays until a later push, a sync or an edit on the **Compose** tab applies a file.
A pasted compose file can hold credentials, so the **Compose file** view shows only to members who can read secrets. The **Effective** view masks them.
## Stack actions [#stack-actions]
The stack header has **Stop all**, **Restart all** and **Deploy all**.
- **Stop all**: every container scales to zero and its domains leave the proxy. Data, volumes and configuration stay.
- **Restart all**: each container's replicas are replaced on their current image, one at a time. No build runs.
- **More actions** › **Delete stack…**: removes its containers, their domains, variables and deployments. Type the stack name to confirm.
Deleting a stack cannot be undone.
## Common problems [#common-problems]
- **"A compose file needs a top-level services: key"**: the pasted text isn't a compose file, or it's indented under another key.
- **`.volumes host path /srv/app`**: replace the host path with a named volume, like `app-data:/srv/app`.
- **The app can't reach its database**: use the compose service name as the host (`plausible-db`), not `localhost`.
- **"The last push was not applied"**: the compose file in that commit breaks one of the [Limits](#limits). Fix the listed parts, then push again or select **Sync now**.
To preview a stack on every pull request, with its own domains and volumes, see [Preview environments](./preview-environments.mdx).
- **A variable is empty**: `${VAR}` without a default is empty until you set `VAR` on that service's **Environment** tab.
# Create a managed database
URL: https://stack.logicaltech.it/docs/deploy/databases/
Create PostgreSQL, MySQL, MariaDB, MongoDB, Redis or libSQL databases on LogiStack with generated credentials, internal hostnames and connection strings.
A managed database is a service that runs an official database image with generated credentials, a persistent volume and built-in backups. Apps in the same environment reach it by its service name. Use one whenever an app needs PostgreSQL, MySQL, MariaDB, MongoDB, Redis or libSQL, instead of running the database image yourself.
## Engines and versions [#engines-and-versions]
| Engine | Versions | Port | Image |
|---|---|---|---|
| **PostgreSQL** | 17, 16, 15 | 5432 | `postgres:` |
| **MySQL** | 8.4, 8.0 | 3306 | `mysql:` |
| **MariaDB** | 11.8, 11.4, 10.11 | 3306 | `mariadb:` |
| **MongoDB** | 8.0, 7.0 | 27017 | `mongo:` |
| **Redis** | 8.2, 7.4 | 6379 | `redis:` |
| **libSQL** | 0.24.33 | 8080 | `ghcr.io/tursodatabase/libsql-server:v` |
## Create a database [#create-a-database]
### Start a new service [#start-a-new-service]
Open the project and environment, select **New service**, choose **Database** and select **Continue**.
### Pick the engine and version [#pick-the-engine-and-version]
On **Configure**, choose the **Engine**. Each card shows its port and versions. Then pick the **Version**; the newest is selected.
### Name it [#name-it]
Set **Service name** (optional). It defaults to the engine, such as `postgres`. The name is also the database's hostname on the environment network, so pick something your apps will use, like `orders-db`.
Choose a **Resources** profile to cap its CPU and memory.
### Review and create [#review-and-create]
Check the summary and select **Create and deploy**. Credentials are generated and stored encrypted. A database has no public domain step: it is reachable only inside the environment.
## Check that it worked [#check-that-it-worked]
The service header shows **Running** and the engine and version, like `postgres 17.6`. The **Database** tab opens a browser for tables, rows, SQL and roles.

See [Database editor](../data/database-editor.mdx) for what you can do there.
## Credentials [#credentials]
The generated credentials are secret variables on the database service. Open the service, select **Environment**, and reveal them with the eye icon (you need permission to read secrets).
| Engine | User | Password variable |
|---|---|---|
| PostgreSQL | `postgres` | `POSTGRES_PASSWORD` |
| MySQL | `root` | `MYSQL_ROOT_PASSWORD` |
| MariaDB | `root` | `MARIADB_ROOT_PASSWORD` |
| MongoDB | `MONGO_INITDB_ROOT_USERNAME` (`root`) | `MONGO_INITDB_ROOT_PASSWORD` |
| Redis | none | `REDIS_PASSWORD` |
| libSQL | none | `LIBSQL_AUTH_TOKEN` (a full-access token) |
For PostgreSQL, MySQL, MariaDB and MongoDB, you can create a dedicated user with only the rights an app needs from the **Roles** view of the **Database** tab, rather than using the root account.
## Connect from another service [#connect-from-another-service]
Services in the same environment share a private network. The database's hostname is its service name. With a database called `postgres`, these connection strings work from any app in the same environment:
```bash title="Connection strings"
# PostgreSQL
postgres://postgres:@postgres:5432/postgres
# MySQL (service named mysql)
mysql://root:@mysql:3306/app
# MariaDB (service named mariadb)
mysql://root:@mariadb:3306/app
# MongoDB (service named mongo)
mongodb://root:@mongo:27017/?authSource=admin
# Redis (service named redis)
redis://:@redis:6379
# libSQL (service named libsql); pass LIBSQL_AUTH_TOKEN as authToken
http://libsql:8080
```
Put the full string on the app as a secret variable, for example `DATABASE_URL`. Add it at the environment level when several services share it. See [Environment variables](./environment-variables.mdx).
Generated passwords use URL-safe characters (letters, digits, `-` and `_`), so they go into a connection string without escaping.
## Backups [#backups]
Each database service has a **Backups** tab. Add a schedule that dumps the database to a backup destination, such as an S3 bucket or an SFTP server. See [Backups](../data/backups.mdx) and [Restore](../data/restore.mdx).
## Common problems [#common-problems]
- **`could not translate host name`**: the app and the database are in different environments, or the hostname doesn't match the service name. Each environment has its own network.
- **Authentication failed after changing the password variable**: the database image reads the password only when it initializes an empty volume. Change the password inside the database (from the **Roles** view, or the **Terminal** tab), then update the variable.
- **The database restarts on deploy**: a service with a volume updates stop-first, because two copies can't share its data, and it stays pinned to the node that holds the volume. Expect a short gap during a redeploy.
# Deployments, rollbacks and live logs
URL: https://stack.logicaltech.it/docs/deploy/deployments/
How a LogiStack deployment goes from queued to ready, with live build logs, rolling updates, release commands, cancel, rollback and Review changes.
A deployment is one attempt to bring a service to a new version: it clones and builds the source (or pulls the image), runs any release command, and rolls the new image out replica by replica. Every deployment keeps its log, so you can follow a build live, see why one failed, and roll back to an earlier image without rebuilding.
## Start a deployment [#start-a-deployment]
Deployments start from:
| Trigger | When |
|---|---|
| **Manual** | You select **Deploy** in the service header |
| **Push** | A Git push, tag or release matches the service's [deploy triggers](./from-git.mdx#deploy-triggers) |
| **Webhook** | Your CI calls the deploy webhook. See [Git webhooks](../automation/git-webhooks.mdx) |
| **Rollback** | You select **Roll back to this** on an earlier deployment |
| **Schedule** | A schedule runs a deploy. See [Schedules](../data/schedules.mdx) |
| **API** | The REST API or MCP server. See [REST API](../automation/rest-api.mdx) |
### Open the service [#open-the-service]
Open the project and select the service.
### Select Deploy [#select-deploy]
Select **Deploy** in the header. The **Deployments** tab opens on the new deployment and follows its log.

## Deployment statuses [#deployment-statuses]
A deployment moves through these statuses. The list on the left of the **Deployments** tab shows each one with its commit, trigger, reason and duration; **Current** marks the one that is live.
| Status | Meaning |
|---|---|
| **Waiting for checks** | Held until the commit's CI checks pass |
| **Queued** | Waiting for the worker |
| **Cloning** | Checking out the exact commit |
| **Building** | BuildKit builds the image |
| **Pushing** | The image goes to the registry |
| **Releasing** | The pre-deploy command runs |
| **Deploying** | Swarm replaces the replicas |
| **Ready** | Every new replica is healthy |
| **Failed** | A step failed; the error shows above the log |
| **Cancelled** | You cancelled it |
| **Superseded** | A newer deployment was queued before this one started |
| **Skipped** | A trigger held it back, for example `[skip ci]` or failed checks |
One deployment runs per service at a time. When several are queued, only the newest runs and the older ones become **Superseded**, so a burst of pushes builds once.
## Follow the live log [#follow-the-live-log]
The log on the right streams as the deployment runs. While it runs, the footer reads **Replayed from the start, following live**; once it ends, **Complete log**.
- **Search output** filters the lines.
- **Follow** keeps the view at the newest line.
- The copy button copies the whole log.
Lines starting with `==>` are LogiStack's own steps, for example:
```text
==> cloning https://github.com/acme-retail/storefront#main
==> commit 8f3c2a1 Gift card balance on checkout summary
==> building registry.example.com/acme/web:dep_rtstor for linux/amd64 (dockerfile)
==> pushing registry.example.com/acme/web:dep_rtstor
==> deploying registry.example.com/acme/web:dep_rtstor
==> healthy
```
For the runtime output of the running containers, use the **Logs** tab. See [Logs and terminal](../operations/logs-and-terminal.mdx).
## How a rollout works [#how-a-rollout-works]
LogiStack replaces replicas one at a time:
1. **Start-first** for stateless services: the new replica starts, passes its health check, takes traffic, then the old one stops. No request is dropped.
2. **Stop-first** for services with a volume or a port published on the node: the old replica stops before the new one starts, because they can't share the data or the port. Expect a short gap.
3. Swarm watches each new replica for 30 seconds. If one fails, the rollout rolls back automatically and the deployment is **Failed**; the previous version keeps running.
4. A replica being replaced gets the **Drain timeout** (10 seconds by default) after `SIGTERM` to finish in-flight requests.
Set the health check and drain timeout under **Settings** › **Healthcheck and drain**. See [Service settings](./service-settings.mdx#healthcheck-and-drain).
## Release commands [#release-commands]
Release commands run once on the new image, with the service's variables and networks, around each rollout. Set them under **Settings** › **Release commands**, or when you create the service.
- **Pre-deploy command**: runs before any replica is replaced. If it fails, the deployment fails and the current version keeps running. Use it for database migrations.
- **Post-deploy command**: runs once the new replicas are healthy. If it fails, the deployment shows a warning and stays live.
- **Timeout**: seconds, 10 to 7200. Default 600.
Write one argument per line. The command runs without a shell:
```text title="Pre-deploy command"
bun
run
db:migrate
```
To use a shell, write `sh`, `-c` and the script on three lines:
```text title="Pre-deploy command with a shell"
sh
-c
npx prisma migrate deploy && npx prisma db seed
```
## Review changes before deploying [#review-changes-before-deploying]
When you change settings, variables, domains or the image, the service doesn't change until the next deployment. The header then shows **Review changes**, and **Deploy** shows the number of pending changes.
### Open the diff [#open-the-diff]
Select **Review changes**. The dialog compares what the next deploy applies with the newest healthy deployment.
### Read each change [#read-each-change]
Each line is **Added**, **Removed** or **Changed**: the image, an environment variable, a domain, CPU or memory, replicas, a mount, a config file, a port, the health check, a network or another Swarm setting. Secret values are never shown. Switch to **JSON** for the raw diff, and copy it with **Copy the JSON diff**.
### Deploy [#deploy]
Select **Deploy changes**, or **Close** to keep editing.
## Cancel a deployment [#cancel-a-deployment]
Select the deployment and select **Cancel**. You can cancel while it is **Waiting for checks**, **Queued**, **Cloning**, **Building**, **Pushing** or **Releasing**. Once it reaches **Deploying**, Swarm owns the rollout and it can't be cancelled; it either finishes or rolls back on its own.
## Roll back [#roll-back]
### Pick an earlier deployment [#pick-an-earlier-deployment]
On the **Deployments** tab, select a **Ready** deployment that isn't **Current**.
### Roll back [#roll-back-1]
Select **Roll back to this**, then **Roll back** in the dialog. A new **Rollback** deployment runs that deployment's image again, with no build. The current variables and settings apply.
A rollback restores the image, not the data. If a pre-deploy migration changed the database schema, roll the schema back yourself first. Rollbacks to images built on the local registry stop working if you delete its images. See [Registries](./registries.mdx).
## Restart, stop and start [#restart-stop-and-start]
- **Restart** replaces each replica on the current image, one at a time, with the new one started first. No build runs. It needs one healthy deployment first.
- **Stop** scales the service to zero replicas and removes its domains from the proxy. Data, volumes and configuration stay.
- **Start** brings a stopped service back.
## Common problems [#common-problems]
- **Failed in Building**: read the log above the error. A missing file usually means a wrong **Build context** or **Root directory**.
- **Failed in Deploying with a health check error**: the app didn't answer on the check's port or path in time. Check the **Container port** and the health check path.
- **Failed with "the image has no /bin/sh"**: an HTTP or TCP check can't run in a distroless or `scratch` image. Use a **Command** check. See [Images without a shell](./service-settings.mdx#images-without-a-shell).
- **Skipped: "Commit message contains [skip ci]"**: expected. Push another commit, or select **Deploy**.
- **Deployed, but … The new version stays live**: the post-deploy command failed. The new version is live; fix the command and redeploy if needed.
# Secrets and environment variables
URL: https://stack.logicaltech.it/docs/deploy/environment-variables/
Store secrets encrypted and versioned at the organization, folder, project, environment or service level, reference them from services, and share plain variables across scopes.
Environment variables configure a service without changing its image: database URLs, API keys, feature flags. LogiStack keeps two kinds apart:
- **Secrets** are encrypted, versioned and audited. You define a secret once, at the level that owns it, and every service below that level can reference it. A service gets a secret only when its **Environment** tab references it.
- **Variables** are plain configuration. They cascade to every service in their scope.
Both are applied on the next deployment. Secrets can also live in HashiCorp Vault, Infisical or 1Password and be read at deploy time: see [External secrets](./external-secrets.mdx).
## Where secrets live [#where-secrets-live]
A secret is defined at one of five levels. A service can reference any secret defined on its own chain:
1. **Organization**: available to every service.
2. **Folder** and subfolder: available to every project inside.
3. **Project**: available to every service in the project.
4. **Environment**: available to every service in one environment, like the Production database password.
5. **Service**: available to that service only.
When two levels define the same key, the picker marks the less specific one as shadowed. For example, with `STRIPE_KEY` on the organization and on the Clients folder, services in Clients see the folder's as the first choice.
## Create a secret [#create-a-secret]
### Open Secrets & variables [#open-secrets--variables]
- **Organization or folder**: select **Settings** › **Secrets & variables**. Pick the level in **Defined for**: the whole organization or one folder.
- **Project or environment**: open the project's actions menu (**⋯**) and select **Secrets & variables**, then pick the project or one environment.


### Add it [#add-it]
On the **Secrets** tab, select **Add secret**. Enter the key, the value and, optionally, a description such as "Transactional email, rotated by ops". Select **Add secret**.
### Reference it from a service [#reference-it-from-a-service]
Open the service, select **Environment**, then **Add**. Type the name the container should see, select **Secret** and pick the secret from the list. The list groups secrets by where they are defined. The name in the container can differ from the secret's key: `DB_PASSWORD` can point at `PROD_PG_PASSWORD`.

### Save [#save]
Select **Save and redeploy** to apply at once, or **Save** to apply on the next deployment.
## Type a secret directly on a service [#type-a-secret-directly-on-a-service]
On a service's **Environment** tab you can also select **Text**, type the value and turn on **Secret**. The toggle turns on by itself when the name looks sensitive (`PASSWORD`, `TOKEN`, `KEY`, `SECRET`, `CREDENTIAL`, `PRIVATE`). When you save, LogiStack stores the value as a secret of that service and references it, so every secret is managed in one place. **Review before saving** lists which keys become secrets and which stay plain variables.
Removing the variable also removes that service secret, unless something else references it.
To add many at once, select **Paste .env**. The preview shows which keys will become secrets.
```bash title=".env"
STRIPE_SECRET_KEY=sk_live_51H...
PUBLIC_URL="https://shop.example.com"
LOG_LEVEL=warn
```
## Use a secret inside a value [#use-a-secret-inside-a-value]
A plain variable can embed a secret with `${{ secrets.KEY }}`. LogiStack replaces it at deploy time with the value of the most specific secret named `KEY` on the service's chain, so the connection string stays readable while the password stays a secret:
```bash title="Service variable"
DATABASE_URL=postgres://app:${{ secrets.PG_PASSWORD }}@db:5432/app
```
The variable is stored as typed, with the expression, and never holds the value. Once resolved, it is treated as a secret: masked in logs, and passed to a build as a BuildKit secret when marked **Build**. A name that no secret on the chain defines fails the deployment with `DATABASE_URL uses ${{ secrets.PG_PASSWORD }}, but no secret of that name is defined on this service's chain`. A value with an expression is never turned into a service secret, even with **Secret** on.
## Mount a secret as a file [#mount-a-secret-as-a-file]
Some images read credentials from a file, through variables like `POSTGRES_PASSWORD_FILE`. On a service's **Environment** tab, turn on **File** on a row that references a secret. On the next deployment the value is mounted read-only as a Swarm secret at `/run/secrets/`, and the container gets `_FILE=/run/secrets/` instead of ``. For example, `DB_PASSWORD` with **File** on gives the container the file `/run/secrets/DB_PASSWORD` and `DB_PASSWORD_FILE=/run/secrets/DB_PASSWORD`.
The value is not in the service's environment, so `docker service inspect` does not show it. A file is not passed to builds.
## See, change and roll back a secret [#see-change-and-roll-back-a-secret]
On the **Secrets** tab:
- The eye button shows the value. It needs the read secrets permission on the secret's level, and every reveal is recorded in the [audit log](../team/audit-log.mdx) as `secret.reveal`. The value hides again after 20 seconds.
- **Edit value** saves a new version. Services that reference the secret show the change in [Review changes](./deployments.mdx#review-changes-before-deploying) until they redeploy.
- **History** lists every version with its author. **Roll back** copies an earlier value as a new version.
- **Usages** lists the services that reference the secret. **Delete** is unavailable while it is in use.
Values never appear in variable lists, the API's variable endpoints, manifests, the audit log or deployment logs. Build and deployment logs replace any secret value, and its base64 form, with `***`.
## How secrets are encrypted [#how-secrets-are-encrypted]
Each organization has its own data key. Every secret version is encrypted with AES-256-GCM under that key and bound to its organization, secret and version number, so a value copied into another row does not decrypt. Data keys are themselves encrypted with a key derived from the instance master key, which never leaves the LogiStack containers.
An organization admin can select **Rotate encryption key** on **Settings** › **Secrets & variables**. LogiStack creates a new data key and re-encrypts every secret version. Values, versions and references don't change.
## Rotate the master key [#rotate-the-master-key]
The master key encrypts integration credentials, files and variables directly, and wraps every organization's data key. Rotate it if it may have leaked. LogiStack re-encrypts everything to the new key while it runs: during the rotation it reads values with either key.
### Create the new key as a Docker secret [#create-the-new-key-as-a-docker-secret]
On a manager node, save the new key and create the secret from it:
```bash
openssl rand -base64 32 | tr -d '\n' > /root/logistack-master-key.new
docker secret create logistack-master-key-next /root/logistack-master-key.new
```
### Give it to the API and the worker, with the old key as the previous one [#give-it-to-the-api-and-the-worker-with-the-old-key-as-the-previous-one]
```bash
for svc in logistack_logistack-api logistack_logistack-worker; do
docker service update \
--secret-add source=logistack-master-key-next,target=master_key_next \
--env-add LOGISTACK_MASTER_KEY_FILE=/run/secrets/master_key_next \
--env-add LOGISTACK_MASTER_KEY_PREVIOUS_FILE=/run/secrets/master_key \
"$svc"
done
```
### Wait for the worker to finish [#wait-for-the-worker-to-finish]
When the worker starts, it re-encrypts every stored value and re-wraps every data key, then logs `master key rotation finished: LOGISTACK_MASTER_KEY_PREVIOUS can be removed`. Rerunning is safe: values already on the new key are skipped.
```bash
docker service logs logistack_logistack-worker 2>&1 | grep "master key rotation"
```
### Make the new key the permanent one [#make-the-new-key-the-permanent-one]
The installer and in-app updates mount the secret named `logistack-master-key`, so replace it with the new value. Docker secrets cannot change in place, so each service lets go of it first:
```bash
for svc in logistack_logistack-api logistack_logistack-worker; do
docker service update --secret-rm logistack-master-key \
--env-rm LOGISTACK_MASTER_KEY_PREVIOUS_FILE "$svc"
done
docker secret rm logistack-master-key
docker secret create logistack-master-key /root/logistack-master-key.new
for svc in logistack_logistack-api logistack_logistack-worker; do
docker service update \
--secret-add source=logistack-master-key,target=master_key \
--env-rm LOGISTACK_MASTER_KEY_FILE \
--secret-rm logistack-master-key-next "$svc"
done
docker secret rm logistack-master-key-next
```
Then put the new key in `/etc/logistack/credentials` and delete `/root/logistack-master-key.new`.
Don't start an in-app update until the last step is done, and keep the new key in `/etc/logistack/credentials`. Without it, a restored database cannot be decrypted.
Caddy's certificate storage key (with `LS_CADDY_STORAGE_ENCRYPTION`) is pinned before the rotation, so stored certificates stay readable.
## Plain variables [#plain-variables]
The **Variables** tab holds plain variables at four scopes. When the same key is set at more than one, the most specific wins: **Organization**, **Project**, **Environment**, then **Service**.
For example, with `LOG_LEVEL=info` at the organization and `LOG_LEVEL=warn` on Production, every Production service gets `warn` and every other service gets `info`.
On a service, the **Inherited** panel lists the plain variables it gets from the organization, project and environment. A crossed-out row is overridden by a more specific one. **Override for this service** copies the key and value into **Service variables** for you to edit.
Mark a variable **Build** to also pass it to the build. Plain build variables become Dockerfile build arguments; secrets become BuildKit secrets. See [Build types](./build-types.mdx#build-time-variables-and-secrets).
## With the API [#with-the-api]
The same operations are available over the API and the MCP server (`secret_create`, `secret_reveal`, and so on).
```bash title="Create a Production database password"
curl -fsS -X POST "https://stack.example.com/api/secrets" \
-H "x-api-key: $LOGISTACK_API_KEY" \
-H "content-type: application/json" \
-d '{
"scope": "environment",
"scopeId": "env_storefront_production",
"key": "PG_PASSWORD",
"value": "s3cret-2026"
}'
```
`scope` is `organization`, `folder`, `project`, `environment` or `service`. To reference it, send `{"key": "DB_PASSWORD", "secretId": "sec_...", "isSecret": true, "isBuildTime": false}` in `PUT /api/services/{id}/env-vars`; add `"asFile": true` to mount it as a file. `POST /api/secrets/{id}/reveal` returns the value.
Secret variables created the older way, through `POST /api/env-vars` or a [project manifest](../automation/project-manifests.mdx) with `secret: true`, are converted into secrets on the next deployment. Every service that received one keeps receiving it through a reference.
## Variables set on every deployment [#variables-set-on-every-deployment]
LogiStack sets these on every container. They are read-only, and names starting with `LOGISTACK_` are reserved for them.
| Variable | Value |
|---|---|
| `LOGISTACK_DEPLOYMENT_ID` | The deployment that started this container |
| `LOGISTACK_COMMIT_SHA` | Full hash of the deployed commit. Git sources only |
| `LOGISTACK_COMMIT_MESSAGE` | First line of the commit message, up to 200 characters. Git sources only |
| `LOGISTACK_BRANCH` | Branch the commit was built from. Git sources only |
| `LOGISTACK_ENVIRONMENT` | Name of the environment |
| `LOGISTACK_PROJECT` | Name of the project |
| `LOGISTACK_SERVICE` | Name of the service |
| `LOGISTACK_URL` | Primary domain with its scheme, such as `https://app.example.com`. Unset without a domain |
| `LOGISTACK_FQDN` | Every hostname the service answers on, comma-separated. Unset without a domain |
| `LOGISTACK_PREVIEW_URL` | Pull request previews only: the preview's main URL. See [Preview environments](./preview-environments.mdx#reach-one-service-from-another) |
| `LOGISTACK_PREVIEW_URL_` | Pull request previews only: the URL of each exposed service of the preview, such as `LOGISTACK_PREVIEW_URL_API` |
A Dockerfile build gets the ones it declares with `ARG`:
```dockerfile
ARG LOGISTACK_COMMIT_SHA
ENV SENTRY_RELEASE=$LOGISTACK_COMMIT_SHA
```
## Check that it worked [#check-that-it-worked]
Open the **Terminal** tab and print the variable:
```bash
printenv LOG_LEVEL
```
If it shows the old value, the service hasn't been redeployed since the change. Select **Deploy**.
## Common problems [#common-problems]
- **"Secret not available"**: the service references a secret that is no longer on its chain, for example because its project moved to another folder. Select **Fix** and pick another secret.
- **A secret can't be deleted**: it is in use. Open **Usages** and remove the references first.
- **A secret is missing from the picker**: it is defined on another branch, or you lack the read permission on its level.
- **"Defined twice"**: the same name appears on two rows. Keep one.
- **A reserved name is refused**: names starting with `LOGISTACK_` belong to the deployment context variables. Rename yours.
- **A build can't see a variable**: check its **Build** box and declare it with `ARG` in the Dockerfile.
# Production, staging and custom environments
URL: https://stack.logicaltech.it/docs/deploy/environments/
Create production, staging and custom environments in a LogiStack project, duplicate one into another, recolor them and set the default.
An environment is an isolated set of services, variables and domains inside a project. Services in one environment share a private network and can't reach services in another, so a staging app never talks to the production database by accident. Use environments to run the same project at different stages, such as **Production** and **Staging**, or to give a client their own copy.
## Environment kinds [#environment-kinds]
Every project starts with a **Production** environment. When you create another, you pick its **Kind**:
| Kind | Typical use |
|---|---|
| **Production** | What your users reach |
| **Staging** | A pre-release copy for testing |
| **Preview** | A short-lived copy for a pull request. LogiStack creates these itself; see [Preview environments](./preview-environments.mdx) |
| **Custom** | Anything else, like `demo` or `client-acme` |
The kind sets the default color of the environment's dot. It doesn't change how services run.
## Create an environment [#create-an-environment]
### Open the project [#open-the-project]
Select **Projects** in the sidebar and open the project. The environment tabs sit above the services.

### Add the environment [#add-the-environment]
Select **New environment**. In the dialog, enter a **Name** such as `Staging` and pick the **Kind**. Select **Create environment**.
### Add services [#add-services]
The new environment is empty. Select **New service** to add services to it, or [duplicate an environment](#duplicate-an-environment) instead to start from a copy.
## Change an environment [#change-an-environment]
Select the settings icon next to the environment tabs (labelled ` settings`) to open its menu:
- **Open by default**: the project opens on this environment.
- **Variables**: the variables every service in this environment inherits. See [Environment variables](./environment-variables.mdx#plain-variables).
- **Duplicate…**: start a new environment from this one. See below.
- **Export manifest**: download the environment as a YAML manifest.
- **Color**: pick one of six colors for the environment's dot, shown across the dashboard.

## Duplicate an environment [#duplicate-an-environment]
Duplicating creates a new environment in the same project with the services, Git stacks, settings and config files of another, for example **Staging** from **Production**. You need permission to change the project.
| Copied | Not copied |
|---|---|
| Services, with their source, build, resources, health checks and config files | Domains: a hostname points at one environment |
| Stacks deployed from Git | Volume and database data: new volumes start empty |
| Environment and service variables, if you choose to | Backup policies |
### Open the source environment's menu [#open-the-source-environments-menu]
Open the project, select the environment to copy, then select its settings icon and **Duplicate…**.
### Name the copy [#name-the-copy]
**Copy from** shows the source; change it if needed. Enter a **Name** such as `Staging` and pick the **Kind**. Select **Continue**.

### Choose what comes over [#choose-what-comes-over]
Under **What comes over**, pick **Copy variables** or **Start without variables**. Copied secrets stay encrypted. Start without variables when the copy must not reach the source's databases or APIs. Select **Continue**.
### Review and duplicate [#review-and-duplicate]
Check the summary and select **Duplicate environment**. The project opens on the new environment.
### Add domains and deploy [#add-domains-and-deploy]
Nothing is deployed yet. Point variables such as `DATABASE_URL` at the copy's own database, add [domains](../networking/domains.mdx), then select **Deploy** on each service.
Secrets are copied only if you can read them in the source environment. Otherwise the copy lists each one as a warning and you set it on the new service's **Environment** tab.
Each environment gets its own volumes and databases. Duplicating copies the configuration, not the data. To copy data, restore a backup into the new database. See [Restore](../data/restore.mdx).
### With the API [#with-the-api]
`POST /api/environments/{id}/duplicate` does the same; over MCP it is the `environment_duplicate` tool. A name already taken in the project returns `409`, and a copy that fails halfway is removed, so retrying is safe.
```bash title="Duplicate Production into Staging"
curl -fsS -X POST "https://stack.example.com/api/environments/env_storefront_production/duplicate" \
-H "x-api-key: $LOGISTACK_API_KEY" \
-H "content-type: application/json" \
-d '{ "name": "Staging", "kind": "staging", "includeVariables": true }'
```
### Copy with changes, or into another project [#copy-with-changes-or-into-another-project]
To change hostnames or values on the way, or to copy into another project, use a manifest: open the source environment's menu and select **Export manifest**, edit the file, then open the target project's actions menu, select **Import manifest…** and apply it to the target environment. Secret values are never exported, so set them after applying. See [Project manifests](../automation/project-manifests.mdx).
## Common problems [#common-problems]
- **A service in one environment can't reach another's database**: by design. Each environment has its own network. Put both services in the same environment.
- **The import reports a name that matches nothing**: the manifest names a Git provider, S3 destination, DNS provider or certificate that doesn't exist in this organization. Create it, or fix the name.
- **The copy's services don't start**: duplicating or applying a manifest doesn't deploy. Select **Deploy** on each service.
- **"This project already has an environment with that name"**: environment names map to unique slugs within a project. Pick another name.
# External secrets from Vault, Infisical and 1Password
URL: https://stack.logicaltech.it/docs/deploy/external-secrets/
Reference secrets kept in HashiCorp Vault, Infisical or 1Password Connect; LogiStack reads them at deploy time and never stores a copy.
If your company already keeps secrets in HashiCorp Vault, Infisical or 1Password, you can use them in LogiStack without copying them. You connect the secret manager once as a **secret provider**, then create secrets that point at a location in it with a `secret://` reference. Each deployment reads the current value from the provider. LogiStack stores the reference, never the value.
External secrets behave like the other [secrets](./environment-variables.mdx): you define them at the organization, a folder, a project, an environment or a service, and a service gets one only when its **Environment** tab references it.
## Supported providers [#supported-providers]
| Provider | Authentication | Reference format |
| --- | --- | --- |
| HashiCorp Vault (KV version 2) | A token, plus a namespace on Vault Enterprise or HCP | `secret:////#` |
| Infisical (cloud or self-hosted) | A machine identity with Universal Auth (client ID and client secret) on one project | `secret:///[/…]#` |
| 1Password | A 1Password Connect server and its access token | `secret:////- #` |
`` is the name you give the provider in LogiStack. Vault, item and field names can contain spaces: encode them as `%20`, for example `secret://op-prod/Production/Stripe%20live#secret%20key`.
Give each credential read access only, and only to the paths you plan to reference.
A [plugin](../plugins/index.mdx) can add other secret managers. They appear in the same wizard with the plugin's name as a badge, and use `secret:///#` references.
## Connect a provider [#connect-a-provider]
### Open Secret providers [#open-secret-providers]
Select **Integrations** › **Secret providers**, then **Add provider**.

### Choose where your secrets live [#choose-where-your-secrets-live]
Select **HashiCorp Vault**, **Infisical** or **1Password**, then **Continue**.

### Enter the credentials [#enter-the-credentials]
Fill in the fields for the provider:
- **Vault**: the address, such as `https://vault.example.com:8200`, and a token whose policy can read the KV paths you will reference. Use a periodic token so it does not expire.
- **Infisical**: the address (keep the default for Infisical Cloud), the machine identity's client ID and client secret, and the project ID from the project's settings. Add the identity to the project with read access.
- **1Password**: the address of your Connect server and a Connect access token with read access to the vaults you need.
Credentials are encrypted at rest and never shown again.
### Test the connection [#test-the-connection]
Select **Test connection**. LogiStack signs in with the credentials and checks the project or token is usable. It reads no secret. You can continue only after the test passes.
### Name it [#name-it]
Enter a short name such as `vault-prod`, with lowercase letters, digits and dashes. References start with this name, so keep it stable.
### Add it [#add-it]
Review the summary and select **Add provider**.
## Reference an external secret [#reference-an-external-secret]
You can create an external secret in two ways.
**From Secrets & variables.** Open **Settings** › **Secrets & variables** (or a project's **Secrets & variables**), select **Add secret**, then **From a provider**. Enter the key and the reference, for example:
```text
secret://vault-prod/secret/app/db#password
```
Then reference the secret from each service's **Environment** tab, as with any other secret.
**On one service.** In a service's **Environment** tab, type the reference as a variable's value. LogiStack turns it into a secret owned by that service and references it.
LogiStack checks the reference when you save it: the provider must exist and the path must match its format. It does not read the value until a deployment needs it.
## What happens at deploy time [#what-happens-at-deploy-time]
1. Before it changes anything in Docker, the deployment reads every external secret the service references from its provider.
2. If any read fails, the deployment fails with a message that names each variable and the reason, such as `DB_USER (secret://vault-prod/secret/app/db#user): vault read: no field "user" at secret/app/db`. The running version keeps serving.
3. If every read succeeds, the values are injected into the containers like other secrets and masked in the deployment log.
Values stay in the worker's memory. Postgres holds the reference, the time of the last read and its error, and an encrypted hash of the value. The hash lets LogiStack notice a change without keeping the value.
## Changes in the provider [#changes-in-the-provider]
Every 15 minutes, the worker reads the external secrets that services reference. When a value changed since a service's last deployment, the service header shows **Review changes** with that variable listed, as for any [pending change](./deployments.mdx). Redeploy to pick up the new value. The containers keep the old value until then.
If a periodic read fails, the secret shows a warning icon next to its reference in **Secrets & variables**. Hover it to see the error.
## Check that it worked [#check-that-it-worked]
- On **Integrations** › **Secret providers**, select **Test** next to the provider. A toast confirms it signed in.
- Deploy a service that references the secret. The deployment succeeds, and `env` in the service's terminal shows the variable.
## Common problems [#common-problems]
LogiStack talks to providers over https. Plain http is allowed only to a private address (such as a Vault on the same network), and only after an instance owner turns on private hosts in **Settings** › **General**.
The provider's address points at a private network. An instance owner can allow private hosts in **Settings** › **General**.
The token or identity cannot read that path. For Vault, check the token's policy grants `read` on `/data/`. For Infisical, add the identity to the project. For 1Password, give the Connect token access to the vault.
The name after `secret://` does not match any provider. Names are case-sensitive and use lowercase letters, digits and dashes.
No. **Reveal** and **History** are not available for external secrets: open the value in your secret manager. Change it there, then redeploy.
Only when no secret reads from it. Delete those secrets, or edit their reference to point at another provider, first.
## With the API [#with-the-api]
Provider routes are under `/api/secret-providers` (list, test, create, update, delete); the MCP server exposes the same operations as tools. Create an external secret by sending `reference` instead of `value`:
```bash title="Create an organization secret read from Vault"
curl -X POST https://logistack.example.com/api/secrets \
-H "Authorization: Bearer $LOGISTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scope": "organization",
"scopeId": "org_…",
"key": "DB_PASSWORD",
"reference": "secret://vault-prod/secret/app/db#password"
}'
```
# Deploy an app from Git
URL: https://stack.logicaltech.it/docs/deploy/from-git/
Connect a GitHub, GitLab, Gitea, Bitbucket or SSH Git repository to LogiStack, build it on every push and control deploys with watch paths and triggers.
A Git service builds your repository into an image and deploys it. LogiStack clones the branch you choose, builds it with a Dockerfile or Railpack, pushes the image to your registry and rolls it out with zero downtime. Use it for any app whose source you control. Private repositories need a connected Git provider; public ones work over HTTPS without credentials.
## Connect a Git provider [#connect-a-git-provider]
A Git provider gives LogiStack read access to your repositories and registers the push webhooks that trigger deployments. You can connect more than one.
| Provider in the wizard | How it authenticates | Webhooks |
|---|---|---|
| **GitHub** (Recommended) | A GitHub App you create and own | Push and pull request webhooks set up by the app |
| **GitLab** | gitlab.com or self-hosted, with a personal or group access token | Registered on each repository you deploy |
| **Gitea or Forgejo** | Your own instance, with an access token | Registered on each repository you deploy |
| **Bitbucket** | A Bitbucket Cloud workspace, with a workspace or repository access token | Registered on each repository you deploy |
| **Any Git host over SSH** | One repository, read with a deploy key | None: deploy from CI or by hand |
### Open Git providers [#open-git-providers]
Select **Git providers** under **Integrations** in the sidebar, then select **Connect provider**.

### Choose a provider [#choose-a-provider]
Pick the provider and select **Continue**. The next steps depend on your choice.
GitHub connects through a GitHub App, not a token. LogiStack creates the app for you with the GitHub manifest flow, so you never copy keys by hand.
1. On **Name the app**, enter an **App name** of up to 34 characters, such as `logistack-acme`. The name is public and unique across GitHub.
2. Under **Owner**, choose **Personal account** or **Organization**. For an organization, enter its **Organization login** as it appears in `github.com/`, for example `acme-retail`. You need to be an owner of that organization.
3. On **Create it on GitHub**, check the permissions and select **Create on GitHub**. GitHub asks you to confirm. The app requests read access to code and metadata, read and write on **Pull requests** (to comment preview URLs) and **Commit statuses** (to report build and deploy results), and subscribes to `push` and `pull_request` events.
4. On **Install it**, select **Install on GitHub**, pick the account and the repositories LogiStack may deploy, and confirm. GitHub sends you back. If it doesn't, select **I've installed it**.
5. On **Test the connection**, LogiStack signs in as the app and lists what it can see.
6. Select **Done**. You pick repositories when you create a service.
1. Create a **personal** or **group** access token with the **api** scope. LogiStack needs `api` to register push webhooks; `read_api` can list repositories but not create webhooks. OAuth applications aren't supported.
2. On **Credentials**, enter the instance URL (for example `https://gitlab.com` or `https://git.example.com`) and paste the **Access token**.
3. On **Test the connection**, wait for the test to pass. Nothing is saved until it does.
4. On **Name it**, keep the suggested name or type your own. It's how the connection appears when you pick a source.
5. On **Review**, select **Connect provider**.
1. In your Gitea or Forgejo instance, under **Settings › Applications**, generate a token with **repository: read and write** (write registers webhooks) and **user: read**.
2. On **Credentials**, enter the **Instance URL**, such as `https://git.example.com`, and paste the **Access token**.
3. On **Test the connection**, wait for the test to pass.
4. On **Name it**, confirm the name, then select **Connect provider** on **Review**.
1. Create a **workspace** or **repository** access token with **Repositories: Read** and **Webhooks: Read and write**. The wizard links to `https://bitbucket.org//workspace/settings/access-tokens`.
2. On **Credentials**, enter the **Workspace** slug from `bitbucket.org/`, for example `acme-retail`, and paste the **Access token**.
3. On **Test the connection**, wait for the test to pass.
4. On **Name it**, confirm the name, then select **Connect provider** on **Review**.
Use this for any Git server that speaks SSH: a self-hosted Gerrit, a bare repository on a VPS, or a host LogiStack has no API for. It reads one repository with a deploy key and registers no webhooks.
1. Under **Deploy key**, choose an existing key or select **Generate a new key** and give it a **New key name** such as `ops-deploy`. LogiStack keeps the private key encrypted and never shows it.
2. Copy the public key with **Copy public key** and add it as a read-only deploy key on the repository.
3. Enter the **Repository URL**, SSH only: `git@git.example.com:acme/web.git` or `ssh://git@git.example.com:2222/acme/web.git`.
4. Paste the host's key into **known_hosts**. Get it with:
```bash
ssh-keyscan -t ed25519 git.example.com
```
Without it, LogiStack accepts whatever key the host presents.
5. On **Test the connection**, wait for the test to pass, then select **Connect provider**.
To deploy on push, call the deploy webhook from your CI. See [Git webhooks](../automation/git-webhooks.mdx).

## Create a service from a repository [#create-a-service-from-a-repository]
### Start a new service [#start-a-new-service]
Open the project and environment, select **New service**, choose **Git repository** and select **Continue**.
### Choose the repository [#choose-the-repository]
On **Configure**:
- **Git provider**: the connection to read from. Choose **Public repository over HTTPS** for a public repository; no credentials are used.
- **Repository**: with a provider, search and pick it from the list (private ones show a lock). For a public repository, type an HTTPS URL such as `github.com/acme/storefront`. SSH URLs need a connected **Any Git host over SSH** provider.
- **Branch**: picking a repository fills in its default branch. With a provider, choose from the list; for an SSH host, type it.
### Set the root directory and watch paths [#set-the-root-directory-and-watch-paths]
- **Root directory**: the folder that holds the app, starting with `/`. Keep `/` for a single-app repository. In a monorepo, enter the app's folder, such as `/apps/web`.
- **Watch paths** (optional): globs or directories, one per line. A push builds only when it touches one of them. Leave empty to build on every push. Up to 50 paths of up to 200 characters each.
```text title="Watch paths for a monorepo web app"
apps/web/**
packages/ui
pnpm-lock.yaml
```
### Choose how to build [#choose-how-to-build]
- **Build with**: **Dockerfile**, **Railpack (no Dockerfile needed)** or **Static site**. See [Build types](./build-types.mdx).
- **Container port**: the port your app listens on inside the container, for example `3000`. The proxy routes the domain to it.
- **Service name** (optional): defaults to the repository name, like `storefront`. Letters, numbers, spaces and dashes, up to 40 characters.
- **Resources**: a resource profile whose CPU and memory limits are copied to the service. Change them later in [Service settings](./service-settings.mdx).
Open **Release commands** to run a migration before each rollout. See [Deployments](./deployments.mdx#release-commands).
### Test the source [#test-the-source]
On **Test the source**, LogiStack reads `@` with the provider, or over HTTPS without credentials for a public repository. Fix the repository or branch if the test fails.
### Choose a domain [#choose-a-domain]
On **Domain**, pick one:
- **Generated hostname**: a name like `storefront-a1b2c3.203-0-113-10.sslip.io`, ready at once.
- **Custom hostname**: your own, like `shop.example.com`. Point a CNAME or A record at the server.
- **No public domain**: reachable only from other services on the internal network.
Keep **HTTPS** on to get a Let's Encrypt certificate and redirect HTTP to HTTPS. See [Domains](../networking/domains.mdx).
### Review and deploy [#review-and-deploy]
Check the summary and select **Create and deploy**. LogiStack creates the service, saves the watch paths, registers the push webhook on the repository and starts the first deployment. The **Deployments** tab opens with the live log.
## Check that it worked [#check-that-it-worked]
- The **Deployments** tab shows the deployment move through **Cloning**, **Building**, **Pushing** and **Deploying** to **Ready**.
- The service header shows **Running** with the replica count and the source, like `github.com/acme-retail/storefront@main`.
- Push a commit to the branch. A new deployment with the trigger **Push** appears within seconds.
## Deploy triggers [#deploy-triggers]
Open **Settings** on the service and find **Deploy triggers** to choose which Git events deploy it.
- **Deploy on**:
- **Pushes to ``**: every push to the source branch, narrowed by **Watch paths**.
- **Tags matching a pattern**: tag pushes whose name matches **Tag pattern**, a glob such as `v*.*.*`. `*` matches any tag.
- **Published releases**: releases whose tag matches the pattern. Bitbucket has no releases.
- **Wait for CI checks to pass**: holds the deployment as **Waiting for checks** until the commit's checks pass. **Give up after** sets the limit in minutes, from 1 to 720 (default 30). A failed or unfinished check skips the deployment.
Select **Save triggers** to apply.
A commit whose message contains `[skip ci]`, `[ci skip]` or `[skip deploy]` never deploys. Held-back events appear in **Deployments** as **Skipped**, with the reason.
```text title="Example: deploy only release tags after CI passes"
Deploy on: Tags matching a pattern
Tag pattern: v*.*.*
Wait for CI checks: on, give up after 30 minutes
```
## Common problems [#common-problems]
- **"Add the push webhook by hand"** after creating the service: LogiStack could not register the webhook (often a token without webhook permission). Copy the webhook URL from **Git providers** into the repository's webhook settings, or reconnect the provider with the right scope.
- **The test fails for a private repository**: you chose **Public repository over HTTPS**. Pick the connected provider instead, and for GitHub make sure the app is installed on that repository.
- **A push does nothing**: check **Watch paths** (the push may not touch them), the commit message for `[skip ci]`, and **Deploy on** in **Deploy triggers**.
- **Every push deploys a monorepo app**: add **Watch paths** for the app and the packages it uses.
# Deploy a Docker image
URL: https://stack.logicaltech.it/docs/deploy/from-image/
Run a published Docker image from Docker Hub, GHCR or any registry on LogiStack, with a domain, published ports, bind mounts and release commands.
An image service runs a container image that is already built, such as `nginx:1.29` or `ghcr.io/acme/api:1.4.2`. LogiStack pulls it at each deployment and rolls it out replica by replica; there is no build step. Use it for software you don't build yourself, or for images your own CI pushes to a registry.
## Before you start [#before-you-start]
- Pick a pinned tag or digest, such as `ghcr.io/acme/api:1.4.2` or `nginx@sha256:…`. A floating tag like `:latest` makes rollbacks unpredictable, because the same reference can point at a different image tomorrow.
- For a private image, add its registry first and make it the default. LogiStack sends the default registry's credentials only when the image lives on that registry's host; other pulls are anonymous. See [Registries](./registries.mdx).
## Create the service [#create-the-service]
### Start a new service [#start-a-new-service]
Open the project and environment, select **New service**, choose **Docker image** and select **Continue**.

### Enter the image [#enter-the-image]
On **Configure**, fill in:
- **Image**: the full reference, for example `ghcr.io/acme/web:2.4.1`. Images without a registry host come from Docker Hub (`nginx:1.29` is `docker.io/library/nginx:1.29`).
- **Container port**: the port the image listens on. It defaults to `80`. The domain routes here.
- **Service name** (optional): defaults to the image name, `web` for `ghcr.io/acme/web:2.4.1`.
- **Resources**: the resource profile whose limits the service copies.
### Set advanced options if you need them [#set-advanced-options-if-you-need-them]
Open **Advanced** for traffic and host access that doesn't go through a domain:
- **Published ports**: for TCP or UDP traffic outside the proxy, like a game or MQTT port. Each row has the **Container port**, the **Published** port and the **Protocol**. **Bind on** is **Its node** (the port opens only on the node running the replica) or **Every node** (the Swarm routing mesh).
- **Bind mounts**: a **Host path** mounted at a **Container path**, optionally **Read-only**. Host paths bypass LogiStack's volumes: they aren't backed up or cleaned up, and the service is pinned to the node that holds them. Only admins can save bind mounts.
- **Run as**: a numeric `uid` or `uid:gid`, such as `1000:1000`. Empty uses the image's user.
- **Restart**: **Always**, **On failure** or **Never**. When Swarm starts a replica again after it exits.
- **Add capabilities** and **Drop capabilities**: Linux kernel capabilities, such as `NET_BIND_SERVICE`. A safe pattern is to drop `ALL`, then add back only what the process needs.
Open **Release commands** to run a one-off command on the new image before or after each rollout. See [Deployments](./deployments.mdx#release-commands).
### Test the source [#test-the-source]
On **Test the source**, LogiStack fetches the image manifest from the registry. If it fails, check the spelling, the tag, and the registry credentials.
### Choose a domain [#choose-a-domain]
Pick **Generated hostname**, **Custom hostname** (for example `status.example.com`) or **No public domain**. Keep **HTTPS** on for a Let's Encrypt certificate. See [Domains](../networking/domains.mdx).
### Review and deploy [#review-and-deploy]
Check the summary, including any published ports and bind mounts, and select **Create and deploy**.
## Example: a stateless web app [#example-a-stateless-web-app]
```text title="New service values"
Image: ghcr.io/acme/web:2.4.1
Container port: 3000
Service name: web
Domain: Custom hostname, shop.example.com, HTTPS on
```
Set the variables the app needs, such as `DATABASE_URL`, in the **Environment** tab, then select **Save and redeploy**. See [Environment variables](./environment-variables.mdx).
## Example: a service with a published TCP port [#example-a-service-with-a-published-tcp-port]
```text title="Advanced, Published ports"
Container port Published Protocol Bind on
1883 1883 TCP Its node
```
With **Its node**, clients reach the broker on the address of the node running the replica, and the source IP of each client is preserved.
## Update the image [#update-the-image]
To deploy a new version, open **Settings**, change **Image** under **Source and build** (for example from `ghcr.io/acme/web:2.4.1` to `ghcr.io/acme/web:2.5.0`), select **Save**, then select **Deploy**. The header shows **Review changes** with the image change before you deploy. See [Deployments](./deployments.mdx).
To redeploy the same tag after your CI pushed a new image to it, select **Deploy**. Pinned tags are still the better practice.
## Common problems [#common-problems]
- **The manifest test fails with "denied" or "unauthorized"**: the image is private and the default registry is not the image's registry, or its token lacks read access. Add the registry and make it the default.
- **The deployment is Ready but the domain returns 502**: **Container port** doesn't match the port the process listens on. Fix it in **Settings** under **Command and ports**.
- **A published port fails to schedule**: another service on that node already holds the port. Choose a different **Published** port.
# Run a game or voice server
URL: https://stack.logicaltech.it/docs/deploy/game-servers/
Deploy Minecraft Java or Bedrock, Counter-Strike 2, TeamSpeak 3 or Mumble on LogiStack with published ports, an RCON console and DNS records.
A game server is a service kind for game and voice servers. LogiStack runs it on one node, publishes its ports on that node, keeps its world or data on a volume, and gives it a **Game** tab with live status, a console and the address players type. Use it for a Minecraft world for friends, a Counter-Strike 2 server, or a TeamSpeak or Mumble server for a team.
## Supported servers [#supported-servers]
| Server | Default ports | Clean hostname without a port | Notes |
|---|---|---|---|
| **Minecraft: Java Edition** | 25565/tcp | Yes, on any port (SRV `_minecraft._tcp`) | Vanilla, Paper, Fabric, Forge or NeoForge, with an RCON console |
| **Minecraft: Bedrock Edition** | 19132/udp | Only on 19132; Bedrock clients ignore SRV | For consoles, phones and Windows |
| **Counter-Strike 2** | 27015/udp | Only on 27015 | Dedicated server through SteamCMD, with RCON and game modes. amd64 only; needs about 60 GB of disk |
| **TeamSpeak 3** | 9987/udp voice, 30033/tcp file transfer | Yes (SRV `_ts3._udp`) | ServerQuery admin. amd64 only |
| **Mumble** | 64738/tcp and udp | Yes (SRV `_mumble._tcp`) | Open-source, low-latency voice chat |
## How players reach the server [#how-players-reach-the-server]
Game traffic is raw TCP or UDP, not HTTP, so it doesn't go through the Caddy proxy or the **Domains** tab. Players connect to a port published on the node that runs the server, in host mode, so the server sees each player's real IP for bans and rate limits.
Cloudflare's proxy (the orange cloud) and Cloudflare Tunnel carry web traffic only. Game DNS records stay DNS-only, so the node's IP is public.
A hostname such as `play.example.com` gets an A record pointing at the node. For games that read SRV records, LogiStack also writes an SRV record that carries the port, so players type just the hostname even on a non-default port. A second server on the same node uses the next free port; for Bedrock and CS2, players then type `host:port`.
## Create a game server [#create-a-game-server]
### Start a new service [#start-a-new-service]
Open the project and environment, select **New service**, choose **Game server** and select **Continue**.
### Choose a server [#choose-a-server]
On **Choose a server**, pick a **Game** (Minecraft Java, Minecraft Bedrock, Counter-Strike 2) or a **Voice server** (TeamSpeak 3, Mumble). Optionally set the **Service name**; it defaults to the game, like `minecraft` or `teamspeak`.
### Fill in the settings [#fill-in-the-settings]
The **Settings** step depends on the game. You can change these later from the service settings; a restart applies them.
- **Server software**: **Vanilla** (Mojang's own server), **Paper** (fast, with Bukkit and Paper plugins), Fabric, Forge or NeoForge.
- **Version**: **Latest release** follows each new release on restart. Pin one, like `1.21.4`, to keep mods working.
- **Message of the day**, **Game mode**, **Difficulty**, **Max players** (1 to 1000) and **Seed** (empty for a random world).
- **Whitelist**: only players you add can join. Add them from the console.
- **Online mode**: players sign in with a Microsoft account. Turn off only for offline LAN play.
- **PvP**: players can hurt each other.
- **Bedrock players** (Paper only): adds Geyser and Floodgate so phones and consoles join too, on an extra UDP port, 19132.
- Tick **I accept the Minecraft End User License Agreement**. LogiStack never accepts it for you.
- **Version**: **Latest release**, **Preview**, or a pinned version. Bedrock clients only join a server on their own version.
- **Server name**, **Game mode**, **Difficulty** and **Max players**.
- **Allow list**: only players you add can join.
- **Xbox sign-in**: players sign in with an Xbox account.
- **Cheats**: players with permission can run commands.
- Tick **I accept the Minecraft End User License Agreement**.
- **Server name**: shown in the community server browser.
- **Game mode**: Competitive, Casual, Deathmatch, Wingman or Arms Race.
- **Start map**, such as `de_dust2`, and **Max players** (2 to 64).
- **Workshop collection** (optional): a Steam Workshop collection ID whose maps load on the server.
- **Password**: players type a password LogiStack generates. Find it in the **Game** tab.
- **Game Server Login Token**: Valve lists a public server only with one. Create it at **Create a token on Steam** for App ID 730 and paste the 32-character token. It is stored encrypted and never shown again.
Without a license file, TeamSpeak runs one virtual server with up to 32 slots, free for non-commercial use. Tick **I accept the TeamSpeak server license agreement**. After the first start, create a **Server Admin key** from the **Game** tab.
- **Server name**, **Max users** and **Welcome message** (basic HTML works).
- **Password**: people type a password LogiStack generates. Find it in the **Game** tab.
### Choose node, port and memory [#choose-node-port-and-memory]
On **Node, port and memory**:
- **Node**: players connect to this node's address, and the world stays on its disk. Pick **The manager node** or another node by hostname and address. The wizard warns when the node has less disk than the game needs.
- **Port**: the primary port, from 1024 to 65535. Other ports shift by the same offset. The default port is suggested first.
- **Memory limit**: from 256 MB. For Minecraft Java, Java gets three quarters of it as heap. The container is stopped if it uses more.
### Choose the address [#choose-the-address]
On **Address**, pick **Hostname**:
- **IP address only**: players type the node IP and port.
- **Hostname via DNS provider**: enter a **Hostname** such as `play.example.com` and pick the **DNS provider**. LogiStack writes the A and SRV records for you. See [DNS providers](../networking/dns-providers.mdx).
- **Hostname, records by hand**: LogiStack shows the records to create at your DNS host.
### Review and create [#review-and-create]
Check the summary and select **Create and deploy**. The server starts right after, with fresh admin credentials.
## Check that it worked [#check-that-it-worked]
Open the service and select the **Game** tab. It shows:
- The status: **Online**, **Starting**, **Stopped** or **Not answering**, with the version, map and player count the server reports.
- **Players join at**: the address to share, like `play.example.com`. Use **Copy the join address**.
- **Console**: RCON commands for Minecraft and CS2, recorded in the audit log, such as `whitelist add Notch` or `changelevel de_inferno`.
- **Access**: the join password, the RCON or SuperUser password, and for TeamSpeak **Create admin key**. A privilege key makes whoever uses it Server Admin; use it once in your client.
- **Hostnames**: the records for each hostname. Add more with **Who writes the records**.
- **Ports** and **Node**. The node is pinned on first deploy.
Upload worlds, plugins and mods through the **Files** tab. See [Volumes and files](../data/volumes-and-files.mdx).
## Common problems [#common-problems]
- **Players can't connect**: open the published port in the node's or your cloud provider's firewall, for the right protocol (UDP for Bedrock, CS2 and TeamSpeak voice).
- **"The node or port moved; sync the records"**: the server moved, so its DNS records point at the old address. Sync them from the **Game** tab.
- **Bedrock or CS2 needs a port in the address**: those clients ignore SRV records. Only the server on the default port gets a clean hostname.
- **CS2 doesn't appear in the server browser**: add a **Game Server Login Token**.
- **CS2 or TeamSpeak doesn't start on an ARM node**: their images ship for amd64 only. Pick an amd64 node.
# Deploy services
URL: https://stack.logicaltech.it/docs/deploy/
The kinds of service LogiStack runs, from Git repositories and Docker images to databases, Compose stacks, templates and game servers.
A service is one thing LogiStack runs inside an environment: an app built from Git, a published Docker image, a managed database, a Compose stack, an object storage server, a game server or a web server. This section explains each source, how a deployment rolls out, and the settings you change afterwards. Read it when you add something new to a project or need to change how an existing service builds and runs.
## How services are organized [#how-services-are-organized]
Every service lives in an environment, and every environment lives in a project. A new project starts with a **Production** environment. Services in the same environment share a private network and reach each other by service name, so an app reaches a database called `postgres` at `postgres:5432`.
LogiStack stores the desired state of each service in Postgres. A worker converges Docker Swarm and the Caddy proxy to that state, so every operation is safe to repeat.
## Add a service [#add-a-service]
### Open the project [#open-the-project]
Select **Projects** in the sidebar, then open your project. Pick the environment from the environment list.

### Start the wizard [#start-the-wizard]
Select **New service**. The **Choose a source** step lists every kind of service.

### Pick a source and follow the steps [#pick-a-source-and-follow-the-steps]
Choose a source and select **Continue**. Each source has its own steps, described in the pages below. The last step is always **Review**: nothing is created until you select **Create and deploy**.
## Sources [#sources]
| Source in the wizard | What it creates | Page |
|---|---|---|
| **Git repository** | An application built on every push with a Dockerfile or Railpack | [Deploy from Git](./from-git.mdx) |
| **Docker image** | An application that runs a published image | [Deploy a Docker image](./from-image.mdx) |
| **Database** | PostgreSQL, MySQL, MariaDB, MongoDB, Redis or libSQL with generated credentials | [Databases](./databases.mdx) |
| **Docker Compose** | A stack: one service per compose service, deployed together | [Compose stacks](./compose-stacks.mdx) |
| **Object storage** | An S3-compatible server with buckets and scoped keys | [Object storage](../data/object-storage.mdx) |
| **Game server** | Minecraft, Counter-Strike 2, TeamSpeak 3 or Mumble | [Game servers](./game-servers.mdx) |
| **Web server** | Nginx, Caddy, Apache or an HAProxy load balancer, with its config editable from the **Files** tab | [Volumes and files](../data/volumes-and-files.mdx) |
| **Templates** | Over 500 ready-made apps with their databases and secrets | [Templates](./templates.mdx) |
## After the first deployment [#after-the-first-deployment]
Each service page has tabs for its day-to-day work. The ones in this section:
- **Deployments**: history and live build logs. See [Deployments](./deployments.mdx).
- **Environment**: variables and secrets, including references to [external secrets](./external-secrets.mdx) in Vault, Infisical or 1Password. See [Environment variables](./environment-variables.mdx).
- **Settings**: source, build, resources, healthcheck, ports and placement. See [Service settings](./service-settings.mdx).
For the organization-wide build setup, see [Build platforms](./build-platforms.mdx) and [Registries](./registries.mdx). To give every pull request its own copy of a project, see [Preview environments](./preview-environments.mdx). To scale a service with its load, see [Autoscaling](./autoscaling.mdx). To stop a whole project without deleting it, see [Archive a project](./archive-projects.mdx).
# Preview environments for pull requests
URL: https://stack.logicaltech.it/docs/deploy/preview-environments/
Give every pull request its own live LogiStack environment with its own URL, cloned from staging or production and removed when the pull request closes.
A preview environment is a temporary copy of a project for one pull request. When someone opens a pull request, LogiStack clones an environment you choose into `pr-`, builds the pull request's head commit, gives each exposed service its own URL and posts the URLs on the pull request. Docker Compose stacks come along too: a stack deployed from Git can read its compose file from the pull request's branch. Closing or merging the pull request removes the copy. Use previews so reviewers can click through a change before it merges.
## Before you start [#before-you-start]
- Connect the repository through a Git provider that sends pull request events: GitHub, GitLab, Gitea or Bitbucket. See [Deploy from Git](./from-git.mdx#connect-a-git-provider).
- Have an environment to clone, usually **Staging**, with at least one service or Compose stack that comes from that repository. A stack must be deployed from Git to follow pull requests; see [Compose stacks](./compose-stacks.mdx).
## Turn on previews [#turn-on-previews]
### Open Preview deployments [#open-preview-deployments]
Open the project, open the actions menu in the project header and select **Preview deployments…**.

### Choose what a preview runs [#choose-what-a-preview-runs]
On **What a preview runs**:
- **Clone from**: the environment each preview copies. Every preview starts with its services, stacks and variables. Volumes and databases are never shared: each preview gets empty ones.
- **What follows the pull request**: tick the Git services that should build the pull request's head commit, for example `web` and `api`, and the Git stacks that should read their compose file from the pull request's branch. Everything else runs what the source runs. Pull requests on these repositories open previews.
Every stack of the source environment is copied into the preview as a stack of its own, with new services, new volumes and Docker names derived from their new IDs. A followed stack reads `docker-compose.yml` from the pull request's branch, so a pull request that adds a service to the compose file previews that service too, and its `build:` services build the branch. Other stacks run the compose file the source runs.
### Choose where it is reached [#choose-where-it-is-reached]
On **Where it is reached**, every service the source exposes on a domain gets one in the preview. Pick **Preview hostnames**:
- **Generated**: each service gets an sslip.io or wildcard hostname of its own. Nothing to configure.
- **A pattern**: readable hosts on a domain you point at this server. The **Pattern** must include `{number}`, and can use `{service}` and `{wildcard}`.
```text title="Pattern examples"
pr-{number}-{service}.{wildcard}
pr-{number}-{service}.preview.example.com
```
Use `{service}` when the preview has more than one exposed service, such as a stack with `web` and `api`: without it, the first service takes the host and the others get generated ones. A stack service is exposed in the preview when its counterpart in the source has a domain, on the same port.
For `pr-{number}-{service}.preview.example.com`, create a wildcard DNS record `*.preview.example.com` pointing at the server. See [Wildcard DNS](../networking/wildcard-dns.mdx).
### Override variables [#override-variables]
On **Variables**, add the variables that must differ in a preview, such as a test payment key or a public URL. They win over every definition in the source environment. Values are stored as secrets; when you edit later, a stored value shows **Stored; type to replace**.
```text title="Typical overrides"
STRIPE_SECRET_KEY sk_test_51H...
PUBLIC_URL https://pr-42.preview.example.com
```
### Set limits and safety [#set-limits-and-safety]
On **Limits and safety**:
- **At most**: how many previews run at once, 1 to 50 (default 5). A pull request opened past the limit gets no preview until one closes.
- **Remove after**: hours without a commit, up to 90 days (default 72). Closing or merging removes the preview at once.
- **Preview pull requests from forks**: off by default. Leave it off for public repositories.
- **Previews on**: turning previews off stops new ones; running ones stay until their pull request closes.
With forks allowed, anyone who can fork the repository can run code on your server. A fork's pull request is built and started with the preview's variables, secrets included, so its author can read every one of them and use the server's network. Only allow this when every fork author is trusted.
### Review and turn on [#review-and-turn-on]
Check the summary and select **Turn on previews**. Later edits use **Save changes**.
## Reach one service from another [#reach-one-service-from-another]
Every container of a preview, stack services included, gets the preview's URLs as variables:
| Variable | Value |
|---|---|
| `LOGISTACK_PREVIEW_URL` | The preview's main URL: that of the first followed service with a domain |
| `LOGISTACK_PREVIEW_URL_` | The URL of each exposed service, by its name in upper case with dashes as underscores |
For a stack with `web` and `api` and the pattern `pr-{number}-{service}.preview.example.com`, pull request 42 sets `LOGISTACK_PREVIEW_URL_API=https://pr-42-api.preview.example.com` in both containers. Point the front end at its API with it:
```yaml title="docker-compose.yml"
services:
web:
build: .
environment:
API_URL: ${LOGISTACK_PREVIEW_URL_API:-https://api.example.com}
```
Compose fills `${...}` when LogiStack reads the file, before the variable exists, so the default applies there. Read `LOGISTACK_PREVIEW_URL_API` at runtime in your app instead, or add a preview variable override on **Variables**. A container reads the variables when it starts: when a new pull request commit adds an exposed service, LogiStack redeploys the preview's other services so they see its URL.
## Check that it worked [#check-that-it-worked]
Open a pull request on the repository. Then:
- A new environment `pr-` appears among the project's environments.
- A comment on the pull request shows the preview URLs. LogiStack keeps it up to date as you push.
- Each push to the pull request's branch redeploys the followed services. A followed stack re-reads its compose file and redeploys what changed and every service it builds.
Select the preview's environment tab to see its pull request, commit and each service's URL. From the environment's menu, **Open preview** opens the main URL and **Pull request #<number>** opens the pull request.
## How a preview is removed [#how-a-preview-is-removed]
A preview is deleted, with its volumes and databases, when:
- The pull request is closed or merged.
- No pull request event touched it for the **Remove after** hours.
## Common problems [#common-problems]
- **No preview appears**: the pull request isn't on the repository of a followed service, the limit in **At most** is reached, or the pull request comes from a fork and forks are off.
- **No comment on the pull request**: for GitHub, the app needs read and write access to **Pull requests**; for GitLab, Gitea and Bitbucket, the token needs write access.
- **The preview can't reach its database**: each preview gets an empty database. Run migrations with a pre-deploy command, and seed data in it if your app needs some. See [Deployments](./deployments.mdx#release-commands).
- **"Include `{number}`, so each pull request gets its own host"**: add `{number}` to the pattern.
- **"A stack did not follow the last commit"** on the preview's tab: the stack's compose file on the pull request's branch can't run, or can't be read. The message says why; the rest of the preview runs, and the stack keeps what it ran. Push a fix to the pull request. The stack's own page shows the same reason.
- **A stack service has no URL**: only services whose counterpart in the source has a domain get one. Add a domain to the service in the source environment.
# Container registries
URL: https://stack.logicaltech.it/docs/deploy/registries/
Use LogiStack's built-in registry or connect GHCR, Docker Hub or any OCI registry for built images, with retention, a default registry and private image pulls.
A registry is where LogiStack pushes the images it builds and where every node pulls them from. A single server can build and run without one, but a swarm with more than one node, and any multi-architecture build, needs a registry. LogiStack can run its own registry on your server, or push to GitHub Container Registry, Docker Hub or any OCI registry.
## How LogiStack uses registries [#how-logistack-uses-registries]
- Builds push to the **default** registry, as `//:`. Tags are immutable, so a rollback pulls exactly the image it names.
- Nodes pull with the default registry's credentials.
- An [image service](./from-image.mdx) gets those credentials only when its image lives on the default registry's host. Pulls from any other host are anonymous.
- Each registry keeps the newest N images of each service. Older ones are deleted by an hourly prune, so rollbacks reach that far back.

## Use the local registry [#use-the-local-registry]
The local registry runs on your own server, behind the proxy, with generated credentials. Images never leave your servers.
### Open Registries [#open-registries]
Select **Registries** under **Integrations** in the sidebar.
### Turn it on [#turn-it-on]
Under **Local registry**, turn on **Registry on this server**. Turning it on makes it the default. The worker brings it up within about 30 seconds.
It needs the instance domain from setup, because it is served on `registry.`, for example `registry.srv1.example.com`.
### Log in from your machine (optional) [#log-in-from-your-machine-optional]
Select **Show credentials for docker login** to copy the username, the password, or the whole `docker login` command. Docker asks for the password; it never goes on the command line.
```bash
docker login registry.srv1.example.com
```
To turn it off, switch the toggle off and choose:
- **Keep images**: turn it back on later and every image and credential is still there.
- **Delete images and credentials**: frees the disk. Rollbacks to images built here stop working. This can't be undone.
Running services keep running either way. Choose another default before the next build.
## Add an external registry [#add-an-external-registry]
### Start the wizard [#start-the-wizard]
On **Registries**, select **Add registry**.

### Choose a registry [#choose-a-registry]
Pick **GitHub Container Registry**, **Docker Hub** or **Any OCI registry** (GitLab, Harbor, Zot, ECR behind a proxy, or your own `registry:2`). Select **Continue**.
### Enter credentials [#enter-credentials]
Credentials are stored encrypted. Nodes use them to pull, builds to push.
1. Select **Create a token on GitHub** and create a **classic** personal access token with **write:packages**. Add **read:packages** to pull private images from other accounts, and **delete:packages** so retention can remove old images.
2. Enter your **GitHub username** and paste the **Personal access token** (`ghp_…`).
3. Optionally set **Namespace**: your user or an organization, such as `acme-retail`. Images go to `ghcr.io/acme-retail/`.
1. Select **Create a token on Docker Hub** and create a personal access token with **Read & Write**. Use **Read, Write & Delete** if retention should remove old images.
2. Enter your Docker ID and paste the **Access token**.
3. Set **Namespace** to your Docker ID or an organization, such as `acmeretail`. Images go to `docker.io/acmeretail/`.
1. Enter the **Address**: host, optional port and namespace, like `registry.example.com:5000/acme`. HTTPS is required.
2. Enter a username and a **Password or token**, or leave both empty for an open registry.
### Test push and pull [#test-push-and-pull]
On **Test push and pull**, LogiStack logs in, pushes a test image and pulls it back. Nothing is saved until the test passes and you confirm.
### Set options [#set-options]
On **Options**:
- **Make it the default**: new builds push here instead of the current default.
- **Images to keep**: keep last N images per service, 1 to 500. The newest images of each service survive the hourly prune.
### Add it [#add-it]
On **Review**, select **Add registry**.
## Change the default or retention [#change-the-default-or-retention]
Under **Push to**, select the radio next to a registry to make it the default (builds push to the default). Change **Keep last … images per service** next to any registry.
## Remove a registry [#remove-a-registry]
Select the trash icon next to the registry, then **Remove registry**. Images already pushed stay in the registry. Builds stop pushing to it, and if it was the default there is no default until you choose one.
## Check that it worked [#check-that-it-worked]
Deploy a Git service. The log shows the push to the new registry:
```text
==> pushing ghcr.io/acme-retail/web:dep_8k2p1q
```
## Common problems [#common-problems]
- **The test fails with "denied"**: the token lacks write access (`write:packages` on GHCR, **Read & Write** on Docker Hub), or the namespace belongs to someone else.
- **Old images aren't deleted**: the token can't delete. Use `delete:packages` on GHCR or **Read, Write & Delete** on Docker Hub.
- **`a multi-node swarm needs a registry`**: turn on the local registry or add one and make it the default.
- **The local registry can't be turned on**: it needs the instance domain from setup. See [Setup wizard](../getting-started/setup-wizard.mdx).
# Service settings
URL: https://stack.logicaltech.it/docs/deploy/service-settings/
Change a LogiStack service's source, build, CPU and memory limits, scaling, health check, ports, placement and command, and stop, restart or delete it.
The **Settings** tab holds everything that defines how a service builds and runs: its source, build, resources, health check, ports, host access and placement. Most changes apply on the next deployment, so you can edit several settings, review the diff and roll them out together. Use this page when a service needs more memory, more replicas, a health check, or a different branch.
## The Overview tab [#the-overview-tab]
Open a service to land on **Overview**. It shows each replica with its node and container, the **State** (**Desired**, **Observed**, **Replicas**, **Last observed**), the **Running image** with the latest deployment, and the service's **Domains**.

## Edit settings [#edit-settings]
### Open Settings [#open-settings]
Open the service and select **Settings**.

### Change the fields [#change-the-fields]
Edit any section described below. A bar appears at the bottom with **Unsaved changes**, or the first problem to fix.
### Save [#save]
Select **Save**, or **Discard** to drop the edits. The header then shows **Review changes** and a count on **Deploy**.
### Deploy [#deploy]
Select **Review changes** to check the diff, then **Deploy changes**. See [Deployments](./deployments.mdx#review-changes-before-deploying).
## General [#general]
- **Name**: shown across the dashboard. Docker objects are named from the service id, so renaming moves nothing.
- **Icon**: the logo shown for the service. It is saved as soon as you pick one. The default follows the engine or image.
## Source and build [#source-and-build]
Applies from the next deployment.
- For a Git service: **Repository**, **Branch**, **Root directory** and **Builder** (**Railpack (detect)**, **Dockerfile** or **Static site**). With **Dockerfile**, also **Dockerfile**, **Build context** and **Target stage**. See [Build types](./build-types.mdx).
- For an image service: **Image**, pulled at each deploy. Pin a tag or digest to keep deploys reproducible.
- **Architectures**: **Automatic**, **amd64 only**, **arm64 only**, or **amd64 and arm64** for a Dockerfile. See [Build platforms](./build-platforms.mdx).
Git services also have **Deploy triggers** here. See [Deploy from Git](./from-git.mdx#deploy-triggers).
## Resources [#resources]
Limits per replica. Swarm only schedules a replica on a node with this much to spare.
- **Profile**: copies a resource profile's limits. Editing the profile later leaves this service as it is.
- **CPU**: cores; `0.5` is half a core. Empty is unlimited.
- **Memory**: megabytes, such as `512`. Empty is unlimited. A replica that goes over the limit is stopped.
```text title="Example: size an API"
CPU: 0.5
Memory: 512
```
## Scaling [#scaling]
How many copies of the service run. Applications only; a database runs one.
- **Fixed**: **Copies** sets how many always run. It is saved with the rest of the form.
- **Automatic**: LogiStack adds and removes copies with the CPU load, between a minimum and a maximum. See [Scale a service automatically](./autoscaling.mdx).
More than one copy needs a stateless app: no volume and no published host port. Keep sessions and uploads in a database, Redis or [object storage](../data/object-storage.mdx).
## Healthcheck and drain [#healthcheck-and-drain]
A new replica takes traffic, and a rollout continues, only once the check passes.
- **Check**: **None**, **HTTP request** (a **Port** and a **Path**, such as `3000` and `/healthz`), **TCP connect** (a **Port**) or **Command** (one argument per line; exit 0 is healthy).
- **Drain timeout**: seconds a replica being replaced gets after `SIGTERM` to finish its requests. 10 when empty, up to 3600.
With **None** and a domain, LogiStack still checks that the container listens on its first port, so a replica takes traffic only once the app is up.
```text title="Example: HTTP health check"
Check: HTTP request
Port: 3000
Path: /healthz
```
### Images without a shell [#images-without-a-shell]
**HTTP request**, **TCP connect** and the default check run through `/bin/sh` inside the container. Distroless and `scratch` images have no shell, so LogiStack looks for `/bin/sh` in the image on each deploy:
- With **None**, it skips the default check. A replica counts as healthy as soon as it runs, and the deployment log says so.
- With **HTTP request** or **TCP connect**, the deployment fails with "the image has no /bin/sh". Switch to **Command**.
For a real check on such an image, use **Command** with a program the image has. Most often that is your own binary with a health flag:
```text title="Example: command check for a distroless Go app"
Check: Command
Command: /api
-healthcheck
```
## Release commands [#release-commands]
One-off runs of the new image around each rollout, like database migrations. See [Deployments](./deployments.mdx#release-commands).
## Command and ports [#command-and-ports]
- **Command**: one argument per line, run without a shell. Leave it empty to run the image's own command.
- **Published ports**: for traffic outside the proxy. A published port binds on the node running the replica (**Its node**), or on every node through the routing mesh (**Every node**). Domains don't need one.
```text title="Command"
node
server.js
--port
3000
```
## Host access [#host-access]
Host directories mounted into the container, the user it runs as, its kernel capabilities, and when Swarm restarts it.
- **Bind mounts**: **Host path** to **Container path**, optionally read-only. They pin the service to the node that holds them and aren't backed up. Only admins can save them; paths like `/etc` or the Docker socket need explicit admin confirmation.
- **Run as**: numeric `uid` or `uid:gid`, such as `1000:1000`.
- **Restart**: **Always**, **On failure** or **Never**.
- **Add capabilities** and **Drop capabilities**: Linux capabilities without the `CAP_` prefix.
## Placement [#placement]
Where replicas may run. Pinning keeps a service with local data on one node.
- **Node**: **Any node**, or one node by hostname.
- **Constraints**: Swarm constraints, one per line.
```text title="Constraints"
node.labels.region==eu
node.role==worker
```
Add labels to nodes from **Monitoring** › **Nodes**. See [Nodes](../operations/nodes.mdx).
## Alerts [#alerts]
Under **Alerts**, add thresholds for CPU or memory (as a percentage of the limit, or in MB when no memory limit is set). Crossing a limit emits a `service.threshold` event that your notification rules can send to Slack, email or another channel. See [Alerts and notifications](../operations/alerts-and-notifications.mdx).
## Stop, restart and start [#stop-restart-and-start]
These are in the service header and apply at once:
- **Stop**: scales to zero replicas and removes the domains from the proxy. Data, volumes and configuration stay. Confirm with **Stop service**.
- **Start**: brings a stopped service back.
- **Restart**: replaces each replica on the current image, one at a time, new one first. No build runs. It needs one healthy deployment first.
## Delete a service [#delete-a-service]
At the bottom of **Settings**, under **Delete this service**, select **Delete service**, type the service name and confirm. Its replicas, domains, variables and deployment history go. Named volumes are kept until you remove them.
Deleting a service cannot be undone. Back up a database first. See [Backups](../data/backups.mdx).
## Common problems [#common-problems]
- **"Needs one healthy deployment first"** on **Restart**: the service never reached **Ready**. Select **Deploy** instead.
- **A replica stays pending**: no node has the CPU or memory the limits ask for, or the constraints match no node. Lower the limits or fix the constraints.
- **The save bar shows a field error**: the message names the field, for example `user: must be uid or uid:gid`. Fix it and save again.
# Deploy an app from a template
URL: https://stack.logicaltech.it/docs/deploy/templates/
Deploy n8n, Plausible and over 500 other self-hosted apps from the LogiStack template catalog, with their databases, volumes and generated secrets.
A template is a ready-made recipe for a self-hosted app: its containers, databases, volumes, domain and the secrets it needs. Deploying one creates every service in one step and wires them together on the environment's network. Use templates when you want a known app like n8n, Plausible or Uptime Kuma running without writing a compose file.
## What a template contains [#what-a-template-contains]
The catalog ships with LogiStack in `packages/templates/catalog`, one JSON file per app, over 500 in all. Each template declares:
- **Services**: applications with a pinned image (never a floating tag like `latest`) and managed databases (PostgreSQL, MySQL, MariaDB, MongoDB, Redis or libSQL).
- **Inputs**: values you can set, such as the public URL. Passwords, keys and UUIDs are generated for you.
- **Volumes and files**: where each service keeps its data, and config files written into the container.
- **Start order**: which services start after which.
- **Source and license**: most templates are adapted from the Coolify or Dokploy catalogs. The detail page names the upstream file and its license.
Database passwords, admin passwords and API tokens are inputs of a generated type (password, secret, base64 or UUID), so each deploy gets its own values. Public URLs built from your domain use `https://`.
Env values in a template reference inputs with `${{ inputs. }}` and sibling services with `${{ services..host }}`. For example, the YOURLS template sets:
```json title="packages/templates/catalog/yourls.json (excerpt)"
"env": {
"YOURLS_SITE": "https://${{ inputs.mainDomain }}",
"YOURLS_PASS": "${{ inputs.adminPassword }}",
"YOURLS_DB_HOST": "${{ services.yourls-mysql.host }}",
"YOURLS_DB_PASS": "${{ inputs.mysqlPassword }}"
}
```
## Community templates [#community-templates]
Besides the catalog that ships with your release, the gallery can list templates from a community index. They carry a **Community** badge and the index's host, as in "From templates.example.com", and deploy the same way as built-in ones.
- **Only on Refresh.** LogiStack fetches the index only when someone selects **Refresh community** on the project's **Templates** page, which needs the Write action on the organization. It never fetches on a timer. Hover the button to see how many templates were fetched, from where and when.
- **Signed.** The index answer is signed with Ed25519, like the [plugin index](../plugins/publish.mdx#run-a-private-index). A tampered or unsigned answer is refused and the previous copy is kept.
- **Checked against your release.** Entries that do not match this release's template format, or that reuse the id of a built-in template, are skipped. Community entries show no logo.
The instance reads one index, set by the `LS_TEMPLATE_INDEX_URL` and `LS_TEMPLATE_INDEX_KEYS` (comma-separated base64url Ed25519 public keys) environment variables of the api. Until a key is set, **Refresh community** fails with `no public key for the community index: set LS_TEMPLATE_INDEX_KEYS` and the gallery lists only the built-in catalog.
## Deploy a template [#deploy-a-template]
### Open the template gallery [#open-the-template-gallery]
Open the project and environment, select **New service**, then select the **Templates** tile at the bottom of **Choose a source**.
The gallery opens on **New from a template**, scoped to the current project and environment.

### Find the app [#find-the-app]
Type in **Search by name, tag or purpose**, for example `n8n`, `analytics` or `backups`, or filter by category: **AI**, **Analytics**, **Automation**, **CMS**, **Communication**, **Databases**, **Dev tools**, **Finance**, **Media**, **Monitoring**, **Networking**, **Productivity**, **Security**, **Storage** or **Other**. Each card shows how many services the template creates. Select the card.
### Check what it creates [#check-what-it-creates]
The **What it creates** step lists every service with its image, its public port, its volumes and what it starts after. **Website** and **Docs** link to the upstream project. Select **Continue**.

### Fill in the settings [#fill-in-the-settings]
On **Settings**, only the required fields need an answer:
- **Address** › **Public URL**: your own hostname, such as `n8n.example.com`. Leave it empty to get a generated address like `n8n-a1b2c3.203-0-113-10.sslip.io`.
- **Required**: values the app can't guess, such as an admin email.
- **Credentials**: passwords and keys marked **Auto-generated**. They are generated when you deploy and stored as secret variables. Select **Set my own** only if you need a known value, and **Generate instead** to go back.
- **Optional settings**: extra values with safe defaults, such as **Timezone**, which defaults to `UTC`.
### Review and deploy [#review-and-deploy]
The **Review** step shows each service, the public URL, and which values you set versus which are auto-generated. Select **Deploy**.
## Check that it worked [#check-that-it-worked]
After **Deploy**, the page follows each service's first deployment. Services start in dependency order. When every service is healthy you see **Every service is healthy.** with links to the app's URL, **Open the stack** and **Go to the environment**.
The template becomes a stack in the environment. Its **Overview** tab lists the containers, and the **Compose** tab shows the effective compose of what runs. See [Compose stacks](./compose-stacks.mdx).
## Find the generated secrets [#find-the-generated-secrets]
Generated passwords, keys and tokens live as secret variables on the services that use them. Open the service (for example `n8n`), select **Environment**, and reveal the value with the eye icon. You need permission to read secrets. See [Environment variables](./environment-variables.mdx).
## Common problems [#common-problems]
- **"Production already has a service named postgres"**: each service keeps its template name, because the others reach it by that name. Deploy the template into another environment, or create a new one. See [Environments](./environments.mdx).
- **"Nothing new was created"**: you deployed the same template with the same name into the same environment again. LogiStack returns the services from the first deploy instead of creating duplicates.
- **Mail or cloud storage doesn't work**: a few templates keep placeholder values for outside services, such as `SMTP_PASSWORD` or `AWS_SECRET_ACCESS_KEY`. Set the real values under the service's **Environment** tab and redeploy.
- **A service failed**: open it, read its deployment log in **Deployments**, fix the setting there and redeploy.
- **The custom domain shows a certificate error**: the DNS record doesn't point at the server yet. See [Domains](../networking/domains.mdx).
# Concepts
URL: https://stack.logicaltech.it/docs/getting-started/concepts/
How LogiStack organizes your work into organizations, folders, projects, environments and services, and how it converges Docker Swarm and Caddy.
This page explains the objects you work with in LogiStack and how the platform turns them into running containers. Read it before your first deploy, or when a term in the dashboard is unclear.
## The hierarchy [#the-hierarchy]
Everything you create belongs to one tree:
```text
Organization: Logical
├── Folder: Clients
│ └── Folder: Acme Retail
│ └── Project: Storefront
│ ├── Environment: Production
│ │ ├── Service: web (application, from Git)
│ │ ├── Service: postgres (database)
│ │ └── Service: media (object storage)
│ └── Environment: Staging
│ └── Service: web
└── Project: Status page (no folder)
└── Environment: Production
└── Service: uptime
```
### Organization [#organization]
The top level. Members, roles, integrations (Git providers, registries, DNS providers, backup destinations, log drains, secret providers, notification channels) and API keys belong to an organization. The setup wizard creates the first one. See [Members and invitations](../team/members-and-invitations.mdx).
### Folder [#folder]
An optional way to group projects, usually by client or team. Folders nest one level deep: a top-level folder can hold subfolders, and a subfolder cannot. A project can also sit at the top level with no folder. Permissions granted on a folder apply to every project inside it.
### Project [#project]
A project is one product or app, such as a shop, an API or an analytics install. It holds environments. A new project starts with a **Production** environment.
### Environment [#environment]
An environment is an isolated set of services, variables and domains inside a project. Each environment has a kind:
| Kind | Use it for |
| --- | --- |
| `production` | What your users see. |
| `staging` | A copy for testing before release. |
| `preview` | A short-lived environment for one pull request. LogiStack creates and removes these for you. See [Preview environments](../deploy/preview-environments.mdx). |
| `custom` | Anything else, such as `qa` or `demo`. |
Services in one environment reach each other by name on a private network (`postgres:5432` from `web`). Services in different environments cannot reach each other. See [Environments](../deploy/environments.mdx).
### Service [#service]
A service is one thing that runs: an app, a database, a storage server or a game server. Every service has a kind:
| Kind | What it is |
| --- | --- |
| `application` | Your code, built from a Git repository with a Dockerfile, Railpack or as a static site, or a published Docker image. Web servers (Nginx, Caddy, Apache, a load balancer) are applications too. |
| `database` | A managed PostgreSQL, MySQL, MariaDB, MongoDB, Redis or libSQL instance with generated credentials, backups and the [database editor](../data/database-editor.mdx). |
| `compose` | A container that belongs to a compose stack (see below). |
| `storage` | S3-compatible object storage: MinIO, RustFS, Garage or SeaweedFS. See [Object storage](../data/object-storage.mdx). |
| `game` | A Minecraft, Counter-Strike 2, TeamSpeak or Mumble server with a console. See [Game servers](../deploy/game-servers.mdx). |
A service has a **desired state** (`running` or `stopped`) that you set with **Deploy**, **Stop** and **Restart**, and an **observed state** that LogiStack reads from Docker: `running`, `starting`, `unhealthy`, `stopped`, `failed` or `unknown`. The dashboard shows both, for example "Running 2/3" when two of three replicas are up.
### Stack [#stack]
A stack is a group of services created together from one compose file. It comes from a template in the catalog, a `docker-compose.yml` you paste, or a compose file in a Git repository. Each compose service becomes a LogiStack service in the same environment, and official database images become managed databases. See [Compose stacks](../deploy/compose-stacks.mdx) and [Templates](../deploy/templates.mdx).
## Deployments [#deployments]
A deployment is one attempt to release a new version of a service. It records who or what started it (`manual`, `git_push`, `webhook`, `rollback`, `schedule` or `api`), the commit, the image and the full log. It moves through these states:
```text
queued → cloning → building → pushing → deploying → healthy
```
- `cloning`, `building` and `pushing` apply to Git sources only. An image source goes straight from `queued` to `deploying`.
- `awaiting_checks` holds a push until the commit's CI checks pass. `releasing` runs a pre-deploy command on the new image while the old version keeps serving.
- A deployment ends `healthy`, `failed`, `cancelled`, `superseded` (a newer deployment replaced it) or `skipped` (for example, the commit message contains `[skip ci]`).
The old version serves traffic until the new one passes its health check. If the new tasks fail, Docker Swarm rolls the service back. See [Deployments and rollbacks](../deploy/deployments.mdx).
## Domains [#domains]
A domain routes a hostname to a port of a service, for example `shop.acme-retail.it` to port `3000` of `web`. A domain can be:
- **Generated**: a hostname under the instance's base domain, such as `web-x7k2p9.srv1.example.com` or `web-x7k2p9.203-0-113-7.sslip.io`. It works without any DNS change.
- **Custom**: your own hostname. You point a DNS record at the server, or a connected DNS provider creates it.
HTTPS certificates come from Let's Encrypt. See [Domains](../networking/domains.mdx) and [HTTPS certificates](../networking/https-certificates.mdx).
## Nodes [#nodes]
A node is a server in the cluster. The server you install on is the first node and a Swarm manager. You can add more servers from **Monitoring**. Each node runs the LogiStack agent, which reports metrics and streams logs. A node is `pending`, `ready`, `draining` or `down`. A service with a volume is pinned to the node that holds the volume. See [Nodes](../operations/nodes.mdx).
## How LogiStack applies changes [#how-logistack-applies-changes]
LogiStack keeps the **desired state** of every resource in its Postgres database: which services should run, with which image, replicas, variables and domains. A **reconciler** in the worker compares that with what Docker Swarm and the Caddy proxy actually run, and changes only the difference. It runs when you change something, and again every 30 seconds as a safety net.
This has practical effects:
- **Every operation is safe to repeat.** If a server restarts in the middle of a deploy, the next reconcile pass finishes the job instead of leaving a half-applied change.
- **Drift is repaired.** If someone removes a LogiStack service by hand with `docker service rm`, the reconciler creates it again.
- **LogiStack only touches its own objects.** Every Docker service, network and volume it creates carries the label `logistack.managed=true` and a `logistack.resource` label with the resource ID. Docker names derive from IDs (`ls-svc-`), never from the names you type, so renaming a service never breaks it. Containers you run yourself on the same server are left alone.
- **The proxy never restarts to pick up a route.** The worker compiles every active domain into one Caddy configuration and loads it through Caddy's admin API. If the new configuration is invalid, Caddy keeps the old one and the domain shows the error.
### Immutable image tags [#immutable-image-tags]
Each build is pushed with the deployment ID as its tag:
```text
registry.srv1.example.com//:dep_k3m9x2
```
LogiStack never deploys a moving tag such as `:latest` for code it builds. A rollback points the service back at an earlier tag that still exists in the registry, so it does not rebuild anything. For image sources, pin a version yourself (`ghcr.io/acme/api:1.4.2`) for the same reason.
## Permissions [#permissions]
Access follows the same tree. A role granted on an organization applies to every folder, project, environment and service below it; a grant on a project applies only to that project. The built-in roles are owner, admin, developer and viewer, and you can create custom roles. See [Roles and permissions](../team/roles-and-permissions.mdx).
# Tour of the dashboard
URL: https://stack.logicaltech.it/docs/getting-started/dashboard-tour/
Find your way around the LogiStack dashboard, from Home and Projects to Monitoring, Domains, Storage, Integrations, Settings and the command menu.
This page walks through the LogiStack dashboard so you know where each feature lives. Every page has the same frame: the sidebar on the left, a top bar with breadcrumbs and search, and the page itself. Read it after your first sign-in.

## The frame [#the-frame]
### Sidebar [#sidebar]
The sidebar has three groups: the main areas at the top, **Integrations** and **Settings**. Its header shows the current organization and your role in it, for example "Logical, Owner". Select it to switch organizations. When an installed [plugin](../plugins/index.mdx) adds pages, a **Plugins** group lists them between the main areas and **Integrations**. **Tasks** lists My tasks, Inbox and your projects with their open-task counts. See [Tasks](../tasks/index.mdx).
A [Project manager](../tasks/roles.mdx) or a guest sees a smaller sidebar with only My tasks, Inbox, Projects and Time.
At the bottom, the sidebar shows:
- **Node health**, such as `3/5 nodes`, with a colored dot. It is green when every node is ready and red when one is down. Hover for the names of nodes that are down, or select it to open **Monitoring**.
- **The running version**, such as `v0.1.0`.
- **The update notice**, when a newer release exists (see below).
Press Cmd+B (Ctrl+B on Windows and Linux), or select the panel icon at the left of the top bar, to collapse the sidebar to icons.
### Top bar [#top-bar]
- **Breadcrumbs** show where you are, for example **Projects > Storefront > web**. Select a crumb to go back up.
- **Search…** opens the command menu.
- The **theme** button switches between light and dark.
- Your **avatar** opens a menu with **Account and security** (password, passkeys, two-factor) and **Sign out**.
### Command menu [#command-menu]
Press Cmd+K (Ctrl+K on Windows and Linux), or select **Search…**, to open the command menu. Type to filter, use the arrow keys to move, and press Enter to run.
| Group | What it holds |
| --- | --- |
| **Actions** | **New project**, **New folder**, and **Switch to light theme** or **Switch to dark theme**. |
| **Projects** | Every project you can see, matched by name or description. |
| **Go to**, **Integrations**, **Settings** | Every page in the sidebar. Pages also match related words: typing `cron` finds **Schedules**, `dns` finds **Domains**, `minio` finds **Storage**. |
For example, press Cmd+K, type `store`, and press Enter to open the Storefront project.
### Update notice [#update-notice]
When a new LogiStack release is out, a card appears above the sidebar footer: "v0.2.0 available, You run v0.1.0." It has two buttons:
- **Update** (owners and admins only) asks for confirmation and starts the update. LogiStack pulls every image first and changes nothing if one is missing. A service that does not turn healthy rolls back. While it runs, the card reads "Updating to v0.2.0" and the dashboard may blink while the API restarts.
- **What's new** opens **Settings > Updates** with the release notes. During an update it reads **Follow progress**.
See [Updates](../operations/updates.mdx).
## Main areas [#main-areas]
### Home [#home]
What is running, what failed and what needs you. Home shows:
- A banner when LogiStack finds Dokploy or Coolify on the server, with **Start migration**.
- **Services**: how many services run across how many projects, with a bar split by state (Running, Starting, Unhealthy, Failed, Stopped).
- **Projects**: each project with one small bar per service, colored by state, and the overall status. **All projects** opens the Projects page.
- **Needs attention**: failed deployments and backups, failed restore tests, nodes that stopped reporting and certificates about to expire. Select an item to open it.
- **Nodes**: each server with its state. **Monitoring** opens the metrics.
- **Recent deployments** across all projects.
**New project** at the top right creates a project.
### Projects [#projects]
Folders, projects, environments and their services.

- The left column lists **All projects**, your folders and subfolders, and **No folder**, each with a count. Select one to filter.
- **Filter projects…** filters by name. **Archived** shows archived projects.
- Each card shows the project's status, folder, description, one bar per service, the number of services and its environments.
- **New folder**, **New from template** and **New project** are at the top right.
Select a project to open it. Its page has a **Tasks** tab, a tab per environment, **New service**, **New environment**, **Network map** and **Usage**. Select a service to open its tabs: **Overview**, **Files**, **Deployments**, **Logs**, **Terminal**, **Environment**, **Domains**, **Metrics**, **Backups** and **Settings** (the tabs shown depend on the service kind). See [Deploy your first app](./first-deploy.mdx).
### Monitoring [#monitoring]
CPU, memory, disk and network for every node, sampled every 10 seconds.

- **Overview** shows the cluster's charts. Switch between **Cluster** and **Per node**, and pick a range: **1h**, **6h**, **24h**, **7d** or **30d**.
- **Usage** breaks resource use down by project.
- **Nodes** lists your servers. **Add server** adds one to the cluster.
- **Settings** holds alert thresholds and monitoring options. See [Alerts and notifications](../operations/alerts-and-notifications.mdx).
See [Metrics](../operations/metrics.mdx) and [Nodes](../operations/nodes.mdx).
### Schedules [#schedules]
Cron jobs that run a script in a fresh container, inside a service, or on a host.

Each row shows when it runs (for example "Every day at 02:15", with the time zone), its last result, a switch to pause it and a button to run it now. **New schedule** creates one. See [Schedules](../data/schedules.mdx).
### Domains [#domains]
Every hostname the proxy routes, with its certificate and DNS status.

A summary line counts domains with errors, certificates expiring within 14 days and domains waiting for the proxy. Each row shows the service, project and environment the domain belongs to, its **Status** (**Active**, **Pending** or **Error**), its **TLS** method (DNS-01, HTTP-01, Uploaded or None) and the certificate expiry. **Add domain** attaches a hostname to any service. See [Domains](../networking/domains.mdx).
### Network [#network]
How traffic reaches each service: the proxy and tunnels, every domain, and the tasks running on each node.

Filter by project with **All projects**, or search for a service, domain or node. Solid lines go through the proxy, dashed lines through a Cloudflare Tunnel, and dotted lines are published ports that bypass the proxy. Zoom with the **-** and **+** buttons. See [Network map](../networking/network-map.mdx).
### Storage [#storage]
S3-compatible object storage in every project: buckets, files, scoped keys and share links.

**All storage** lists every object storage service with its engine (MinIO, RustFS, Garage or SeaweedFS), project and status. Select one to browse its buckets. To create one, add an **Object storage** service to an environment. See [Object storage](../data/object-storage.mdx).
## Integrations [#integrations]
Connections to outside services, shared by the whole organization:
| Page | What it does |
| --- | --- |
| **Git providers** | GitHub, GitLab, Gitea and Bitbucket, for deploy on push and pull request previews. See [Deploy from Git](../deploy/from-git.mdx). |
| **Registries** | Where built images are pushed and where nodes pull them from. See [Registries](../deploy/registries.mdx). |
| **Backup destinations** | Where database and volume backups go: an S3 bucket, SFTP, WebDAV, Azure Blob, Google Drive, B2 or a folder on a node. See [S3 destinations](../data/s3-destinations.mdx) and [Other backup destinations](../data/backup-destinations.mdx). |
| **DNS providers** | Create records automatically and solve DNS-01 challenges for wildcard certificates. See [DNS providers](../networking/dns-providers.mdx). |
| **Cloudflare Tunnels** | Publish services through Cloudflare without opening ports. See [Cloudflare Tunnels](../networking/cloudflare-tunnels.mdx). |
| **Log drains** | Ship service logs to Loki, OpenTelemetry, Datadog, syslog or any HTTP endpoint. See [Log drains](../operations/log-drains.mdx). |
| **Tailscale** | Join servers to your tailnet and publish services on tailnet hostnames. See [Tailscale](../networking/tailscale.mdx). |
| **Notifications** | Channels and rules for deployments, backups, certificates and nodes. See [Alerts and notifications](../operations/alerts-and-notifications.mdx). |
| **Secret providers** | Read secrets from Vault, Infisical or 1Password Connect at deploy time. See [External secrets](../deploy/external-secrets.mdx). |
## Settings [#settings]
| Page | What it does |
| --- | --- |
| **General** | Organization name, instance URL and default domains. |
| **Appearance** | Light, dark or system, a color theme, and the sponsor glow on sponsoring instances. See [Appearance](../team/appearance.mdx). |
| **Members** | People with access to this organization and their roles. See [Members and invitations](../team/members-and-invitations.mdx). |
| **Authentication** | Two-factor requirement and single sign-on over OIDC or SAML. See [Single sign-on](../team/sso.mdx). |
| **Roles** | Built-in and custom roles. See [Roles and permissions](../team/roles-and-permissions.mdx). |
| **API keys** | Keys for the REST API and the MCP server. See [API keys](../team/api-keys.mdx). |
| **SSH keys** | For private Git repositories and adding servers. See [SSH keys](../team/ssh-keys.mdx). |
| **Certificates** | Let's Encrypt certificates and custom ones you upload. See [HTTPS certificates](../networking/https-certificates.mdx). |
| **Updates** | The running release, the latest one, and one-click updates. See [Updates](../operations/updates.mdx). |
| **Sponsor** | Sponsor LogiStack, or activate a sponsorship key. |
| **Plugins** | Installed plugins, the plugin marketplace and, for instance admins, the plugin policy and indexes. See [Install and manage plugins](../plugins/install.mdx). |
| **Instance mail** | The mail account task notifications and invitations are sent from. Instance admins only. See [Notifications and email](../tasks/notifications-and-email.mdx#set-up-instance-mail). |
| **Builds** | The architectures builds target, and QEMU emulation for the rest. See [Build platforms](../deploy/build-platforms.mdx). |
| **Migrate** | Move projects, databases and domains from Dokploy or Coolify. See [Migrate from Dokploy](../operations/migrate-from-dokploy.mdx). |
| **Audit log** | Every change, who made it, from where, and whether it succeeded. See [Audit log](../team/audit-log.mdx). |
What you can change on these pages depends on your role. See [Roles and permissions](../team/roles-and-permissions.mdx).
# Deploy your first app
URL: https://stack.logicaltech.it/docs/getting-started/first-deploy/
Create a project, add a service from a Git repository or a Docker image, give it an HTTPS domain, deploy it and follow its build and logs in LogiStack.
This tutorial takes you from an empty LogiStack to an app running on its own HTTPS URL. You create a project, add a service, give it a domain, deploy it and read its logs. It takes about five minutes. You need a finished [setup wizard](./setup-wizard.mdx) and the owner account, or any account with the developer role or higher.
You can follow it with one of three sources:
- **A Docker image**: the quickest path. The example uses `nginxdemos/hello`, a tiny web server that shows a page with its hostname.
- **A Git repository**: LogiStack builds your code. A public repository works without any setup; a private one needs a [Git provider](../deploy/from-git.mdx).
- **A template**: a ready-made app such as n8n or Umami, with its database. See [Templates](../deploy/templates.mdx).
## Create a project [#create-a-project]
### Open Projects [#open-projects]
In the sidebar, select **Projects**.

### Create the project [#create-the-project]
Select **New project**. In the dialog, fill in:

- **Name**: `Hello`.
- **Description** (optional): `My first LogiStack app`.
- **Folder**: leave **No folder**.
Select **Create project**. The project opens with one environment, **Production**.

The project page lists its environments as tabs and the services of the selected environment as rows. Your new project has no services yet.
## Add a service [#add-a-service]
### Start the New service wizard [#start-the-new-service-wizard]
On the project page, with **Production** selected, select **New service**.

### Choose a source [#choose-a-source]
Select **Docker image**, then **Continue**.
Select **Git repository**, then **Continue**.
Select **Templates** at the bottom of the list. The template catalog opens. Pick an app, fill in the few fields it asks for, and deploy it. LogiStack creates the app, its database and generated secrets as one stack. Then skip to [Watch the deployment](#watch-the-deployment). See [Templates](../deploy/templates.mdx) for details.
### Configure the service [#configure-the-service]
Fill in:
- **Image**: `nginxdemos/hello:latest`. For your own apps, pin a version tag or digest, such as `ghcr.io/acme/web:2.4.1`: `:latest` makes rollbacks unpredictable.
- **Container port**: `80`, the port the image listens on.
- **Service name**: `hello`. If you leave it empty, LogiStack uses the image name.
Leave **Resources** and **Advanced** as they are. Select **Continue**.
Fill in:
- **Git provider**: shown only when you have connected one. Choose it to pick a private repository from a list, or keep **Public repository over HTTPS**.
- **Repository**: for a public repository, its URL without `https://`, for example `github.com/acme/storefront`.
- **Branch**: `main`.
- **Root directory**: `/`, or the app's folder in a monorepo, such as `/apps/web`.
- **Watch paths** (optional): leave empty to build on every push.
- **Build with**: **Dockerfile** if the repository has one, **Railpack (no Dockerfile needed)** to detect the language and build without one, or **Static site** for plain HTML or a built site.
- **Container port**: the port your app listens on, for example `3000` for a Node.js app.
- **Service name**: `web`. If you leave it empty, LogiStack uses the repository name.
Select **Continue**. See [Build types](../deploy/build-types.mdx) for how each builder works.
### Test the source [#test-the-source]
LogiStack checks it can reach the source before it creates anything. For an image it fetches the image manifest; for a repository it reads the branch.
Select **Test connection**. When the test passes, select **Continue**. If it fails, the message says why, for example a misspelled image name or a branch that does not exist. Select **Back**, fix the field, and test again.
### Choose a domain [#choose-a-domain]
Under **Domain**, choose **Generated hostname**. The description shows the hostname you will get, for example `hello-xxxxxx.srv1.example.com`, where `xxxxxx` is filled in when the service is created. It works without any DNS change.
To use your own hostname instead, choose **Custom hostname** and enter it in **Hostname**, for example `hello.example.com`. Point an A record for that name at your server's IP first.
Keep **HTTPS** on: LogiStack requests a certificate from Let's Encrypt and redirects HTTP to HTTPS. Select **Continue**.
### Review and create [#review-and-create]
Check the summary: source, port, service name, environment and hostname. Select **Create and deploy**.
A notice says "hello is deploying", and you return to the project page. The new service appears in the list.
## Watch the deployment [#watch-the-deployment]
### Open the service [#open-the-service]
On the project page, select the `hello` row. The service opens on its **Overview** tab.
### Open Deployments [#open-deployments]
Select the **Deployments** tab. The list on the left shows each deployment with its status, commit (for Git) and trigger. The panel on the right streams the selected deployment's log live.

An image deployment goes from **Queued** to **Deploying** to **Ready** in a few seconds. A Git deployment also passes through **Cloning**, **Building** and **Pushing**; the first build of a project usually takes one to three minutes. Use **Search output** to filter the log, and **Follow** to keep the newest lines in view.
While the new version starts, the previous one keeps serving traffic. LogiStack switches over only when the new container passes its health check. If it never does, the deployment fails and the previous version keeps running.
## Read the logs [#read-the-logs]
Select the **Logs** tab. It shows the output of the running containers, not the build.

- **All replicas** filters to one replica when the service runs several.
- **5m**, **1h**, **24h** and **All** set the time range, and **Last 500** sets how many lines to load.
- **Search output** filters lines as you type. **Follow** keeps streaming new lines.
For `nginxdemos/hello`, each request you make in the next step adds one access log line here.
## Open the app [#open-the-app]
### Find the URL [#find-the-url]
Select the **Domains** tab. The table lists each hostname with its **Status**, **TLS** method and **Certificate** expiry.

Wait until the status is **Active**. The first certificate usually takes under a minute.
### Visit it [#visit-it]
Select the hostname, or copy it into your browser: `https://hello-xxxxxx.srv1.example.com`. The nginx demo page shows the server address and container name.
## Check that it worked [#check-that-it-worked]
Select the **Overview** tab.

- **Replicas** lists each running container, the node it runs on and since when.
- **State** shows **Desired** `Running` and **Observed** `Running`, with **Replicas** `1 of 1 running`.
- **Domains** shows your hostname as **Active**.
The header shows the same status next to the service name, for example **Running 1/1**, and the buttons **Stop**, **Restart** and **Deploy**.
## Next steps [#next-steps]
- Push a change: for a Git service, every push to the branch deploys it, when the repository's webhook is set up. See [Deploy from Git](../deploy/from-git.mdx).
- Add configuration: set variables in the **Environment** tab. See [Environment variables](../deploy/environment-variables.mdx).
- Add a database: select **New service** again and choose **Database**. Apps reach it by its service name. See [Databases](../deploy/databases.mdx).
- Roll back: in **Deployments**, select an earlier ready deployment and choose **Roll back to this**. See [Deployments and rollbacks](../deploy/deployments.mdx).
## Common problems [#common-problems]
**The test step fails for an image.** The image name or tag is wrong, or the image is private. For a private registry, add it under **Integrations > Registries** first. See [Deploy a Docker image](../deploy/from-image.mdx).
**The test step fails for a repository.** The repository is private, or the branch does not exist. Connect a Git provider and choose it in **Git provider**.
**The deployment stays in Deploying, then fails.** The container did not pass its health check. The usual cause is a wrong **Container port**: the app listens on a different port than the one you entered. Open **Logs** to see what the app printed ("listening on 8080", for example), then open the **Domains** tab, select the edit (pencil) icon on the domain, and set **Port** to the port the app listens on.
**The build fails.** Open the failed deployment in **Deployments** and read the last lines of the log. Common causes are a missing `Dockerfile` with **Build with** set to **Dockerfile**, or a missing build script. Try **Railpack (no Dockerfile needed)** for a repository without a Dockerfile.
**The domain stays Pending or shows an error.** For a custom hostname, check that its A record points at the server and that ports 80 and 443 are open. See [Domains](../networking/domains.mdx).
# Install LogiStack on your server
URL: https://stack.logicaltech.it/docs/getting-started/install/
Install LogiStack on Ubuntu or Debian with one command, preview it with a dry run, choose installer flags and reach the setup wizard.
The installer turns a fresh Linux server into a LogiStack instance. It installs Docker if needed, starts a Docker Swarm, creates the secrets, deploys LogiStack as one Swarm stack, and tells you how to open the setup wizard. Use this page for your first server; add more servers later from the dashboard.
## Requirements [#requirements]
| Requirement | Details |
| --- | --- |
| Operating system | Ubuntu 22.04 or later, or Debian 12 or later. Other distributions work if Docker 26 or later is already installed, but the installer warns that they are untested. |
| Architecture | amd64 (x86_64) or arm64 (aarch64). |
| Memory | At least 2 GB of RAM. |
| Disk | At least 10 GB free under `/var/lib/docker`. |
| Ports | 80/tcp, 443/tcp and 443/udp free on the server and open in your provider's firewall. |
| Access | Root, or a user with `sudo`. |
A small cloud server (2 vCPU, 4 GB RAM) from Hetzner, DigitalOcean, Vultr or similar is a good start. Builds from Git use more memory than running apps, so give the server headroom if you build large projects.
## Install [#install]
### Connect to the server [#connect-to-the-server]
Open an SSH session as root, or as a user who can run `sudo`:
```bash
ssh root@203.0.113.7
```
### Preview the plan (optional) [#preview-the-plan-optional]
Run the installer with `--dry-run`. It runs every check and prints what it would do, without changing anything:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash -s -- --dry-run
```
The output lists the checks (operating system, architecture, RAM and disk, Docker, ports) and then each action, such as "Initialise Swarm on 203.0.113.7". It ends with `Dry run complete. Re-run without --dry-run to install.`
### Run the installer [#run-the-installer]
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash
```
The installer runs its checks, shows the plan, and asks `Install LogiStack 0.2.0 on 203.0.113.7? [Y/n]`. Press Enter to continue. A fresh install takes a few minutes, most of it pulling images.
### Note the next step it prints [#note-the-next-step-it-prints]
When it finishes, the installer prints something like this:
```text
LogiStack 0.2.0 is running.
Until setup is done the dashboard is reachable only on 127.0.0.1:3000. From your machine: ssh -L 3000:127.0.0.1:3000 root@203.0.113.7
then open http://localhost:3000 to finish the guided setup.
After setup the dashboard is served over https on the domain you choose there.
If you ever lose the dashboard: ssh -L 3000:127.0.0.1:3000 root@203.0.113.7, then open http://localhost:3000
Back up /etc/logistack/credentials: it holds the master key that encrypts your secrets.
```
The tunnel line stays true after setup: the installer keeps the API on `127.0.0.1:3000` in every mode, so you can always get back in over SSH.
It also writes a login banner (`/etc/update-motd.d/99-logistack`) that repeats these instructions on every SSH login until setup is done.
If the server sits behind a router, for example at home, the checks also print a note like this:
```text
! This server is behind NAT: LAN 192.168.1.39, public 81.57.58.142.
Internet visitors reach it only if the router forwards ports 80 and 443 to 192.168.1.39.
Setup can point your domain at the LAN address instead.
```
The setup wizard then offers to point your domain at the LAN address. See [Choose the instance URL and domain](./setup-wizard.mdx#choose-the-instance-url-and-domain).
### Back up the credentials file [#back-up-the-credentials-file]
Copy `/etc/logistack/credentials` somewhere safe, such as a password manager:
```bash
sudo cat /etc/logistack/credentials
```
This file holds the master key that encrypts every secret stored in LogiStack: environment variables, database passwords and integration tokens. Docker secrets cannot be read back, so if you lose the server and this file, you cannot decrypt a restored database.
## Reach the setup wizard [#reach-the-setup-wizard]
Bots scan new servers for unclaimed setup pages within minutes. For that reason the dashboard is not public until you finish setup: the proxy answers every request with 404, and the API listens only on `127.0.0.1:3000` of the server.
From your own computer, open an SSH tunnel to the server:
```bash
ssh -L 3000:127.0.0.1:3000 root@203.0.113.7
```
Keep that session open and go to `http://localhost:3000` in your browser. The setup wizard opens.
If port 3000 is taken on the server, the installer stops with `Port 3000 is taken`. Pick another port and tunnel that one instead:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo LOGISTACK_TUNNEL_PORT=3100 bash
ssh -L 3100:127.0.0.1:3100 root@203.0.113.7
```
If you cannot open an SSH tunnel, install with `--public-setup`:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash -s -- --public-setup
```
The installer generates a one-time setup token and prints a link like this:
```text
http://203-0-113-7.sslip.io/setup#token=Qm9yZWQ...
```
Behind NAT the link uses the LAN address, such as `http://192-168-1-39.sslip.io/setup#token=...`, because the public one answers only when the router forwards port 80. The installer prints the public link as the one to use from outside your network.
Open the link. The token sits in the URL fragment, so your browser never sends it to a server or its logs. The wizard fills it in for you; if you open the page without it, the first step asks for the **Setup token**. Anyone who holds the token can claim the server until setup is done, and it stops working afterwards.
The token is also stored as `LOGISTACK_SETUP_TOKEN` in `/etc/logistack/credentials`. `--public-setup` is not remembered: a later run without it makes setup private again.
The SSH tunnel on `127.0.0.1:3000` exists with `--public-setup` too. Keep the tunnel command the installer prints: it is your way back in if the dashboard's domain does not open after setup.
Continue with [the setup wizard](./setup-wizard.mdx). When setup completes, LogiStack routes the instance URL you chose over HTTPS, and that is how you reach the dashboard from then on.
## Installer flags [#installer-flags]
Pass flags after `bash -s --`:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash -s -- --version 0.2.0 --yes
```
| Flag | What it does |
| --- | --- |
| `--version X` | Release to install or upgrade to: `0.2.0`, `v0.2.0` or `latest`. Defaults to the release already running, else the release the installer belongs to, else the latest release on GitHub. |
| `--advertise-addr IP` | IPv4 address other Swarm nodes use to reach this one. Defaults to the address of the interface with the default route. Cannot be a loopback address. Set it when the server has several interfaces, for example a private network for node-to-node traffic. |
| `--yes`, `-y` | Skip the confirmation prompt. Required when no terminal is attached, such as in cloud-init. |
| `--dry-run` | Run the checks, print the plan, change nothing. |
| `--public-setup` | Serve the setup wizard on the server's public address before setup, protected by a one-time token. Not remembered between runs. Cannot be combined with `--no-ingress`. |
| `--no-ingress` | Leave LogiStack's proxy (Caddy) off and ports 80 and 443 to another proxy. Setup is then reachable only through the SSH tunnel. Kept on re-runs until you pass `--enable-ingress`. |
| `--enable-ingress` | Turn Caddy on after an install with `--no-ingress`. Ports 80 and 443 must be free by then. |
| `--public-url URL` | The dashboard URL used for sign-in and links, such as `https://logistack.example.com`. An origin only, without a path. Defaults to the value the running install has, else `http://.sslip.io`. Kept on re-runs. |
| `--api-replicas N` | Run `N` api replicas behind Caddy, from 1 to 9, so a crashed or restarting api interrupts nothing. Kept on re-runs and by in-app updates. |
| `--local-build` | Build the images from a LogiStack checkout instead of pulling them. For development; single node only. |
| `--help`, `-h` | Show the usage text. |
The full reference, including environment variables, is in [Installer reference](../reference/installer.mdx).
## Install while creating the server [#install-while-creating-the-server]
Most providers (Hetzner, DigitalOcean, Akamai/Linode, Vultr) accept cloud-init user data when you create a server. Paste this into the **Cloud config** or **User data** field, and LogiStack installs during the first boot:
```yaml title="cloud-config"
#cloud-config
runcmd:
- curl -fsSL https://stack.logicaltech.it/install.sh | bash -s -- --yes
```
The install finishes a few minutes after the server is up. Follow it with `tail -f /var/log/cloud-init-output.log`. Then SSH in: the login banner shows how to reach the setup wizard.
## Open the firewall [#open-the-firewall]
The installer does not change your firewall. Open these ports in your provider's firewall:
| Port | Open to | Purpose |
| --- | --- | --- |
| 22/tcp | Your IP | SSH, and the tunnel to the setup wizard. |
| 80/tcp | Everyone | HTTP, and Let's Encrypt HTTP-01 challenges. |
| 443/tcp | Everyone | HTTPS. |
| 443/udp | Everyone | HTTP/3. |
Before you add a second server, open the Swarm ports **only between LogiStack nodes**:
| Port | Purpose |
| --- | --- |
| 2377/tcp | Swarm management |
| 7946/tcp and 7946/udp | Node discovery |
| 4789/udp | Overlay network traffic |
With UFW, for each other node:
```bash
ufw allow from 198.51.100.20 to any port 2377 proto tcp
ufw allow from 198.51.100.20 to any port 7946
ufw allow from 198.51.100.20 to any port 4789 proto udp
```
Docker publishes ports through iptables, which bypasses UFW and firewalld. A port a container publishes is open to the internet even if UFW says it is closed. Never publish a database port unless you mean it to be public; use the provider's firewall for anything you must block.
## What the installer creates [#what-the-installer-creates]
| Object | Details |
| --- | --- |
| Docker | Installed from `download.docker.com` when missing (Ubuntu and Debian only). |
| Swarm | `docker swarm init` on the advertise address, unless the server is already a Swarm manager. |
| Stack `logistack` | `postgres`, `redis`, `logistack-api`, `logistack-worker`, `logistack-agent` (one per node) and `caddy` (one per ingress node). |
| Networks | `ls-control` (control plane, never reachable from apps), `ls-ingress` (Caddy and services with a domain), `ls-storage`, `ls-db` and `ls-game` (used by the API and worker to reach storage, databases and game servers; apps never join them). |
| Volumes | `logistack_pgdata` and `logistack_redisdata` for LogiStack's own data, `logistack_workerdata` for clones and build logs, `ls-buildkit-cache` for the build cache. |
| Secrets | `logistack-master-key`, `logistack-postgres-password`, `logistack-better-auth-secret`, `logistack-redis-password`, `logistack-agent-token`, `logistack-setup-token`. Created only when absent. |
| `/etc/logistack/credentials` | The generated secret values, readable only by root. |
| `/etc/logistack/stack.yml` | The deployed stack file. |
| `/var/log/logistack-install.log` | Full output of every command the installer ran, readable only by root. |
| `logistack-api-tunnel` container | The API on `127.0.0.1:3000` only, for the SSH tunnel. Created in every mode, so you can always get back in. |
| Service `ls-buildkit` | Rootless BuildKit for Git builds, created by the worker on the first build. |
On Ubuntu 23.10 and later the installer also writes `/etc/sysctl.d/60-logistack-userns.conf`, because rootless BuildKit needs unprivileged user namespaces.
## Run it again [#run-it-again]
The installer is safe to re-run. It repairs a broken install, restarts nothing that already matches, and never rotates existing secrets. Re-running it also re-creates the `127.0.0.1:3000` tunnel, which is how you get back in if the dashboard's domain stops working. Once setup is done, a re-run prints the dashboard URL instead of the setup instructions.
A re-run keeps the dashboard URL you set with `--public-url`. To change it, pass `--public-url` again:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash -s -- --public-url https://logistack.home.example.com
```
To upgrade from the command line, re-run it with a version:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash -s -- --version 0.2.0
```
Most updates are one click in the dashboard instead. See [Updates](../operations/updates.mdx).
## Servers that already run Dokploy or Coolify [#servers-that-already-run-dokploy-or-coolify]
Run the same command on a Dokploy or Coolify server. The installer detects the other platform, explains its plan and asks before it changes anything. It leaves ports 80 and 443 to the existing proxy, keeps setup private, and gives the migration wizard read-only access to the old platform's database. Your sites keep running. See [Migrate from Dokploy](../operations/migrate-from-dokploy.mdx) and [Migrate from Coolify](../operations/migrate-from-coolify.mdx).
## Troubleshooting [#troubleshooting]
**`Unknown option: ...`.** The flag is misspelled or does not exist. Check it against `--help`. When you pipe the installer into bash, put flags after `bash -s --`.
**`No terminal to confirm on; re-run with --yes`.** The installer was started without a terminal, for example from cloud-init or a CI job. Add `--yes`.
**The dashboard's domain does not open after setup.** From the server's own network, open `http://`, for example `http://192.168.1.39`. The page names the address the dashboard moved to. If the domain points at your router's public address, the router may not forward or loop back ports 80 and 443. Point the record at the server's LAN address, forward the ports, or add a local DNS record. Until then, use the SSH tunnel the installer printed: `ssh -L 3000:127.0.0.1:3000 root@192.168.1.39`, then open `http://localhost:3000`.
**`Could not detect this server's address; pass --advertise-addr `.** The server has no default route, or the detected address is a loopback address. Pass the server's IPv4 address with `--advertise-addr`.
**`... MB of RAM; LogiStack needs at least 2 GB`.** Resize the server. LogiStack's own services and builds do not fit in less.
**`Ports in use: 80/tcp 443/tcp. Stop the web server holding them and re-run.`** Another web server, often Nginx or Apache preinstalled on the image, holds the ports. Stop and disable it (`systemctl disable --now nginx`), or install with `--no-ingress` and switch later with `--enable-ingress`.
**`ls-buildkit` restarts with `fork/exec /proc/self/exe: permission denied`.** The kernel blocks unprivileged user namespaces. Re-run the installer, which writes the sysctl file above.
For anything else, read `/var/log/logistack-install.log` and see [Troubleshooting](../reference/troubleshooting.mdx).
# Complete the setup wizard
URL: https://stack.logicaltech.it/docs/getting-started/setup-wizard/
Create the owner account, name your organization, choose the instance URL and domain, check DNS and turn on the local registry in LogiStack's setup wizard.
The setup wizard runs once, right after you [install LogiStack](./install.mdx). It creates the owner account and the first organization, and sets the domain your dashboard and services use. It takes about two minutes. Everything except the owner account can change later in **Settings**.
## Before you start [#before-you-start]
- Open the wizard as the installer told you: through the SSH tunnel at `http://localhost:3000`, or through the `/setup#token=...` link if you installed with `--public-setup`.
- Decide which domain to use. You have two options:
- **Your own wildcard domain**, such as `*.srv1.example.com`. Recommended for real use. Have access to the domain's DNS, or API credentials for Cloudflare, Amazon Route 53, Hetzner DNS, DigitalOcean, OVHcloud or Porkbun.
- **sslip.io or nip.io**. Works right away with no DNS change. Good for trying LogiStack.

The steps are listed on the left. Select **Continue** (or press Enter) to move forward, and **Back** (or Option+Left) to return. The wizard keeps your answers if you reload the page, except passwords and tokens.
## Run the wizard [#run-the-wizard]
### Create the owner account [#create-the-owner-account]
Fill in:
- **Name**: your name, for example `Simone Rossi`.
- **Email**: the address you sign in with, for example `simone@acme.com`.
- **Password**: at least 12 characters.
If you installed with `--public-setup`, a **Setup token** field comes first. The link the installer printed fills it in; otherwise paste the token from `/etc/logistack/credentials`.
The owner can do everything, including adding people and changing these settings later. You can add a passkey and two-factor authentication after setup.
### Name your organization [#name-your-organization]
Enter the **Organization name**, usually your company or team, for example `Acme`. The field shows the slug it derives (`acme`). Projects, members and integrations belong to the organization.
### Choose the instance URL and domain [#choose-the-instance-url-and-domain]
Under **Domain**, choose one:
| Choice | What it does |
| --- | --- |
| **Your own wildcard domain** (Recommended) | Services get hostnames under a base you own, like `web.srv1.example.com`. |
| **sslip.io** (Quick start) | Hostnames like `app.203-0-113-7.sslip.io` resolve to the server's IP with no setup. |
| **nip.io** (Quick start) | The same idea on another resolver: `app.203-0-113-7.nip.io`. |
For **Your own wildcard domain**, also fill in:
1. **Wildcard base**: the domain under the `*.`, for example `srv1.example.com`. Do not type `*.` or `https://`.
2. **DNS provider for certificates**: **Cloudflare**, **Amazon Route 53**, **Hetzner DNS**, **DigitalOcean**, **OVHcloud**, **Porkbun**, or **None, I'll manage records myself**. For a provider, enter its credentials. The hint under the fields says where to create them, for example for Cloudflare: My Profile → API Tokens → Create Token → "Edit zone DNS".
3. Check the **DNS records** table. It lists the two records the domain needs:
| Type | Name | Value |
| --- | --- | --- |
| A | `*.srv1.example.com` | `203.0.113.7` |
| A | `srv1.example.com` | `203.0.113.7` |
With a DNS provider, LogiStack creates both records when you finish and issues one wildcard certificate over DNS-01. With **None, I'll manage records myself**, create them at your DNS host now; certificates are then issued per hostname over HTTP-01.
If the server is behind NAT, such as a home server at `192.168.1.39` behind a router with the public address `81.57.58.142`, **Who opens these addresses** appears above the records:
| Choice | Records point at | When to choose it |
| --- | --- | --- |
| **Only this network** | The server's LAN address, `192.168.1.39` | Only devices on your network use the dashboard and services. No port forwarding needed. The default behind NAT. |
| **The internet** | The router's public address, `81.57.58.142` | Visitors come from the internet. The router must forward ports 80 and 443 to the server; the wizard shows a warning as a reminder. |
The **DNS records** table shows the address you chose. With **Only this network**, choose a DNS provider: Let's Encrypt cannot reach a LAN address over HTTP-01, so certificates need DNS-01. A public DNS record that points at a private address is fine for this.
With sslip.io or nip.io behind NAT, the wizard shows the same port-forwarding warning, since those names always resolve to the public address.
Finally, **Instance URL** (optional) is where you and your team open LogiStack. Leave it empty to use the suggestion, `https://logistack.srv1.example.com` (or `https://logistack.203-0-113-7.sslip.io`). It must start with `https://`.
sslip.io and nip.io are not on the Public Suffix List, so every instance that uses them shares one Let's Encrypt limit of 50 certificates a week. Issuance can stall when that budget runs out. Use them to try LogiStack, then move to your own domain in **Settings > General**.
### Check DNS [#check-dns]
This step appears only for **Your own wildcard domain**. It shows the DNS records again and a test button. You must pass the test to continue.
- With a DNS provider, select **Check credentials**. LogiStack signs in to the provider and finds the zone that holds your wildcard base. Nothing is written yet. A pass reads, for example, `Cloudflare manages example.com`.
- With **None, I'll manage records myself**, select **Check DNS**. LogiStack looks up `ls-check.srv1.example.com` and compares it with the address the records point at. A pass reads `ls-check.srv1.example.com resolves to 203.0.113.7`.
If the test fails, fix the problem and select **Test again**. New records can take a few minutes to propagate.
### Enter the Let's Encrypt email [#enter-the-lets-encrypt-email]
Enter **Email for certificate notices**. Let's Encrypt writes here only about expiring certificates and changes to its terms. A shared ops inbox, such as `ops@acme.com`, works better than a personal one.
### Choose the local registry [#choose-the-local-registry]
**Run a registry on this server** is on by default. LogiStack deploys a private image registry at `registry.srv1.example.com` with HTTPS and generated credentials. Images built from your repositories are pushed there, and old images are cleaned up while the last few are kept for rollbacks.
- Keep it on if you will add more servers: other nodes pull images from it instead of rebuilding.
- Turn it off if you prefer GHCR or Docker Hub, and add one later under **Integrations > Registries**. See [Registries](../deploy/registries.mdx).
### Review and finish [#review-and-finish]
The last step summarizes your answers: owner, organization, instance URL, service hostnames (`*.srv1.example.com`), the address the records point at, certificates, Let's Encrypt email and registry. Behind NAT it also shows **Reachable from**. Select **Edit** next to a section to go back to it.
Select **Finish setup**. LogiStack creates the owner and organization, saves the instance settings and creates DNS records if you chose a provider. The page then waits until your browser can reach the instance URL, which can take a minute or two while the certificate is issued. Select **Open dashboard** and sign in there with the owner email and password.
If the instance URL does not answer within about three minutes, the page explains why and what to change, for example that the name points at your router's public address. Select **Check again** after you fix it. The SSH tunnel stays available as a way back in.
## Check that it worked [#check-that-it-worked]
1. Open the instance URL you chose, for example `https://logistack.srv1.example.com`. The certificate can take up to a minute on first use.
2. The sign-in page opens. Sign in with the owner email and password.

From now on, use this URL instead of the SSH tunnel. The tunnel on `127.0.0.1:3000` stays available as a way back in.
## Add more people [#add-more-people]
Invite people from **Settings > Members**: they receive a link and create their account. People can also open **Create an account** on the sign-in page; a new account joins the organizations it was invited to.

See [Members and invitations](../team/members-and-invitations.mdx) and [Single sign-on](../team/sso.mdx).
## Common problems [#common-problems]
**The wizard is not reachable on `http://localhost:3000`.** Check that the SSH session with `-L 3000:127.0.0.1:3000` is still open, and that nothing else on your computer uses port 3000. Use another local port if needed: `ssh -L 8080:127.0.0.1:3000 root@203.0.113.7`, then open `http://localhost:8080`.
**"Enter the setup token install.sh printed."** The server was installed with `--public-setup`. Paste `LOGISTACK_SETUP_TOKEN` from `/etc/logistack/credentials`.
**The instance URL does not open from your network.** Your browser reached setup on a private address, and the name resolves to your router's public address. Most home routers do not send that traffic back inside. Point the A records at the server's LAN address, forward ports 80 and 443 to the server, or add a local DNS record for the name. With the home network DNS on and pointed at by your router, LogiStack answers your base and its subdomains with the server's LAN address inside your network. Opening `http://` on the same network shows where the dashboard lives.
**The DNS check fails with "doesn't resolve to ... yet".** The A records are missing or point elsewhere. The message lists what the name resolves to. Fix the records and select **Test again** after a few minutes.
**The DNS provider check fails.** The token cannot read the zone, or the zone does not contain your wildcard base. For Cloudflare, make sure the token has "Edit zone DNS" on that zone.
**The instance URL shows a certificate error after setup.** Let's Encrypt may still be issuing it. Wait a minute and reload. If it persists, check that ports 80 and 443 are open in your provider's firewall, then see [HTTPS certificates](../networking/https-certificates.mdx).
# Introduction
URL: https://stack.logicaltech.it/docs/
LogiStack is a self-hosted platform that deploys apps, databases and compose stacks to your own servers with HTTPS, backups, metrics and a REST API.
LogiStack is a self-hosted platform as a service. You install it on your own Linux server, and it turns that server, or a Docker Swarm cluster of several servers, into a place where you deploy apps from Git, run databases with backups, and route domains over HTTPS from one dashboard. Read this page to learn what LogiStack does and where to start.

## Install in one command [#install-in-one-command]
On a fresh Ubuntu 22.04+ or Debian 12+ server with at least 2 GB of RAM, run:
```bash
curl -fsSL https://stack.logicaltech.it/install.sh | sudo bash
```
The installer sets up Docker and Swarm, deploys LogiStack, and prints how to open the setup wizard in your browser. See [Install LogiStack](./getting-started/install.mdx) for requirements, flags and a dry run.
## Who it is for [#who-it-is-for]
- **Agencies and freelancers** who host many client projects on a few servers and want them grouped by client, with folders, roles and per-project usage.
- **Small product teams** who want the "push to deploy" experience of Heroku or Vercel, but on servers they rent and control, with no per-seat or per-app pricing.
- **Self-hosters** who run open-source apps (n8n, Plausible, Umami, Minecraft) and want backups, HTTPS and updates handled for them.
LogiStack has no paid edition. Every feature in these docs ships in the same open build.
## What it does [#what-it-does]
| Area | What you get |
| --- | --- |
| Deploy | Apps from a Git repository (Dockerfile, Railpack or static site), from a published Docker image, from a `docker-compose.yml`, or from a catalog of ready-made templates. |
| Releases | Zero-downtime rolling updates, automatic rollback when a new version fails its health check, and one-click rollback to any earlier deployment. Every build gets an immutable image tag. |
| Environments | Production, staging, custom environments and pull request previews, each with its own variables, network and domains. |
| Domains and HTTPS | Generated hostnames that work right away, your own domains, wildcard certificates over DNS-01 through Cloudflare, Route 53, Hetzner DNS, DigitalOcean, OVHcloud or Porkbun, and Cloudflare Tunnels. |
| Databases | PostgreSQL, MySQL, MariaDB, MongoDB, Redis and libSQL, with a database editor in the browser. |
| Backups | Scheduled database and volume backups to S3-compatible buckets, SFTP, WebDAV, Azure Blob, Google Drive, B2 or a node folder, with retention and restore. |
| Object storage | S3-compatible storage (MinIO, RustFS, Garage, SeaweedFS) with buckets, scoped keys and share links. |
| Observability | Live logs, a terminal into running containers, CPU, memory, disk and network metrics, alert thresholds and notifications to Slack, Discord, email and more. |
| Cluster | Add servers from the dashboard. LogiStack runs on Docker Swarm, so services spread across nodes. |
| Team | Organizations, folders, built-in and custom roles, invitations, SSO over OIDC or SAML, two-factor and passkeys, and an audit log. |
| Tasks | Lists, tasks, custom fields, and board, table, timeline and calendar views on the projects you deploy, with time tracking, templates and a ClickUp import. A Project manager role sees whether services are up, never deployments. See [Tasks](./tasks/index.mdx). |
| Automation | A REST API with an OpenAPI description, an MCP server for AI agents, project manifests and Git webhooks. |
| Plugins | Containers that add event hooks, deploy gates, agent tools, DNS, notification and secret providers, and dashboard pages, each with only the permissions you approve. Install them from a signed marketplace, an image or a dev URL. |
## How it compares [#how-it-compares]
LogiStack sits in the same space as Heroku, Render or Vercel: you describe what to run, and the platform builds it, deploys it, gives it a URL and keeps it running. The difference is where it runs. LogiStack runs on your own servers, so your data, logs and backups stay with you, and the cost is the cost of the servers.
Under the hood LogiStack keeps the state you ask for in Postgres and a reconciler converges Docker Swarm and the Caddy proxy to it. A crashed step or a restarted server does not leave things half done: the next pass fixes the difference. [Concepts](./getting-started/concepts.mdx) explains the model.
If you already run Dokploy or Coolify, LogiStack can move your projects, databases and domains over one service at a time while the old platform keeps serving traffic. See [Migrate from Dokploy](./operations/migrate-from-dokploy.mdx) and [Migrate from Coolify](./operations/migrate-from-coolify.mdx).
## Start here [#start-here]
# Protect a domain with access rules
URL: https://stack.logicaltech.it/docs/networking/access-control/
Put a password, a sign-in gateway such as Authelia or Authentik, or an IP allowlist in front of a LogiStack domain, checked by the proxy before the service.
Access rules are checks the Caddy proxy runs before a request reaches your service. Use them for apps that ship without a login, admin panels, staging sites, or internal tools that only your office should reach. Saving a rule reloads the proxy only; the service is not redeployed.
LogiStack has two levels:
| Level | Where | Applies to | Kinds |
| --- | --- | --- | --- |
| Service | The **Basic auth** panel on the service's **Domains** tab | Every domain of the service, tunnel domains included | Username and password |
| Domain | The shield button on a domain's row | That one hostname (and path prefix) | **IP allowlist**, **Sign-in gateway**, **Password** |
A domain can have at most one rule of each kind. The proxy checks them in a fixed order, whatever order you added them in:
1. **IP allowlist**: a request from an address not on the list gets `403`.
2. **Sign-in gateway**: an external service decides each request.
3. **Password**: the browser asks for a username and password.
The service's own basic auth, if set, still applies after these.
## Basic auth for a whole service [#basic-auth-for-a-whole-service]
### Open the service's Domains tab [#open-the-services-domains-tab]
Open the service and select the **Domains** tab. The **Basic auth** panel sits under the list of domains.

### Turn it on [#turn-it-on]
Turn on the switch next to **Basic auth**. An empty user row appears.
### Add users [#add-users]
Enter a username and a password of 8 or more characters. Select **Add user** for more rows. Saved users show their name read-only, and their password field says `unchanged`; type a new password only to change it.
### Save [#save]
Select **Save**. The proxy applies it within a few seconds.
To turn it off, switch it off and select **Save**.
## Add a rule to one domain [#add-a-rule-to-one-domain]
### Open the access sheet [#open-the-access-sheet]
On **Domains** (or the service's **Domains** tab), select the shield on the domain's row. A plain shield means the domain is open to anyone; a green shield with a check means it has rules. The **Access** sheet opens and lists the current rules, or says `Anyone who knows the address can reach it.`
### Select Add rule [#select-add-rule]
Select **Add rule**. The flow has three steps: **Kind**, **Details**, **Check**.
### Pick the kind [#pick-the-kind]
Under **Kind of rule**, pick **IP allowlist**, **Sign-in gateway** or **Password**. Kinds the domain already has are not offered. Select **Continue**.
### Fill in the details [#fill-in-the-details]
Fill in the fields for the kind. See the sections below. Select **Continue**.
### Check and save [#check-and-save]
**Check** summarizes what the rule does. For a sign-in gateway, test the endpoint first. Select **Save rule**. The proxy applies it within a few seconds.
To change a rule, select **Edit** on it; the flow opens on **Details**. To remove one, select the bin next to it.
### Require a password [#require-a-password]
**Password** asks the browser for a username and password, like the service-level basic auth but on one domain only.
Add one row per user: a username of 1 to 64 characters without colons or spaces, and a password of 8 or more characters. Usernames must be unique. Passwords are stored as bcrypt hashes; nobody can read one back.
```bash
curl -u ana:correct-horse-battery https://staging.example.com
```
A request without valid credentials gets `401`.
### Allow only some IP addresses [#allow-only-some-ip-addresses]
**IP allowlist** lets through only the listed addresses. Everyone else gets `403`.
- **Allowed addresses**: one per line, an address or a CIDR range, IPv4 or IPv6. Up to 100 entries.
- **Trusted proxies** (optional): only if a load balancer or CDN sits in front of this server. Their `X-Forwarded-For` header is believed; every other request is judged by its own address.
```txt title="Allowed addresses"
203.0.113.7
198.51.100.0/24
2001:db8::/32
```
If the domain's record is proxied by Cloudflare, every request arrives from a Cloudflare address. Without Cloudflare's ranges under **Trusted proxies**, an allowlist of your office's address blocks everyone, and an allowlist of Cloudflare's ranges lets everyone in.
The IP allowlist is not available on a [Cloudflare Tunnel](./cloudflare-tunnels.mdx) domain: through a tunnel every request comes from `cloudflared`, not from the visitor.
### Require a sign-in gateway [#require-a-sign-in-gateway]
**Sign-in gateway** hands each request to an authentication service such as Authelia, Authentik or oauth2-proxy (forward auth). Run the gateway as a service in LogiStack or anywhere the proxy can reach.
- **Auth endpoint**: the URL the proxy asks first, with the request's headers. A `2xx` answer lets the request through. Anything else, such as a redirect to the login page, goes back to the visitor. Example for Authelia: `http://authelia:9091/api/authz/forward-auth`.
- **Headers passed to the service** (optional): headers copied from the gateway's `2xx` answer, so the service knows who signed in. Prefilled with `Remote-User, Remote-Groups, Remote-Email, Remote-Name`. A visitor cannot forge them.
On **Check**, select **Send a test request**. The server asks the endpoint about a visitor who has not signed in:
| Answer | Result |
| --- | --- |
| `401`, `403` or a redirect | Passes: `It refused an anonymous request with 302. Visitors it signs in get through once it answers 2xx.` |
| `2xx` | Fails: every visitor would get through. Check the endpoint path. |
| Any other status | Fails: nobody would get in. |
| No answer | Fails with `The server could not reach it`. A name that resolves only on the proxy's network can still work for the proxy, so you can save anyway. |
## Check that it works [#check-that-it-works]
Open the domain in a private browser window. Depending on the rules, you should see a password prompt, the gateway's login page, or a `403` from an address not on the allowlist. On the Domains page, the domain's shield turns green.
## Limits [#limits]
- A domain that redirects to another hostname sends visitors on before any check. The **Access** sheet says so and accepts no rules; protect the target domain instead.
- Rules protect the domain, not the service. A [published port](./index.mdx#published-ports) bypasses the proxy and every rule on it.
- There is no rule kind for the LogiStack dashboard itself. To keep the dashboard off the public internet, put it behind your own VPN or firewall.
## Common problems [#common-problems]
**Everyone gets 403 behind Cloudflare or a load balancer.** Add the proxy's ranges to **Trusted proxies**.
**The gateway login loops.** The gateway must know the protected domain and allow its cookie domain. Configure the gateway for `staging.example.com`, then test again.
**`A redirect domain sends visitors on before any check`.** The domain has a redirect. Add the rule to the domain it redirects to.
# Cloudflare Tunnels
URL: https://stack.logicaltech.it/docs/networking/cloudflare-tunnels/
Publish LogiStack services through a Cloudflare Tunnel with no open inbound ports, for a homelab or a server behind NAT, and pick per domain what goes through it.
A Cloudflare Tunnel publishes services without opening ports on your server. LogiStack runs `cloudflared` in the swarm; it dials out to Cloudflare and keeps the connection open. Visitors reach Cloudflare's edge, which sends each request down the tunnel to the LogiStack proxy, which forwards it to the service. Cloudflare serves the hostname and its certificate. Use a tunnel for a homelab, a server behind NAT, or a provider that blocks inbound ports 80 and 443.
You choose per domain what goes through the tunnel. Other domains on the same server can keep using the public proxy.
## Before you start [#before-you-start]
- The zone is on Cloudflare and connected as a [Cloudflare DNS provider](./dns-providers.mdx).
- The provider's API token has, on top of **Zone › DNS › Edit**:
- **Account › Cloudflare Tunnel › Edit**
- **Account › Account Settings › Read**
Edit the token at Cloudflare to add them. You do not need to reconnect the provider: LogiStack reads the token each time.
Each Cloudflare provider can have one tunnel. It serves hostnames in that provider's zones.
## Create a tunnel [#create-a-tunnel]
### Open Cloudflare Tunnels [#open-cloudflare-tunnels]
Select **Cloudflare Tunnels** in the sidebar, under **Integrations**.

### Select Create tunnel [#select-create-tunnel]
Select **Create tunnel**. The **Create a Cloudflare Tunnel** wizard opens.

### Pick the Cloudflare provider [#pick-the-cloudflare-provider]
On **Cloudflare provider**, pick the **Provider**. Each option lists its zones, for example `Cloudflare · Acme · acme-retail.it, logical.it`. The tunnel reuses that provider's token. If no Cloudflare provider is connected, the step links to **Connect Cloudflare**.
### Pick the account [#pick-the-account]
On **Account**, pick the Cloudflare **Account** the tunnel belongs to. Tunnels belong to an account, not to a zone. When the token sees only one account, it is picked for you.
If the step shows an error, the token lacks the account permissions listed above.
### Name the tunnel [#name-the-tunnel]
On **Name**, enter a **Name**, for example `homelab`. It appears here and in Cloudflare's dashboard.
### Create [#create]
Review the summary and select **Create tunnel**. LogiStack creates the tunnel at Cloudflare and starts `cloudflared` in the swarm. The tunnel shows **Starting**, then **Connected** within a few seconds.
## Route a domain through the tunnel [#route-a-domain-through-the-tunnel]
A tunnel serves nothing until you send a domain through it.
1. Open the service and select the **Domains** tab, then **Add domain**.
2. Enter a **Hostname** in one of the provider's zones, for example `grafana.example.com`, and the **Port**.
3. Under **Exposure**, pick **Cloudflare Tunnel**.
4. Select **Add domain**.
1. On **Domains**, select **Add domain**, pick the service, and enter the hostname and **Container port**.
2. On **DNS record**, pick **Through the Cloudflare Tunnel**.
3. The wizard skips **Propagation** and **HTTPS**. The review shows `Proxied CNAME to the tunnel at Cloudflare · Acme` and `Cloudflare's edge certificate`.
4. Select **Add domain**.
LogiStack creates the proxied CNAME at Cloudflare and adds the hostname to the tunnel. The tunnel picks it up within a few seconds. On the Domains page, the domain's **TLS** column shows **Tunnel** and its **Certificate** column shows **Cloudflare edge**.
Between `cloudflared` and the proxy the traffic is plain HTTP inside your server, so the domain itself has no certificate in LogiStack.
## Check that it works [#check-that-it-works]
1. On **Cloudflare Tunnels**, the tunnel shows **Connected** and counts the domains it serves, for example `2 domains`.
2. Open the hostname in a browser. It loads over HTTPS with a certificate from Cloudflare.
3. From outside your network, `dig +short grafana.example.com` returns Cloudflare addresses, not your server's.
## Protect a tunnel domain [#protect-a-tunnel-domain]
[Basic auth](./access-control.mdx) and a [sign-in gateway](./access-control.mdx#require-a-sign-in-gateway) work on tunnel domains. The IP allowlist does not: through a tunnel every request comes from `cloudflared`, not from the visitor, so LogiStack hides it for tunnel domains.
## Tunnel status [#tunnel-status]
| Status | Meaning |
| --- | --- |
| **Connected** | `cloudflared` is connected to Cloudflare's edge. |
| **Degraded** | Connected, but Cloudflare reports some connections unhealthy. |
| **Starting** | Created; `cloudflared` has not connected yet. |
| **Down** | `cloudflared` is not connected. |
| Unreachable | LogiStack could not ask Cloudflare for the status. |
A message under the tunnel's name explains a problem when there is one.
## Delete a tunnel [#delete-a-tunnel]
Select the bin on the tunnel's row and confirm. LogiStack stops `cloudflared` and deletes the tunnel at Cloudflare. A tunnel that domains still use can't be deleted: delete those domains, or edit them to go through the public proxy, first.
## Common problems [#common-problems]
**The tunnel stays at Starting or shows Down.** The server cannot reach Cloudflare on outbound connections, or `cloudflared` is not running. Check the server's outbound firewall and the node's status on [Nodes](../operations/nodes.mdx).
**`this provider already has a tunnel`.** Each Cloudflare provider has one tunnel. Use the existing one; it serves every zone of the provider.
**Cloudflare Tunnel is not offered when adding a domain.** The hostname is not in a zone of a provider that has a tunnel, or the zone is not selected on the provider.
**`tunnels need a Cloudflare provider`.** Tunnels work only with Cloudflare providers, not with the other DNS providers.
# Connect a DNS provider
URL: https://stack.logicaltech.it/docs/networking/dns-providers/
Connect Cloudflare, Route 53, Hetzner, DigitalOcean, OVHcloud or Porkbun so LogiStack creates records, issues DNS-01 wildcard certificates and edits zones.
A DNS provider is an API credential for the service that hosts your zones. With one connected, LogiStack creates the A or CNAME record when you add a domain, removes it when you delete the domain, and issues certificates over DNS-01, which wildcards and Cloudflare-proxied records need. You can also browse and edit every record in the zone from the dashboard. Connect one as soon as you use your own domains.
LogiStack supports these providers:
| Provider | Credential | Notes |
| --- | --- | --- |
| Cloudflare | API token | Also used for [Cloudflare Tunnels](./cloudflare-tunnels.mdx) and [Origin certificates](./https-certificates.mdx#issue-a-cloudflare-origin-certificate). Records can be proxied. |
| Amazon Route 53 | IAM access key | Region defaults to `us-east-1`. |
| Hetzner DNS | Hetzner Cloud API token | Uses the Hetzner Cloud DNS API. |
| DigitalOcean | Personal access token | TTL of 30 seconds or more. |
| OVHcloud | Application key, application secret and consumer key | Endpoint `ovh-eu`, `ovh-ca` or `ovh-us`. TTL `0` means the zone default. |
| Porkbun | API key and secret API key | API access must be on for each domain. TTL of 600 seconds or more. |
A [plugin](../plugins/index.mdx) can add more providers. They appear in the same wizard with the plugin's name as a badge, and they issue DNS-01 and wildcard certificates like the built-in ones.
## Credentials for each provider [#credentials-for-each-provider]
Give LogiStack a credential limited to DNS on the zones it should manage. It is encrypted at rest and never shown again.
Field: **API token**.
In the Cloudflare dashboard, go to **My Profile** > **API Tokens** > **Create Token** and use the **Edit zone DNS** template, limited to the zones you choose.
Add these permissions to the same token if you need the features:
| Permission | For |
| --- | --- |
| Zone › DNS › Edit | Records and DNS-01 (required) |
| Zone › SSL and Certificates › Edit | [Cloudflare Origin certificates](./https-certificates.mdx#issue-a-cloudflare-origin-certificate) |
| Account › Cloudflare Tunnel › Edit and Account › Account Settings › Read | [Cloudflare Tunnels](./cloudflare-tunnels.mdx) |
Fields: **Access key ID**, **Secret access key**, **Region** (prefilled with `us-east-1`; Route 53 itself is global).
Create an IAM user or role with `route53:ListHostedZones`, `route53:ListResourceRecordSets` and `route53:ChangeResourceRecordSets`. A minimal policy:
```json title="logistack-route53.json"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["route53:ListHostedZones"],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"route53:ListResourceRecordSets",
"route53:ChangeResourceRecordSets"
],
"Resource": "arn:aws:route53:::hostedzone/Z0123456789ABCDEFGHIJ"
}
]
}
```
Field: **API token**.
In the Hetzner Console, open your project, then **Security** > **API tokens**, and create a token with **Read & Write** access.
Field: **API token**.
In the DigitalOcean Control Panel, go to **API** > **Tokens** > **Generate New Token**. Choose **Custom Scopes** and select every scope under **domain**: `domain:read`, `domain:create`, `domain:update` and `domain:delete`. Set an expiration that suits you and copy the token, which DigitalOcean shows only once.
Fields: **Endpoint** (prefilled with `ovh-eu`), **Application key**, **Application secret**, **Consumer key**.
Set **Endpoint** to the API region of your OVHcloud account:
| Account | Endpoint | Create the keys at |
| --- | --- | --- |
| OVHcloud Europe | `ovh-eu` | `https://eu.api.ovh.com/createToken/` |
| OVHcloud Canada | `ovh-ca` | `https://ca.api.ovh.com/createToken/` |
| OVHcloud US | `ovh-us` | `https://api.us.ovhcloud.com/createToken/` |
On the create token page, sign in, name the application and add these rights:
| Method | Path | For |
| --- | --- | --- |
| GET | `/domain/zone` | Listing your zones |
| GET | `/domain/zone/*` | Reading records |
| POST | `/domain/zone/*` | Creating records and applying changes (`refresh`) |
| PUT | `/domain/zone/*` | Changing records |
| DELETE | `/domain/zone/*` | Deleting records |
To limit the keys to one zone, replace `/domain/zone/*` with `/domain/zone/example.com/*`. The page then shows the three keys.
Fields: **API key**, **Secret API key**.
1. On porkbun.com, open **Account** > **API Access** and create a key. Copy the API key and the secret key.
2. Open **Domain Management**, open the **Details** of each domain LogiStack should manage, and turn on **API Access**. Porkbun refuses API calls for domains where it is off.
## Connect a provider [#connect-a-provider]
### Open DNS providers [#open-dns-providers]
Select **DNS providers** in the sidebar, under **Integrations**. The page lists connected providers with their zones and how many domains use each.

### Select Connect provider [#select-connect-provider]
Select **Connect provider**. The **Connect a DNS provider** wizard opens on **Where does the zone live?**.

### Pick the provider [#pick-the-provider]
Under **DNS provider**, pick **Cloudflare**, **Amazon Route 53**, **Hetzner DNS**, **DigitalOcean**, **OVHcloud** or **Porkbun**. Select **Continue**.
### Enter the credentials [#enter-the-credentials]
On **Credentials**, fill in the fields for the provider. See [Credentials for each provider](#credentials-for-each-provider). The step repeats where to get the credential.
### Test the connection [#test-the-connection]
On **Test the connection**, run the test. LogiStack verifies the credential and lists the zones it can edit, for example `Connected to Cloudflare` and `2 zones visible: logical.it, acme-retail.it`. Nothing changes at the provider.
If the credential works but sees no zones, the test fails with `The credential works but sees no zones`. Give it access to at least one zone and test again.
### Pick the zones to manage [#pick-the-zones-to-manage]
On **Zones to manage**, select the zones LogiStack may use, or **Select all**. Domains in these zones get records and DNS-01 certificates automatically. Other zones stay untouched.
### Name it [#name-it]
On **Name it**, enter a **Name** after the account or client, for example `Cloudflare · Acme`. LogiStack suggests one from the first zone.
### Connect [#connect]
Review the summary and select **Connect provider**. The credential is checked once more as it is saved.
From now on, when you [add a domain](./domains.mdx) whose hostname falls in a managed zone, the dialog says the record is created for you, and the wizard offers **Create the record for me**.
## Manage zone records [#manage-zone-records]
You can view and edit every record of a managed zone without opening the provider's dashboard.
### Open the zone [#open-the-zone]
On **DNS providers**, select a zone chip on the provider's row, for example `logical.it`. The zone page lists its records with **Name**, **Type**, **Value**, **Proxy** (Cloudflare only) and **TTL**. Names are relative to the zone: `@` is the apex.

### Find a record [#find-a-record]
Type in **Filter name or value**, or pick a type in **All types**. Press Escape to clear the filter.
### Add or edit a record [#add-or-edit-a-record]
Select **Add record**, or the pencil on a row. In the dialog, set:

- **Type**: `A`, `AAAA`, `CNAME`, `TXT`, `MX`, `SRV`, `CAA` or `NS`.
- **Name**: `@` for the zone itself, `*` for a wildcard, or a name like `www`.
- The value fields for the type, for example **IPv4 address** for A, **Target** for CNAME, **Priority** and **Mail server** for MX, **Flags**, **Tag** and **Value** for CAA.
- **TTL**: how long resolvers may cache the answer. Cloudflare and OVHcloud offer **Auto**. Hetzner and OVHcloud accept 60 seconds or more, DigitalOcean 30, Porkbun 600.
- **Comment** (Cloudflare only).
- **Proxy through Cloudflare** (Cloudflare A, AAAA and CNAME only). Proxied records always use **Auto** TTL.
Select **Add record** or **Save record**. The change applies at the provider immediately.
Some examples:
| Name | Type | Value | What it does |
| --- | --- | --- | --- |
| `@` | A | `203.0.113.10` | Points `example.com` at the server |
| `www` | CNAME | `example.com` | Points `www.example.com` at the same place |
| `@` | MX | `10 mx1.improvmx.com` | Routes mail for the domain |
| `@` | CAA | `0 issue "letsencrypt.org"` | Allows Let's Encrypt to issue for the domain |
| `_dmarc` | TXT | `v=DMARC1; p=quarantine` | Publishes a DMARC policy |
The editor checks values before saving. A CNAME cannot sit at the zone apex and has exactly one target, and a Cloudflare record holds one value. Record sets at the other providers can hold several values; add more with the value list.
### Records LogiStack created [#records-logistack-created]
A record created for a domain carries a **LogiStack** tag next to its name. Hover it to see which domain it belongs to. Deleting the domain removes the record. If you delete the record here instead, the dialog warns that the domain stops resolving and LogiStack no longer tracks it.
### Read-only records [#read-only-records]
A lock replaces the edit buttons on records LogiStack cannot change safely. Hover it to see why:
- Route 53 aliases to an AWS resource, and records with a routing policy. Edit them in the AWS console.
- The Route 53 hosted zone's own name servers.
- Hetzner records protected in the Hetzner Console.
## Remove a provider [#remove-a-provider]
Select the bin on the provider's row and confirm **Remove**. LogiStack forgets the credentials. Records it already created stay at the provider. A provider that domains still use can't be removed: delete those domains or switch them to **I'll manage the record myself** first.
## Common problems [#common-problems]
**`The provider refused the credential`.** The token or key is wrong, expired, or lacks permission. Create a new one with the permissions above.
**A zone is missing from the wizard.** The credential cannot see it. For Cloudflare, check the token's zone resources. For Route 53, check the IAM policy's `Resource`. For OVHcloud, check the key's rights. For Porkbun, turn on **API Access** for the domain.
**`Couldn't load the zone`.** The provider API did not answer or the credential lost access. Select **Try again**. If it persists, reconnect the provider.
**A domain in a managed zone still asks for a manual record.** The zone is not selected on the provider. The dashboard cannot change a provider's zones yet; the REST API can (`PATCH /api/dns-providers/{id}` with a `zones` list), and so can the `dns_provider_update` tool of the [MCP server](../automation/mcp-server.mdx).
# Add a domain to a service
URL: https://stack.logicaltech.it/docs/networking/domains/
Route your own hostname or a generated sslip.io hostname to a service, create its A, AAAA or CNAME record, and route by path prefix.
A domain tells the Caddy proxy to send requests for a hostname to one port of a service. You need one whenever people or other systems should reach a service from the internet. LogiStack can also create the DNS record for you when a [connected DNS provider](./dns-providers.mdx) manages the zone, and it gets the HTTPS certificate on its own.
You can add a domain in three places:
- The service's **Domains** tab, for the quick path: hostname, port, done.
- The **Domains** page in the sidebar, with the full wizard: DNS record type, propagation check, certificate mode and path prefix.
- The **Domain** step of the new service wizard, when you create the service.
## Add a domain from the service [#add-a-domain-from-the-service]
### Open the Domains tab [#open-the-domains-tab]
Open the project, select the service, then select the **Domains** tab. It lists the service's domains with their status, TLS mode and certificate, and the [Basic auth](./access-control.mdx#basic-auth-for-a-whole-service) panel below.

### Select Add domain [#select-add-domain]
Select **Add domain**. The dialog **Add a domain to web** opens.

### Enter the hostname and port [#enter-the-hostname-and-port]
Type the **Hostname**, for example `shop.example.com`, without `https://`. **Port** is prefilled with the port of the service's HTTP health check, or its first port, or `80`. Change it to the port your app listens on inside the container, for example `3000`.
As you type, LogiStack checks whether a connected DNS provider manages the zone:
- If one does, the dialog says `example.com is managed by Cloudflare · Acme: the record is created for you.` LogiStack creates an A record (or AAAA for an IPv6 server) pointing at the server and issues the certificate over DNS-01.
- If none does, the dialog says `No connected provider manages this zone. Point an A record at 203.0.113.10.` You create the record yourself, see [DNS records to create](#dns-records-to-create).
### Pick the exposure [#pick-the-exposure]
This step only appears when the zone's Cloudflare provider has a [Cloudflare Tunnel](./cloudflare-tunnels.mdx). Under **Exposure**, pick:
- **Public, Let's Encrypt**: this server answers on 443 with its own certificate.
- **Cloudflare Tunnel**: the domain is served through the tunnel, with no open ports.
### Save [#save]
Select **Add domain**. The domain appears with status **Pending**, then turns **Active** once the proxy has loaded it.
For a path prefix, a CNAME record, a proxied Cloudflare record, an uploaded certificate or plain HTTP, select **Advanced setup** in the dialog. It opens the wizard below with the service already picked.
## Add a domain with the wizard [#add-a-domain-with-the-wizard]
### Open the Domains page [#open-the-domains-page]
Select **Domains** in the sidebar. The page lists every hostname the proxy routes in your organization, with a one-line summary of what needs attention, such as `10 domains, 1 with errors, 2 certificates expiring within 14 days, 1 waiting for the proxy.`

### Select Add domain [#select-add-domain-1]
Select **Add domain**. The **Add a domain** wizard opens on **Which service?**.

### Pick the service [#pick-the-service]
Open **Pick a service** and search by service or project name. Services are grouped by project. Select **Continue**.
### Enter the hostname, port and path prefix [#enter-the-hostname-port-and-path-prefix]
On **Hostname**, fill in:
- **Hostname**: `shop.example.com`, or a wildcard such as `*.preview.example.com`. See [Wildcard hostnames](#wildcard-hostnames).
- **Container port**: the port the app listens on inside the container, for example `3000`.
- **Path prefix** (optional): `/api` to route only `/api/…` to this service. See [Route by path](#route-by-path).
### Choose how the DNS record is managed [#choose-how-the-dns-record-is-managed]
On **DNS record**, LogiStack looks for a connected provider that manages the zone.
If one does, it shows `example.com is managed by Cloudflare · Acme` and offers these choices under **DNS record**:
- **Create the record for me** (Recommended): set at the provider, removed with the domain, and certificates over DNS-01.
- **I'll manage the record myself**: you point it at this server and LogiStack leaves the zone alone.
- **Through the Cloudflare Tunnel**: only when the provider has a tunnel. LogiStack adds the proxied CNAME and Cloudflare issues the certificate.
With **Create the record for me**, pick the **Type** (`A`, `AAAA` or `CNAME`) and check **Points to** (the server's public address, prefilled) or **Target hostname** for a CNAME. On a Cloudflare zone you can turn on **Proxy through Cloudflare**. If the zone already has a record at that name, the wizard warns that creating replaces the record of the same type.
If no provider manages the zone, the step says **No connected provider manages this zone.** and shows the record to create at your DNS host, for example:
| Type | Name | Value |
| --- | --- | --- |
| A | `shop.example.com` | `203.0.113.10` |
### Create the record [#create-the-record]
This step appears only with **Create the record for me**. It shows the record, for example `A shop.example.com → 203.0.113.10`. Select **Create record**. LogiStack writes it at the provider and shows the result. If the provider refuses, the error appears here; fix the value and try again.
### Wait for propagation [#wait-for-propagation]
**Propagation** checks public resolvers until they return the new value. You can select **Continue** before it finishes: the proxy keeps retrying until the name resolves. A wildcard is checked through a name under it, such as `ls-check.preview.example.com`. A proxied Cloudflare record resolves to Cloudflare's addresses, so there is nothing to compare and the step says so.
### Pick the certificate [#pick-the-certificate]
On **HTTPS**, pick how the proxy gets a certificate under **Certificate**:
- **Automatic, DNS-01**: Let's Encrypt over the DNS provider. Works for wildcards, behind Cloudflare's proxy, and before the record propagates.
- **Automatic, HTTP-01**: Let's Encrypt checks this server over port 80, so the record must already point here.
- **Uploaded certificate**: a certificate you uploaded. Pick it under **Certificate**; only certificates whose names cover the hostname are listed.
- **HTTP only**: plain HTTP on port 80. For internal tools behind another proxy.
A record LogiStack manages always gets DNS-01, so HTTP-01 is not offered for it. A tunnel domain skips this step: Cloudflare's edge serves the certificate. See [HTTPS certificates](./https-certificates.mdx).
### Review and add [#review-and-add]
**Review and add** summarizes the route, the DNS record and the certificate. Select **Add domain**. The wizard returns to the Domains page.
## Check that it works [#check-that-it-works]
1. On the Domains page, the domain's **Status** turns from **Pending** to **Active**.
2. The **Certificate** column shows the days left and the issuer, for example `61 days · Jan 6, 2027` and `Issued by E6`. While the certificate is on its way it shows **Waiting for issuance**.
3. Open the hostname. It is a link in the **Domain** column. You should land on your app over HTTPS.
From a terminal:
```bash
dig +short shop.example.com
curl -I https://shop.example.com
```
`dig` should print your server's address, and `curl` should print the app's response headers.
## DNS records to create [#dns-records-to-create]
When no connected provider manages the zone, create the record at your DNS host. Point it at the server's public address, the one LogiStack shows in the dialog and the wizard.
The usual case. One record per hostname:
```txt title="Zone example.com"
shop.example.com. 300 IN A 203.0.113.10
```
At the zone apex (`example.com` itself) an A record is the only option, because a CNAME cannot sit at the apex:
```txt title="Zone example.com"
example.com. 300 IN A 203.0.113.10
```
If the server has a public IPv6 address, add an AAAA record next to the A record so IPv6 visitors reach it too:
```txt title="Zone example.com"
shop.example.com. 300 IN AAAA 2001:db8::10
```
Point a name at another name that already resolves to the server. Useful when you move servers: you update one A record and every CNAME follows.
```txt title="Zone example.com"
srv1.example.com. 300 IN A 203.0.113.10
shop.example.com. 300 IN CNAME srv1.example.com.
```
With **Automatic, HTTP-01** the record must point at the server before Let's Encrypt can check it. If it does not resolve yet, the domain stays **Pending** or shows **Not issued**, and the proxy retries on its own.
If you turn on Cloudflare's proxy (the orange cloud) for a record, set the zone's SSL/TLS mode to **Full (strict)**. With **Flexible**, Cloudflare talks plain HTTP to the server, LogiStack redirects it to HTTPS, and the page loops forever.
## Generated domains [#generated-domains]
A generated hostname works right away, with no DNS to configure. LogiStack builds it from the service name, the last six characters of the service ID, and the base chosen in the [setup wizard](../getting-started/setup-wizard.mdx):
| Base | Example |
| --- | --- |
| sslip.io | `web-a1b2c3.203-0-113-10.sslip.io` |
| nip.io | `web-a1b2c3.203-0-113-10.nip.io` |
| Your own wildcard | `web-a1b2c3.srv1.example.com` |
sslip.io and nip.io answer any name that contains an IP address with that IP, so the hostname resolves to your server without a record. nip.io does not support IPv6; use sslip.io on an IPv6-only server. **Settings** > **General** shows the base in use under **Generated domains**.
To get one, pick **Generated hostname** on the **Domain** step of the new service wizard. The REST API has the same action:
```bash
curl -X POST https://logistack.example.com/api/services/svc_xxxxxxxx/domains/generated \
-H "x-api-key: $LOGISTACK_API_KEY" \
-H "content-type: application/json" \
-d '{"port": 3000}'
```
sslip.io and nip.io are not on the Public Suffix List. Every server on the internet using them shares one Let's Encrypt budget of 50 certificates a week, so HTTPS for these hostnames can fail with a rate-limit error that is outside your control. Use them to try things out, and set up a [per-server wildcard](./wildcard-dns.mdx) for anything you keep.
## Route by path [#route-by-path]
Fill in **Path prefix** in the wizard to send only part of a hostname to a service. Two services can share `example.com`:
| Hostname | Path prefix | Service | Port |
| --- | --- | --- | --- |
| `example.com` | | `web` | `3000` |
| `example.com` | `/api` | `api` | `8080` |
A request for `https://example.com/api/orders` goes to `api`. Every other path goes to `web`. The proxy checks the longest prefix first. The prefix is passed through: `api` receives `/api/orders`, not `/orders`, so the app must serve its routes under `/api`.
## Wildcard hostnames [#wildcard-hostnames]
A hostname such as `*.preview.example.com` matches every name one level under `preview.example.com`, like `pr-42.preview.example.com`. An exact hostname on another domain still wins over the wildcard.
Let's Encrypt issues wildcard certificates only over DNS-01, so a wildcard needs a [connected DNS provider](./dns-providers.mdx) that manages the zone. Without one, the **HTTPS** step says **No connected DNS provider manages this zone.** and the API refuses the domain.
## Redirect one hostname to another [#redirect-one-hostname-to-another]
A domain can send every visitor to another hostname instead of serving the service. The proxy answers with a `308` redirect to that hostname over HTTPS and keeps the path and query. Use it to send `www.example.com` to `example.com`.
### Start the domain wizard [#start-the-domain-wizard]
On the **Domains** page, select **Add domain**, or select the pencil icon (**Edit**) on an existing domain.
### Fill in Redirect to [#fill-in-redirect-to]
On the **Hostname** step, enter the hostname that should redirect, for example `www.example.com`, and type the target in **Redirect to**, for example `example.com`. Leave **Redirect to** empty to serve the service as usual.
### Finish the wizard [#finish-the-wizard]
Complete the DNS and HTTPS steps as for any domain: the redirecting hostname still needs its own DNS record and certificate. The summary shows **Redirects to** under **Route**. Select **Add domain**, or **Save domain** when editing.
From the REST API, set `redirectTo` on the domain:
```bash
curl -X PUT https://logistack.example.com/api/domains/dom_xxxxxxxx \
-H "x-api-key: $LOGISTACK_API_KEY" \
-H "content-type: application/json" \
-d '{
"hostname": "www.example.com",
"port": 3000,
"https": true,
"cert": "auto",
"redirectTo": "example.com"
}'
```
A request for `http://www.example.com/shop?page=2` ends at `https://example.com/shop?page=2`. The Domains page shows `redirects to example.com` under the hostname. [Access rules](./access-control.mdx) do not apply to a redirect; protect the target domain instead.
`PUT /api/domains/{id}` replaces the whole routing, so send `redirectTo` on every `PUT` that should keep the redirect. The dashboard wizard keeps it for you.
## Edit or delete a domain [#edit-or-delete-a-domain]
Each row on the Domains page and on the service's Domains tab has three buttons:
- The shield opens [access rules](./access-control.mdx).
- The pencil opens the wizard with the domain's current values. **Which service?** cannot be changed. The last step is **Review changes** and the button is **Save domain**. The domain returns to **Pending** until the proxy loads the change.
- The bin deletes the domain after you confirm. The proxy stops routing it. A DNS record LogiStack created is removed from the provider; records you created yourself stay as they are.
## Common problems [#common-problems]
**Status is Error.** The message under the status says why, for example a certificate the proxy could not obtain. Hover it to read it in full. Fix the cause (a missing record, a provider token without permission), then open the domain with the pencil and select **Save domain** to retry.
**Stuck on Pending with HTTP-01.** The record does not point at the server yet, or port 80 is blocked. Check with `dig +short shop.example.com` and make sure ports 80 and 443 are open in your provider's firewall.
**` does not manage a zone for `.** The DNS provider linked to the domain does not have that zone selected. Add the zone to the provider, or pick **I'll manage the record myself**.
**`The certificate does not cover `.** The uploaded certificate does not list the hostname. Upload one that does. See [HTTPS certificates](./https-certificates.mdx).
**Redirect loop behind Cloudflare.** The zone's SSL/TLS mode is **Flexible**. Set it to **Full (strict)**.
# HTTPS certificates
URL: https://stack.logicaltech.it/docs/networking/https-certificates/
How LogiStack gets Let's Encrypt certificates over HTTP-01 or DNS-01, how to upload your own or issue a Cloudflare Origin certificate, and how to track expiry.
Every domain with HTTPS needs a certificate. In most cases you do nothing: the Caddy proxy asks Let's Encrypt for one the first time it routes the domain and renews it before it expires. Read this page when you need to understand which method a domain uses, upload a certificate a client gave you, issue a Cloudflare Origin certificate, or change the certificate authority.
## Certificate modes [#certificate-modes]
You pick the mode on the **HTTPS** step of the [domain wizard](./domains.mdx#add-a-domain-with-the-wizard). The **TLS** column on the Domains page shows the short name.
| Mode in the wizard | TLS column | How it works | Use it when |
| --- | --- | --- | --- |
| **Automatic, HTTP-01** | HTTP-01 | Let's Encrypt connects to the server on port 80 to check you control the name. | You manage the DNS record yourself and it already points at the server. |
| **Automatic, DNS-01** | DNS-01 | LogiStack writes a TXT record through a [DNS provider](./dns-providers.mdx) to prove control of the zone. | The zone is on a connected provider. Required for wildcards and for records proxied by Cloudflare. Works before the record propagates. |
| **Uploaded certificate** | Uploaded | The proxy serves a certificate you uploaded. No automatic renewal. | A client or a commercial CA gave you the certificate, or you use a Cloudflare Origin certificate. |
| **HTTP only** | None | No certificate. The domain answers plain HTTP on port 80. | An internal tool behind another proxy that terminates TLS. |
A domain served through a [Cloudflare Tunnel](./cloudflare-tunnels.mdx) shows **Tunnel**: Cloudflare's edge holds the certificate, and the **Certificate** column says **Cloudflare edge**.
For every mode except **HTTP only**, the proxy redirects HTTP requests to HTTPS.
## Automatic certificates [#automatic-certificates]
Caddy issues a certificate the first time a domain with automatic HTTPS is routed, then renews it about 30 days before it expires. Certificates are stored in Redis, so every Caddy instance in the cluster serves the same certificate and none of them asks for its own.
To see them, select **Settings** > **Certificates** in the sidebar. The **Issued automatically** table lists the **Names** each certificate covers, the **Issuer** (Let's Encrypt's intermediate, such as `E6` or `R11`) and when it **Expires**.

A domain covered by a wildcard certificate, such as `shop.acme-retail.it` under `*.acme-retail.it`, has no certificate of its own. See [Wildcard DNS](./wildcard-dns.mdx).
### Change the certificate authority [#change-the-certificate-authority]
By default every automatic certificate comes from Let's Encrypt. To use another authority:
### Open the authority settings [#open-the-authority-settings]
On **Settings** > **Certificates**, expand **Certificate authority** at the bottom of the page.

### Pick an authority [#pick-an-authority]
Under **Certificate authority**, pick one:
- **Let's Encrypt**: trusted everywhere. The default for production.
- **Let's Encrypt staging**: untrusted test certificates with generous rate limits. Use it while you try domains out.
- **ZeroSSL**: trusted, with its own rate limits. Caddy registers with your Let's Encrypt email.
- **Caddy's internal CA**: self-signed, never leaves the server. For air-gapped installs and tests; browsers will warn.
The current one carries a **Current** badge.
### Save [#save]
Select **Save authority**. The change applies at the next proxy sync. Certificates already issued are kept until they renew, so a switch back from staging takes effect as each certificate renews. When the authority is not Let's Encrypt, its name shows next to **Certificate authority** as a reminder.
## Upload a certificate [#upload-a-certificate]
Upload a certificate when a client or a CA gave you one, for example an EV certificate or a wildcard bought for `*.nordwind.de`. You need the certificate chain and its unencrypted private key, both in PEM form.
### Start the upload [#start-the-upload]
On **Settings** > **Certificates**, select **Upload certificate**. The **Upload a certificate** wizard opens.

### Paste the certificate and key [#paste-the-certificate-and-key]
On **Certificate and key**:
- **Certificate chain**: the leaf certificate first, then any intermediates. It starts with `-----BEGIN CERTIFICATE-----`.
- **Private key**: RSA or ECDSA, in PKCS#1, PKCS#8 or SEC1 form, with no passphrase.
```txt title="Certificate chain"
-----BEGIN CERTIFICATE-----
MIIF...leaf certificate for *.nordwind.de...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIE...intermediate certificate...
-----END CERTIFICATE-----
```
The key is encrypted at rest and never shown again.
### Check the pair [#check-the-pair]
On **Check the pair**, select **Check certificate**. LogiStack parses both, confirms the key belongs to the certificate, and shows the names, the issuer and the expiry date, for example `Valid for 2 names`. Nothing is saved yet. An expired certificate fails with `This certificate has expired`.
### Name it [#name-it]
On **Name it**, enter a **Name**, for example `Nordwind wildcard 2027`. You pick the certificate by this name in the domain wizard.
### Upload [#upload]
Review the summary and select **Upload certificate**.
To use it, open the domain in the [domain wizard](./domains.mdx#add-a-domain-with-the-wizard) and pick **Uploaded certificate** on the **HTTPS** step, then pick the certificate under **Certificate**. Only certificates whose names cover the hostname are listed: `*.nordwind.de` covers `booking.nordwind.de` but not `nordwind.de` or `a.b.nordwind.de`.
The **Uploaded** table lists each certificate with its names, issuer, expiry and **Used by**, the number of domains that serve it.
To delete one, select the bin on its row and confirm. The certificate and its private key are erased. Domains using it must switch to another certificate first.
## Issue a Cloudflare Origin certificate [#issue-a-cloudflare-origin-certificate]
When a domain's record is proxied by Cloudflare (the orange cloud), Cloudflare can issue a free Origin certificate for the server, valid for up to 15 years. Only Cloudflare trusts it, which is exactly what the **Full (strict)** SSL/TLS mode needs.
Before you start, the domain must exist in LogiStack, its zone must be on a [Cloudflare DNS provider](./dns-providers.mdx), and the provider's API token needs **Zone › SSL and Certificates › Edit** on the zone, next to its DNS permission.
### Start the wizard [#start-the-wizard]
On **Settings** > **Certificates**, select **Cloudflare Origin certificate**. The **Issue a Cloudflare Origin certificate** wizard opens.

### Pick the domain [#pick-the-domain]
On **Domain**, open **Choose a domain** and pick the hostname, for example `shop.acme-retail.it`. The certificate names exactly this hostname. Tunnel domains and wildcards are not listed.
### Check Cloudflare access [#check-cloudflare-access]
On **Check Cloudflare access**, select **Check access**. LogiStack finds the Cloudflare provider that manages the zone and asks Origin CA, with that provider's token, to list the zone's origin certificates. On success it shows `Ready to issue through Cloudflare · Acme`. Nothing is issued yet.
### Pick the key and validity [#pick-the-key-and-validity]
On **Key and validity**:
- **Key type**: **ECDSA P-256** (Recommended), or **RSA 2048** for tooling that only reads RSA keys.
- **Valid for**: from **7 days** to **15 years**. The default is 15 years.
The private key is generated on the server and encrypted at rest. Only the signing request goes to Cloudflare.
### Issue [#issue]
Review the summary and select **Issue certificate**. The domain switches to the new certificate right away, and it appears under **Uploaded**.
### Set Full (strict) in Cloudflare [#set-full-strict-in-cloudflare]
In the Cloudflare dashboard, set the zone's SSL/TLS encryption mode to **Full (strict)** and keep the DNS record **proxied**.
Browsers do not trust Cloudflare Origin certificates. A visitor who reaches the server directly, past Cloudflare, gets a certificate warning. Keep the record proxied.
## Expiry and renewal [#expiry-and-renewal]
- **Automatic certificates** renew on their own about 30 days before expiry. You only need to act when one keeps failing.
- **Uploaded certificates** and **Cloudflare Origin certificates** never renew on their own. Cloudflare sends no expiry reminders either. Before the date, upload a new certificate (or issue a new Origin certificate), switch each domain to it, then delete the old one.
The dashboard warns you in three places:
- The **Expires** and **Certificate** columns turn amber when 14 days or fewer are left, and red at 3 days or fewer.
- The Domains page summary counts certificates expiring within 14 days.
- LogiStack sends a `certificate.expiring` event 14, 7 and 3 days before expiry, once per threshold. Route it to Slack, email or another channel in [Alerts and notifications](../operations/alerts-and-notifications.mdx).
## Encrypt stored certificate keys [#encrypt-stored-certificate-keys]
Caddy keeps every certificate and its private key in LogiStack's Redis. By default the keys are stored as Caddy writes them. To seal them with AES-256-GCM, using a key derived from LogiStack's master key, set `LS_CADDY_STORAGE_ENCRYPTION=true` on the worker:
```sh
docker service update --env-add LS_CADDY_STORAGE_ENCRYPTION=true logistack_worker
```
The worker then gives Caddy the encryption key with its next configuration, and reads and imports certificates in the same format.
Turning it on is one way. A worker without the setting, after you remove it or roll back to a release that predates it, sends Caddy a configuration without the key, and Caddy can no longer read the certificates it stored encrypted. Running the installer again redeploys the stack from its stack file, so set the variable again after an installer upgrade or repair.
## Common problems [#common-problems]
**`too many certificates already issued for "sslip.io"`.** Generated sslip.io and nip.io hostnames share one Let's Encrypt budget with every other user of those services. Set up a [per-server wildcard](./wildcard-dns.mdx), or switch the authority to **ZeroSSL** while you test.
**A domain stays at Waiting for issuance with HTTP-01.** Let's Encrypt cannot reach the server on port 80. Check that the record points at the server and that port 80 is open in your provider's firewall.
**DNS-01 fails with a provider error.** The provider's token lost access to the zone or lacks DNS edit permission. Open [DNS providers](./dns-providers.mdx) and reconnect it with a token that can edit the zone.
**A CAA record blocks issuance.** If the zone has CAA records, one must allow your authority, for example `0 issue "letsencrypt.org"`. You can add it from the [zone records page](./dns-providers.mdx#manage-zone-records).
**`The certificate does not cover `.** The uploaded certificate does not name the hostname. A wildcard covers one level only.
# How traffic reaches your services
URL: https://stack.logicaltech.it/docs/networking/
How requests reach a LogiStack service through the Caddy proxy on ports 80 and 443, published ports, or a Cloudflare Tunnel, and which one to pick.
A service in LogiStack has no public address until you give it one. Read this page to understand the three ways a request can reach a service: through the Caddy proxy with a domain, through a port you publish on the node, or through a Cloudflare Tunnel. Most web apps need only the first.
## The Caddy proxy [#the-caddy-proxy]
LogiStack runs Caddy as the single entry point for HTTP and HTTPS. Caddy holds ports 80 and 443 on the server. Every [domain](./domains.mdx) you attach to a service becomes a route in Caddy's configuration: a hostname, an optional path prefix, and the container port it forwards to.
A request for `shop.example.com` takes this path:
1. The visitor's resolver looks up `shop.example.com` and gets your server's IP address.
2. The browser connects to port 443 on that address. Caddy answers with the certificate for `shop.example.com`.
3. Caddy matches the hostname (and the path prefix, if you set one) and runs any [access rules](./access-control.mdx) on the domain.
4. Caddy forwards the request to the service's container port over the internal Docker network. The service never needs a published port.
Caddy also does the following for every domain with HTTPS:
- It redirects plain HTTP requests on port 80 to HTTPS with a `308` status, keeping the path and query.
- It gets and renews the certificate on its own. See [HTTPS certificates](./https-certificates.mdx).
- It answers unknown hostnames with a 404 page.
You never edit Caddy's configuration by hand. The desired state lives in the LogiStack database, and the worker compiles it into a Caddy configuration and loads it. A change you save in the dashboard reaches the proxy within a few seconds. The domain shows **Pending** until then, and **Active** once the proxy has loaded it.
Ports 80/tcp, 443/tcp and 443/udp must be free on the server and open in your provider's firewall. See [Install LogiStack](../getting-started/install.mdx).
## Published ports [#published-ports]
Some services do not speak HTTP: a game server, an SMTP relay, a database you want to reach from your laptop. For those, publish a port in the service's **Settings** tab, section **Command and ports**. Each row has a **Container port**, a **Published** port, a **Protocol** (TCP or UDP) and **Bind on**:
- **Its node** binds the port only on the node that runs the replica.
- **Every node** binds it on all nodes through the Swarm routing mesh.
A published port bypasses Caddy. There is no hostname routing, no certificate and no access rule on it.
Docker opens published ports through iptables, which bypasses UFW and firewalld. A published database port is reachable from the internet even when UFW says otherwise. Publish one only when you mean it to be public.
## Cloudflare Tunnels [#cloudflare-tunnels]
A [Cloudflare Tunnel](./cloudflare-tunnels.mdx) serves a domain without any open inbound port. A `cloudflared` container on your server dials out to Cloudflare. Visitors reach Cloudflare's edge, which sends the request down the tunnel to Caddy, which forwards it to the service. Cloudflare issues and serves the certificate.
Use a tunnel for a server behind NAT, a homelab, or a host whose provider blocks inbound ports. You choose per domain whether it goes through the tunnel or through the public proxy.
## Tailscale [#tailscale]
[Tailscale](./tailscale.mdx) puts your servers and chosen services on your private tailnet. Only devices in the tailnet reach a service you publish there, at a hostname such as `grafana..ts.net`. Use it for admin tools that should never face the internet.
## Which one to use [#which-one-to-use]
| You want to | Use |
| --- | --- |
| Serve a website or API on your own domain with HTTPS | A [domain](./domains.mdx) through the Caddy proxy |
| Try a service right away, without DNS | A generated hostname such as `web-a1b2c3.203-0-113-10.sslip.io` (see [Generated domains](./domains.mdx#generated-domains)) |
| Expose a non-HTTP protocol (TCP or UDP) | A published port |
| Serve a domain from a server with no open ports | A [Cloudflare Tunnel](./cloudflare-tunnels.mdx) |
| Reach an admin tool only from your own devices | A [Tailscale](./tailscale.mdx) publication |
| Keep a service private to other services | Nothing. Services in the same environment reach each other on the internal network by default |
## In this section [#in-this-section]
# Network map
URL: https://stack.logicaltech.it/docs/networking/network-map/
See how traffic reaches each LogiStack service, from the internet through Caddy or a Cloudflare Tunnel to every domain, service and running task.
The network map draws how requests reach every service you can see: from the internet, through the Caddy proxy or a Cloudflare Tunnel, to each domain, then to the service and the tasks running it on each node. Use it to answer "where does this hostname go?", to spot a service that publishes a port and bypasses the proxy, or to find which node runs a failing replica.
## Open the map [#open-the-map]
Select **Network** in the sidebar. The map fills the page, with services grouped by environment.

The toolbar above the map shows how many services, domains and tasks are on screen, for example `34 services · 16 domains · 33 tasks`.
## Read the map [#read-the-map]
The map flows from left to right. Each card is one of these:
| Card | Shows | Opens |
| --- | --- | --- |
| **Internet** | Public traffic, the entry point | |
| **Caddy** | The proxy, on ports 80 and 443 | The **Domains** page |
| **Cloudflare Tunnel** | A tunnel, named after its Cloudflare provider | **Cloudflare Tunnels** |
| Domain | The hostname and path prefix, its status dot, **Public** or **Tunnel**, and the TLS mode: `HTTPS · DNS-01`, `HTTPS · HTTP-01`, `HTTPS · custom cert` or `HTTP only` | The service's **Domains** tab |
| Service | Name, status, running and desired replicas such as `Running 3/3`, published ports such as `:25565→25565`, and the number of mounts | The service |
| Task | The node it runs on, its slot such as `#2`, and its state: **Running**, **Complete**, **Shut down** or the failure state | The node |
The arrow on a card opens the page in the last column. It appears when you hover or select the card.
A domain or service in error has a red outline, so failures stand out at any zoom level.
### Edges [#edges]
The legend in the lower left explains the three kinds of line:
- **Through the proxy**: a solid line from Caddy to a domain and on to its service.
- **Through a Cloudflare Tunnel**: a dashed line from a tunnel to a domain and on to its service.
- **Published port, bypasses the proxy**: a dotted line from the internet straight to a service with a published port. No domain, certificate or [access rule](./access-control.mdx) sits on that path.
A service with no domain and no published port has no line from the internet. Only other services in its environment reach it.
## Focus on part of the map [#focus-on-part-of-the-map]
### Pick a project [#pick-a-project]
Open **All projects** and pick a project. The map keeps that project's services and everything that reaches or runs them.
### Pick an environment [#pick-an-environment]
When the project has more than one environment, a second picker appears. Pick one, or keep **All environments**.
### Search [#search]
Type in **Service, domain or node**. The search matches service, project and environment names, domain hostnames and node hostnames. Searching `shop.acme-retail.it` keeps that domain's service; searching `fra1` keeps every service with a task on that node.
The project, environment and search are part of the page address, so you can share a link to a filtered map. When nothing matches, the map says `Nothing matches. Clear the search or pick another project.`
## Move around [#move-around]
- Drag the background to pan and scroll to zoom.
- Use the zoom buttons in the toolbar: **Zoom out**, **Zoom in** and **Fit to view**.
## Common questions [#common-questions]
**A service I expect is missing.** The map shows only services you have permission to read. Also check the project and environment pickers and clear the search.
**The map is empty.** No service is deployed yet, or none is visible to you. The page says `Nothing to map yet`.
**A domain has no line from Caddy.** It goes through a Cloudflare Tunnel instead; look for the dashed line from the tunnel card.
# Tailscale
URL: https://stack.logicaltech.it/docs/networking/tailscale/
Join every LogiStack server to your Tailscale tailnet and publish chosen services on tailnet hostnames, over HTTPS with a tailnet certificate.
Tailscale puts your servers and chosen services on your private tailnet, where only your own devices reach them. LogiStack runs `tailscaled` on every server, so each server joins the tailnet under its hostname. You can also publish a service on its own tailnet hostname, such as `grafana`, and open it at `https://grafana..ts.net` from any device in the tailnet. Use it for admin tools that should never face the internet, and for servers without a public IP.
Nothing listens on the public internet. Domains through the Caddy proxy and [Cloudflare Tunnels](./cloudflare-tunnels.mdx) keep working next to it.
## Before you start [#before-you-start]
- A Tailscale account and tailnet.
- An auth key. In the Tailscale admin console, open **Settings › Keys** and generate an auth key. Make it **Reusable** and **Ephemeral**.
- To serve HTTPS with a tailnet certificate, turn on **MagicDNS** and **HTTPS Certificates** in the **DNS** page of the admin console.
LogiStack keeps no Tailscale state on disk. A restarted server or service joins again with the key. An ephemeral key makes the old machine leave the tailnet on its own; with a non-ephemeral key, old machines stay in the admin console until you remove them, and a rejoined machine can get a `-1` suffix on its name.
## Set up Tailscale [#set-up-tailscale]
### Open Tailscale [#open-tailscale]
Select **Tailscale** in the sidebar, under **Integrations**.

### Select Set up Tailscale [#select-set-up-tailscale]
Select **Set up Tailscale**. The **Set up Tailscale** wizard opens.

### Paste the auth key [#paste-the-auth-key]
On **Auth key**, paste the key, for example `tskey-auth-k1a2b3c4CNTRL-…`. LogiStack stores it encrypted and never shows it again.
### Publish a service, or skip it [#publish-a-service-or-skip-it]
On **Publish a service**, pick a **Service**, or keep **None, only join the servers**. For a service, set:
- **Tailnet hostname**: the machine name in your tailnet, for example `grafana`. Lowercase letters, digits and hyphens.
- **Container port**: the port the service listens on inside its container, for example `3000`.
- **HTTPS with a tailnet certificate**: on serves HTTPS on port 443 with a certificate from Tailscale. Off serves plain HTTP on port 80.
### Review [#review]
Check the summary on **Review**. Select **Edit** next to a section to change it.
### Turn it on [#turn-it-on]
On **Turn on**, select **Turn on**. The worker starts `tailscaled` on every server and, when you picked a service, its tailnet machine. The step shows a check mark when they run.
### Test over the tailnet [#test-over-the-tailnet]
On **Test over the tailnet**, select **Run test**. The check runs inside `tailscaled` on one of your servers. With a published service, it pings the service's tailnet machine across the tailnet. Without one, it shows the server's tailnet address. Select **Done** when it passes.
## Publish another service [#publish-another-service]
On the **Tailscale** page, select **Publish a service**. The wizard skips the auth key and creates one more tailnet machine. Each published service appears under **Published services** with its hostname, service, port, and whether it serves HTTPS.
To stop publishing a service, select the trash icon on its row. The service keeps running; only its tailnet machine goes away.
## Check that it works [#check-that-it-works]
- In the Tailscale admin console, **Machines** lists each server under its hostname and each published service under its tailnet hostname.
- From a device in the tailnet, open `https://grafana..ts.net`, or `http://grafana` for an HTTP publication.
- On the **Tailscale** page, **Nodes** shows **Running**. A row with a red message shows the worker's last error for it.
## Turn Tailscale off [#turn-tailscale-off]
On the **Tailscale** page, select **Turn off** and confirm. LogiStack forgets the auth key and deletes every publication. The worker then removes `tailscaled` from every server, each published service's tailnet machine, and their serve configs. It removes only Docker objects it labelled for Tailscale. With an ephemeral key, the machines leave your tailnet on their own.
## How it works [#how-it-works]
- `tailscaled` runs as a global Swarm service on the host network, so every server, including ones you add later, joins the tailnet. It uses userspace networking, so it needs no TUN device and no extra capabilities.
- Each published service gets a one-replica service on the service's environment network. It runs `tailscale serve`, which proxies the tailnet hostname to the service's port.
- The auth key reaches the containers through an environment variable, never a command-line argument.
## Troubleshooting [#troubleshooting]
**The Turn on step shows an error.** Read the message under **It didn't start**. An expired or revoked key fails here; generate a new one and run the wizard again to replace it.
**The test says the service didn't answer.** A new machine takes a few seconds to appear in the tailnet; select **Run test** again. Check that the service is running and that **Container port** is the port it listens on.
**The browser warns about the certificate.** HTTPS Certificates is off in the admin console. Turn it on, or publish the service with HTTPS off.
**A server joined twice.** It used a non-ephemeral key and restarted. Remove the offline machine in the admin console, and switch to an ephemeral key.
# Rate limits, blocking, error pages and maintenance mode
URL: https://stack.logicaltech.it/docs/networking/traffic-rules/
Limit requests per IP, block scanner paths and user agents, show a branded page during a failed deploy, and put a service in maintenance mode.
Traffic rules are settings the Caddy proxy applies at the edge, before a request reaches your service. Use them to slow down abusive clients, turn away vulnerability scanners, replace the blank page visitors get while a deploy fails, or close a site for maintenance while your team checks it. Saving reloads the proxy only; the service is not redeployed.
| Setting | Where | Applies to | Answer |
| --- | --- | --- | --- |
| **Rate limit** | The gauge button on a domain's row | That hostname and path prefix | `429 Too Many Requests` |
| **Block requests** | The gauge button on a domain's row | That hostname and path prefix | `403 Forbidden` |
| **Custom error page** | The gauge button on a domain's row | That hostname and path prefix | Your page with `502`, `503` or `504` |
| **Maintenance mode** | The **Maintenance mode** panel on the service's **Domains** tab | Every domain of the service | `503` with a maintenance page |
For each request the proxy runs, in order: block rules, the rate limit, maintenance mode, then the [access rules](./access-control.mdx), then the service. A blocked client never uses up rate-limit budget, and the maintenance page is rate limited too. None of these apply to a domain that redirects to another one: set them on the target domain.
## Limit requests per IP address [#limit-requests-per-ip-address]
### Open the traffic rules [#open-the-traffic-rules]
Open the service's **Domains** tab and select the gauge button on the domain's row. The **Traffic rules** drawer opens.
### Set the limit [#set-the-limit]
Turn on **Rate limit**. Enter **Requests per second**, the average one IP address may send, and **Burst**, how many it may send at once. A page load fetches many files together, so keep the burst well above the rate: for example 10 requests per second with a burst of 50. The burst must be at least the rate.
### Exempt your own addresses [#exempt-your-own-addresses]
Under **Exempt addresses**, add one address or CIDR range per line, such as your office (`203.0.113.0/24`) or an uptime monitor. They are never limited.
### Save [#save]
Select **Save**. The proxy applies the limit within a few seconds.
To check it, send more requests than the burst in under a second:
```bash
for i in $(seq 1 60); do curl -s -o /dev/null -w "%{http_code}\n" https://shop.example.com/; done | sort | uniq -c
```
Requests above the limit get `429` with a `Retry-After` header.
The limit counts requests per client address over a sliding window of burst ÷ rate seconds: with 10 per second and a burst of 50, at most 50 requests in any 5 seconds. Each proxy instance counts on its own, so with several ingress nodes a client spread across them can send more.
Through a [Cloudflare Tunnel](./cloudflare-tunnels.mdx) every request comes from `cloudflared`, so a per-address limit would hold back every visitor at once. The **Rate limit** switch is disabled on tunnel domains; use Cloudflare's own rate limiting there.
## Block paths and user agents [#block-paths-and-user-agents]
Turn on **Block requests** in the **Traffic rules** drawer, then fill in either list:
- **Paths**: one per line. Matching ignores case, and `*` matches anything: `/wp-admin*` blocks `/wp-admin` and everything under it, `/.env` blocks only that exact path.
- **User agents**: one per line. A request whose `User-Agent` header contains the text, in any case, is blocked. `sqlmap` matches `sqlmap/1.7.2#stable`.
Select **Save**. Matching requests get `403` and never reach the service. To check a path rule, open it with `curl -I https://shop.example.com/wp-admin/` and look for `403`.
Block rules stop low-effort scanners. A client can send any user agent it likes, so do not rely on them to protect private pages: use [access rules](./access-control.mdx) for that.
## Show a page when the service is down [#show-a-page-when-the-service-is-down]
When the proxy cannot reach a service, for example while a new version starts after a failed deploy, it waits up to 30 seconds and then answers `502`, `503` or `504`. Instead of a blank page, visitors see a page with your organization's name and logo, saying the site is temporarily unavailable. The name and logo come from the organization settings. Every domain gets this page; you do not need to turn it on.
To show your own page instead:
### Turn on the custom page [#turn-on-the-custom-page]
In the **Traffic rules** drawer, turn on **Custom error page**.
### Paste the HTML [#paste-the-html]
Paste a complete HTML page of at most 64 KB into **HTML**. Put styles and images inline (`