App Deployment
Self-Contained Apps
Every THT app includes a standalone copy of the THT runtime.
This means you can copy your app files to a remote server and it should work with few, if any, changes.
Here is an example rsync
script to copy files to a remote server:
rsync -azvrW --progress -e "ssh " /local/path/myApp/* user@mysite.com:/remote/path/myApp/
Troubleshooting
If you run into any issues, you can run tht fix
to safely update your app to fix common problems.
$ tht fix
This will:
- Clear the app cache
- Set necessary file permissions
Manual Troubleshooting
If this does not fix an issue, double-check the following:
- Your webserver config is pointing to the correct document root folder.
- Your THT
app
directory is adjacent to (i.e. a sibling of) the document root. - Permissions are set on your
app
directory so the webserver has read/write access. (see below)
Permissions
Permissions are a common source of errors during deployment.
The webserver’s user account will need:
- read access to the
app
directory - write access to
app/data
If tht fix
does not work, you may need to update permissions manually.
For example, on Linux, you might run this command to change ownership of the app
directory to the www-data
(a common user account for Apache):
sudo chown -R www-data app
Request Routing (Apache)
When you create an app, THT adds an .htaccess
file to your document root folder.
This tells Apache to route all requests to your app for any URL that doesn’t point to a static file.
All THT requests go through the thtApp.php
script in your document root.