# Environment Configuration

We use Fedora 38 Workstation, but the following steps should be similar on other systems.

We also use a timer to delay the startup of jetty11 at bootup, because it sometimes struggles to perform well at the first start.

```bash
vim /lib/systemd/system/jetty11.timer
```

```bash
[Unit]
Description=Timer for jetty11 Startup Delay
 
[Timer]
OnBootSec=1min
 
[Install]
WantedBy=timers.target
```

```bash
vim /lib/systemd/system/jetty11.service
```

```bash
[Unit]
Description=Jetty 11 Web Application Server
Documentation=https://www.eclipse.org/jetty/documentation/current/
After = syslog.target network.target
 
[Service]
# Configuration
Environment="JETTY_HOME=/opt/jetty-home-11.0.15"
Environment="JETTY_BASE=/opt/jetty-home-11.0.15/jetty-base"
Environment="JETTY_USER=jetty"
Environment="JETTY_HOST=127.0.0.1"
Environment="JETTY_ARGS=jetty.port=8080"
Environment="JETTY_STATE=/var/lib/jetty11/jetty.state"
 
Environment="JAVA_OPTS=-Xms1024m -Xmx3584m -Djava.awt.headless=true"
 
#Configure Jetty Service to use database connection instead of H2 local DB
Environment="DATABASE_URL=jdbc:postgresql://127.0.0.1:5432/teedy_db"
Environment="DATABASE_USER=teedy"
Environment="DATABASE_PASSWORD=password"
 
#set base url for password reset
Environment="DOCS_BASE_URL=https://your.domain.tld"
 
#Configure tesseract performance
Environment="OMP_THREAD_LIMIT=1"
 
# Lifecycle
Type=forking
ExecStart = /opt/jetty-home-11.0.15/bin/jetty.sh start
ExecStop = /opt/jetty-home-11.0.15/bin/jetty.sh stop
ExecReload = /opt/jetty-home-11.0.15/bin/jetty.sh restart
 
# Logging
SyslogIdentifier=jetty11
 
# Security
User=jetty
Group=jetty
PrivateTmp=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
WorkingDirectory=/usr/share/jetty11/
LogsDirectory=jetty11
LogsDirectoryMode=750
ProtectSystem=
ReadWritePaths=/var/lib/jetty9/
ReadWritePaths=/mnt/data/sismics/
 
[Install]
WantedBy=multi-user.target
```

<p class="callout info">More environment vars can be found at [<span>https://github.com/sismics/docs/blob/dd36e08d7d6cd8248f12a9570694b4631be3b04d/README.md#available-environment-variables</span>](https://github.com/sismics/docs/blob/dd36e08d7d6cd8248f12a9570694b4631be3b04d/README.md#available-environment-variables)</p>

```bash
systemctl daemon-reload
systemctl enable jetty11.timer #we do not enable jetty11.service too, because that service is just fully controlled by our timer
systemctl start jetty11.service
systemctl status jetty11.service
```

# Information about Teedy file structure

<div class="table-wrap" id="bkmrk-">  
</div><div class="page view" id="bkmrk-directory-notes-%2Fvar"><article><div class="wiki-content" id="bkmrk-directory-notes-%2Fvar-1"><div class="table-wrap"><table role="grid" style="width: 100.007%;"><colgroup><col style="width: 11.646%;"></col><col style="width: 88.3742%;"></col></colgroup><thead><tr><td>Directory</td><td>Notes</td></tr></thead><tbody><tr role="row"><td>`/var/docs/theme`</td><td>Background image stored here</td></tr><tr role="row"><td>`/var/docs/storage`</td><td>place for alle the files and their automatically generated thumbnails (\*\_thumb) and web previews.   
Note that alle the files inside this dir are encrypted and got hashed file names.   
You can access the file content only inside a running Teedy instance which decrypts the files for you

</td></tr><tr role="row"><td>`/var/docs/log`</td><td>log files. Same output which you get from journalctl -u jetty9.service (if you use systemd)</td></tr><tr role="row"><td>`/var/docs/db`</td><td>H2 database files. Empty but existing if PostgreSQL is used</td></tr><tr role="row"><td>`/var/docs`</td><td>Root Directory</td></tr></tbody></table>

</div></div></article></div><div id="bkmrk--1"><div class="no-print" id="bkmrk--2"></div></div>