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:
| Port | Service | Variable |
|---|---|---|
| 8081 | Trama (web) | TRAMA_HTTP_PORT |
| 5432 | PostgreSQL | TRAMA_DB_PORT |
| 6379 | Redis | TRAMA_REDIS_PORT |
| 1025 | Mailpit, SMTP | TRAMA_MAIL_SMTP_PORT |
| 8025 | Mailpit, web interface | TRAMA_MAIL_UI_PORT |
| 5173 | Vite, development only | TRAMA_VITE_PORT |
Quick install
Seven steps, the same as in the README. Run the commands in the folder where you want to install Trama.
-
Step 1: Clone the repository
$ git clone https://github.com/lejubila/trama-dev.git trama $ cd trama -
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/andnode_modules/.$ cp .env.example .env $ sed -i "s/^TRAMA_UID=.*/TRAMA_UID=$(id -u)/; s/^TRAMA_GID=.*/TRAMA_GID=$(id -g)/" .env -
Step 3: Start the containers
The first run builds the application image and takes a few minutes.
$ docker compose up -d --build -
Step 4: Install the PHP dependencies
$ docker compose exec app composer install -
Step 5: Generate the key and set up the database
--seedloads 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 -
Step 6: Link the uploads folder
Creates the
public/storage→storage/app/publiclink used for photos, floor plans and icons.$ docker compose exec app php artisan storage:link -
Step 7: Build the front end
While developing, use
docker compose exec app npm run devinstead ofnpm 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.
| Role | Password | What they can do | |
|---|---|---|---|
| Admin | [email protected] | password | Manages users, customers and all data |
| Technician | [email protected] | password | Manages every customer's data |
| Customer | [email protected] | password | Views 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.
-
Compare the folder owner with your user.
$ ls -ldn . # UID and GID owning the folder $ id -u; id -g # your UID and GID -
Set
TRAMA_UIDandTRAMA_GIDin.envto those values, then rebuild the images.$ docker compose build app scheduler && docker compose up -d -
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 bashTinker (Laravel console)
$ docker compose exec app php artisan tinkerTests
$ docker compose exec app php artisan testCode formatting (Pint)
$ docker compose exec app ./vendor/bin/pintStatic analysis (PHPStan)
$ docker compose exec app ./vendor/bin/phpstan analyseQueue worker — already running in the scheduler container
$ docker compose exec app php artisan queue:workFull database reset — erases everything and reloads the sample data
$ docker compose exec app php artisan migrate:fresh --seedDefault icons: install the missing ones without touching customised ones
$ docker compose exec app php artisan icons:defaultsDefault icons: update the set with the global icons currently configured
$ docker compose exec app php artisan icons:defaults --exportRunning 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.
-
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
.zipindatabase/demo/: every archive there becomes a demo customer. -
Step 2: Configure
.envon the demo serverAPP_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 -
Step 3: Start the scheduler and load the data for the first time
From then on the
schedulercontainer repeats the reset every day atDEMO_RESET_TIME, in theDEMO_TIMEZONEtime 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, 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
-
Step 1: Back up the database
$ docker compose exec -T postgres pg_dump -U trama trama > trama-backup.sql -
Step 2: Get the new version
$ git pull -
Step 3: Rebuild and restart the containers
Needed in case the application image has changed.
$ docker compose up -d --build -
Step 4: Update dependencies, database and front end
With
APP_ENV=production,migrateasks 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.