# Zammad

Zammad ist ein freies Helpdesk- bzw. Issue-Tracking-System.

# Konsole

# Ticket löschen

<p class="callout danger">The commands listed here cause **irrecoverable data loss**! Only proceed if you know what you’re doing and you [<span class="doc">have a backup</span>](https://docs.zammad.org/en/latest/appendix/backup-and-restore/index.html)!</p>

<p class="callout info">Please note that this is not a full command list, if you’re missing commands, feel free to ask over at the [Community](https://community.zammad.org/).</p>

## Removing Tickets (And Their Articles)

```
# Delete a ticket (specified by database ID)
>> Ticket.find(4).destroy

# Delete all tickets
>> Ticket.destroy_all

# Keep some tickets (specified by database ID); delete the rest
>> tickets_to_keep = [1, 2, 3]
>> Ticket.where.not(id: tickets_to_keep).destroy_all
```

[https://docs.zammad.org/en/latest/admin/console/dangerzone-for-experts.html#removing-tickets-and-their-articles](https://docs.zammad.org/en/latest/admin/console/dangerzone-for-experts.html#removing-tickets-and-their-articles)

# Befehle ausführen (Docker Compose)

The docker entrypoint script sets up environment variables required by Zammad to function properly. That is why calling `<span class="pre">rails</span>` or `<span class="pre">rake</span>` on the console should be done via one of the following methods:

<p class="callout info">Bevor diese Befehle ausführen, muss das Verzeichnis zum Docker Compose Project gewechselt werden!</p>

```
# Directly execute a specific command:

$ docker compose run --rm zammad-railsserver rails r '...your rails command here...'

# Run the interactive rails console to manually enter Rails commands:

$ docker compose run --rm zammad-railsserver rails c

# Via 'docker exec':

$ docker exec zammad-docker-compose-zammad-railsserver-1 /docker-entrypoint.sh rails r '...your rails command here...'
```

If you need to retrieve information from the rails server, you can place for example `<span class="pre">pp</span>` (pretty print) in front of your rails command. This leads to an output in your terminal.

https://docs.zammad.org/en/latest/install/docker-compose.html

# Knowledge Base

Aktive technische Knowledge-Base-Einträge aus Obsidian.

# Zammad nach System Update 500 Internal Server Error

### Problem  
Nach `apt upgrade` war Zammad über Reverse Proxy (CloudPanel → Zammad) nicht mehr erreichbar.  
  
#### Symptome  
- Frontend:  
- `500: An unknown error occurred`  
- `production.log`:  
- `The asset "application.css" is not present in the asset pipeline`  
- Nginx:  
- Teilweise `connect() failed (111: Connection refused)` auf `127.0.0.1:3000` / `6042`  
  
### Root Cause  
Unvollständiges oder fehlerhaftes Paket-/Asset-Upgrade nach System Update.  
Rails/DB liefen, aber Frontend Assets wurden nicht korrekt gebaut.  
  
### Lösung  

```bash  
sudo apt update  
sudo apt --fix-broken install  
sudo dpkg --configure -a  
sudo apt full-upgrade -y  
  
cd /opt/zammad  
sudo zammad run rake assets:precompile  
  
sudo systemctl restart zammad zammad-web zammad-worker zammad-websocket nginx
```

### Validierung

```
sudo tail -n 50 /var/log/zammad/production.logls -lah /opt/zammad/public/assets | grep application
```

### Lessons Learned

- Reverse Proxy war NICHT Root Cause
- Erst lokale App-Funktion prüfen (`localhost:3000`)
- Nach Updates immer:
    - `dpkg --configure -a`
    - `apt --fix-broken install`
    - `rake assets:precompile`

### Prävention

Vor grösseren Upgrades:

```
apt update && apt full-upgradezammad run rake assets:precompilesystemctl status zammad*
```

---

*Quelle: Obsidian `Knowledge Base/Troubleshooting/Zammad nach System Update 500 Internal Server Error.md` · Stand: 2026-05-17 · Automatisiert publiziert durch Hermes.*