-
Notifications
You must be signed in to change notification settings - Fork 33
Usage
Like any CMS, you will need a database to run Totara.
The easiest way to set up a database is via the tdb
command.
It allows you to easily interact with any of the 4 supported DBMSes in a simple and consistent way.
The script allows you to create, drop, backup and restore any database without having to remember the specific commands for each dbms.
To get started, simply define which database type and host you wish to use in your config.php
, then run:
cd sitefolder # must run the command from the root of your Totara repo
tdb # prints help - shows what commands are available
tdb create
Alternatively, you can manually configure your databases using these commands and credentials.
Once you have a database created, you should be able to access the site from the web -
try visiting http://sitename.totaraXX (where sitename
is the folder name of your Totara repo, and XX
is the PHP version - e.g. http://engage.totara74/
)
It is recommended to specify the containers you really need.
The minimum you need is the database and the php container of your choice.
nginx
(webserver) will be started by default alongside your DB container. If you wish to use apache
instead of nginx
, you will need to tstop nginx
first, and then tup apache
.
The scripts for the following commands are located in the bin/
folder of this project.
# equivalent to: docker-compose up -d nginx pgsql14 php-8.0
tup nginx pgsql14 php-8.0
# equivalent to: docker-compose up -d apache mysql php-7.2
tup apache mysql php-7.2
If you need additional containers at a later point just run tup
with the container you need:
tup php-5.6
tup mariadb
tup selenium-hub
For the PHP containers, you can use the z shell to run commands for your Totara site via tzsh
:
cd sitefolder # must run the commands from the root of your Totara repo
tzsh php-7.3
# OR
tzsh php-7.3-debug # for XDebug support
# OR
tzsh php-5.6 # for older Totara versions
For detailed information about how to set up aliases and use the correct fonts, see the PHP Shell page.
You can also start a shell session for any container using tbash
too, although note it doesn't have the same aliases and themes as the PHP containers:
# It doesn't matter where you run the tbash command from
tbash nginx
tbash pgsql
tbash apache
# stops the specified containers, equivalent to: docker-compose stop
tstop
# stops all containers, equivalent to: docker-compose down
# also pauses existing mutagen sessions
tdown
This project comes with a few bash scripts to simplify usage across platforms. The scripts are located in the bin/
folder.
tbash [container] # log into a container via bash, i.e. nginx
tbuild [container] # build (all) container(s)
tdb [options] # run common actions for your databases
tdocker # shortcut to general docker-compose ... command
tdown # shutdown all containers
tgrunt [options] # run grunt in container, supports running in subfolders
tlogs [container] # gets live logs for a container (or all containers)
tngrok [host] # shortcut to running ngrok with a Totara host such as totara74.debug or totara56
tnpm [options] # run npm in container, supports running in subfolders
tpull # pull latest images (only those which you already have locally)
trestart [container] # restart (all) container(s)
tscale [container] [number] # scale up the number of containers, i.e. `tscale selenium-chrome 6`
tstats # show docker stats including container names
tstop [container] # stop (all) container(s)
tunit [container] [folder] [init] # run or init unit tests in given container for given version
tup [containers] # start (all) container(s)
tzsh [container] # log into a php container via zsh, i.e. php-7.3
With the above information, you should now be able to set up and use your Totara site.
See here for a list of aliases for the PHP containers you can use to get started. There are many more features and productivity tools that totara-docker-dev has to offer, which can be found in the pages listed in the sidebar on the right.
Copyright (c) 2023 Totara Learning Solutions Limited
- Node.js and Grunt
- PHPUnit
- Behat
- Cron
- Machine Learning
- Mailcatcher (for viewing emails)
- Shell Customisations
- Ngrok (for making your site publicly accessible)
-
PHPStorm Integration
- Performance improvements
- Automated testing integration
- XDebug setup
- Database tools