Install Trama with Docker

Trama runs in Docker containers: application, web server, database, cache and a mail server for testing. This guide follows the README (opens in a new tab) in the repository.

Prerequisites

  • Docker Desktop, or Docker Engine with the Compose plugin.
  • At least 4 GB of free RAM.
  • These free ports on the host:
Ports Trama uses on the host
PortServiceVariable
8081Trama (web)TRAMA_HTTP_PORT
5432PostgreSQLTRAMA_DB_PORT
6379RedisTRAMA_REDIS_PORT
1025Mailpit, SMTPTRAMA_MAIL_SMTP_PORT
8025Mailpit, web interfaceTRAMA_MAIL_UI_PORT
5173Vite, development onlyTRAMA_VITE_PORT

Quick install

Seven steps, the same as in the README. Run the commands in the folder where you want to install Trama.

  1. Step 1: Clone the repository

    $ git clone https://github.com/lejubila/trama-dev.git trama
    $ cd trama
  2. Step 2: Configure the environment

    The second command matches the container user to the owner of the folder: without it, composer and npm can't write vendor/ and node_modules/.

    $ cp .env.example .env
    $ sed -i "s/^TRAMA_UID=.*/TRAMA_UID=$(id -u)/; s/^TRAMA_GID=.*/TRAMA_GID=$(id -g)/" .env
  3. Step 3: Start the containers

    The first run builds the application image and takes a few minutes.

    $ docker compose up -d --build
  4. Step 4: Install the PHP dependencies

    $ docker compose exec app composer install
  5. Step 5: Generate the key and set up the database

    --seed loads the sample data: example customers and the three users listed below.

    $ docker compose exec app php artisan key:generate
    $ docker compose exec app php artisan migrate --seed
  6. Step 6: Link the uploads folder

    Creates the public/storage → storage/app/public link used for photos, floor plans and icons.

    $ docker compose exec app php artisan storage:link
  7. Step 7: Build the front end

    While developing, use docker compose exec app npm run dev instead of npm run build.

    $ docker compose exec app npm install
    $ docker compose exec app npm run build

First login

Open http://localhost:8081 and sign in with one of the sample users. Emails sent by Trama never leave your machine: you'll find them in Mailpit at http://localhost:8025.

Sample users created by --seed
RoleEmailPasswordWhat they can do
Admin[email protected]passwordManages users, customers and all data
Technician[email protected]passwordManages every customer's data
Customer[email protected]passwordViews the customers they're assigned to

Troubleshooting

vendor does not exist and could not be created, or permission denied

The same problem can show up as permission denied on storage/ or node_modules/. Commands in the container run as the app user, with UID and GID taken from TRAMA_UID and TRAMA_GID in .env (default 1000). They must match the owner of the project folder on the host.

  1. Compare the folder owner with your user.

    $ ls -ldn .          # UID and GID owning the folder
    $ id -u; id -g       # your UID and GID
  2. Set TRAMA_UID and TRAMA_GID in .env to those values, then rebuild the images.

    $ docker compose build app scheduler && docker compose up -d
  3. If the folder was cloned as root, take ownership of it first.

    $ sudo chown -R $(id -u):$(id -g) .

A port is already in use

If docker compose up reports that a port is already allocated, change the matching TRAMA_*_PORT variable in .env (see Prerequisites) and run docker compose up -d again.

Useful commands

Shell in the application container

$ docker compose exec app bash

Tinker (Laravel console)

$ docker compose exec app php artisan tinker

Tests

$ docker compose exec app php artisan test

Code formatting (Pint)

$ docker compose exec app ./vendor/bin/pint

Static analysis (PHPStan)

$ docker compose exec app ./vendor/bin/phpstan analyse

Queue worker — already running in the scheduler container

$ docker compose exec app php artisan queue:work

Full database reset — erases everything and reloads the sample data

$ docker compose exec app php artisan migrate:fresh --seed

Default icons: install the missing ones without touching customised ones

$ docker compose exec app php artisan icons:defaults

Default icons: update the set with the global icons currently configured

$ docker compose exec app php artisan icons:defaults --export

Connecting an AI assistant

Trama includes an MCP server at https://<your-host>/mcp (Streamable HTTP). claude.ai and ChatGPT connect with OAuth: you approve access in Trama and copy no token. Claude Code, Claude Desktop, Cursor and VS Code use an API token. The REST API rules apply: token permissions, allowed customers, roles, validation and activity log. All the details are in the repository's MCP guide (opens in a new tab).

claude.ai and ChatGPT (OAuth)

  • Trama must be reachable from the internet over HTTPS, with a valid certificate. The connection starts from Anthropic's and OpenAI's servers, not from your browser: an instance reachable only on the LAN or through a VPN won't work.
  • A paid plan on the AI platform.
  • A Trama admin user.

claude.ai

  1. On claude.ai open Settings → Connectors → Add custom connector. On Team and Enterprise plans an owner adds it, from Organization settings → Connectors.

  2. Enter https://<your-host>/mcp as the URL and leave the advanced OAuth fields empty.

  3. Click Connect: Trama opens. Sign in as an admin.

  4. On the “Claude wants to access Trama” page choose the permissions (read-only is preset) and, if you like, the customers, then click Allow access.

  5. You're back on claude.ai with the connector active. Enable it in a chat from the tools menu and ask, for example, “List the customers in Trama”.

ChatGPT

  1. Turn on developer mode: Settings → Apps & Connectors → Advanced settings → Developer mode. It's needed for write tools.

  2. Create an app or connector with URL https://<your-host>/mcp and OAuth authentication. Client registration is automatic.

  3. Connect: Trama opens. Sign in as an admin, choose the permissions and allow access.

Both platforms rename their menus often: if you can't find them, look for “custom connector” or “MCP” in their settings.

Create a token

For Claude Code, Claude Desktop, Cursor and VS Code. Only an admin can do this.

  1. In Trama open API tokens and click Create token.

  2. Tick MCP access (AI assistants): without this permission /mcp answers 403.

  3. Choose what the assistant can do with the permission table. Start with Read only, then add the writes you need.

  4. Optionally restrict the token to one or more customers. With a single customer the assistant doesn't even have to name it.

  5. Set an expiry and copy the token: it's shown only once.

Connect the client

Claude Code

$ claude mcp add --transport http trama https://<your-host>/mcp \
  --header "Authorization: Bearer <token>"

Then, in a Claude Code session, ask “Use Trama to list the customers”. /mcp shows the connection status. Claude Code can also use OAuth: add the server without the header, then /mcp → Authenticate.

$ claude mcp add --transport http trama https://<your-host>/mcp

Claude Desktop

Claude Desktop connects remote servers through the mcp-remote bridge, which needs Node.js 20 or later. The file is claude_desktop_config.json (Settings → Developer → Edit config); restart Claude Desktop afterwards.

{
  "mcpServers": {
    "trama": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://<your-host>/mcp",
               "--header", "Authorization:${TRAMA_AUTH}"],
      "env": { "TRAMA_AUTH": "Bearer <token>" }
    }
  }
}

Cursor

In ~/.cursor/mcp.json, or in .cursor/mcp.json inside the project.

{
  "mcpServers": {
    "trama": {
      "url": "https://<your-host>/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

VS Code (GitHub Copilot)

In .vscode/mcp.json.

{
  "servers": {
    "trama": {
      "type": "http",
      "url": "https://<your-host>/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Manual test

With MCP Inspector (Node.js 22 or later), to see which tools the token makes available.

$ npx @modelcontextprotocol/inspector --cli https://<your-host>/mcp --transport http \
  --header "Authorization: Bearer <token>" --method tools/list

Running a public demo

Trama can run as a public demo: visitors sign in with one click, change the data (except users) and every day everything goes back to its initial state. That's how demo.tramanet.work works.

  1. Step 1: Prepare the data

    Create a curated sample customer, locally if you like, with photos, floor plans, Wi-Fi, VPNs, documents and snapshots, and export it from Customers → Export data. Put the .zip in database/demo/: every archive there becomes a demo customer.

  2. Step 2: Configure .env on the demo server

    APP_ENV=production
    APP_DEBUG=false
    MAIL_MAILER=log
    DEMO_MODE=true
    [email protected]
    DEMO_USER_PASSWORD=demo
    DEMO_RESET_TIME=03:00
    DEMO_TIMEZONE=Europe/Rome
    
    # If the default ports are taken on the host:
    APP_URL=http://your-host:8083
    SANCTUM_STATEFUL_DOMAINS=your-host:8083
    TRAMA_HTTP_PORT=8083
    TRAMA_REDIS_PORT=6380
  3. Step 3: Start the scheduler and load the data for the first time

    From then on the scheduler container repeats the reset every day at DEMO_RESET_TIME, in the DEMO_TIMEZONE time zone.

    $ docker compose up -d scheduler
    $ docker compose exec app php artisan demo:reset

What changes in demo mode

  • The sign-in page shows the “Enter the demo” button and the credentials.
  • A banner on every page warns about the daily reset, with a countdown; after a reset a notice appears.
  • User management, profile, email and password changes, account deletion, API tokens, the MCP server and OAuth, assigning users to customers and password recovery are disabled.
  • Language and active customer are stored in each visitor's session, because the demo account is shared.

Upgrading

  1. Step 1: Back up the database

    $ docker compose exec -T postgres pg_dump -U trama trama > trama-backup.sql
  2. Step 2: Get the new version

    $ git pull
  3. Step 3: Rebuild and restart the containers

    Needed in case the application image has changed.

    $ docker compose up -d --build
  4. Step 4: Update dependencies, database and front end

    With APP_ENV=production, migrate asks for confirmation before running.

    $ docker compose exec app composer install
    $ docker compose exec app php artisan migrate
    $ docker compose exec app npm install
    $ docker compose exec app npm run build

To add any new default icons without touching customised ones, also run docker compose exec app php artisan icons:defaults.