-
Notifications
You must be signed in to change notification settings - Fork 32
Installation
Mark Metcalfe edited this page Nov 24, 2024
·
35 revisions
- Follow the instructions to install Docker and Docker Compose
- Log out of the terminal and log back in to make sure the Docker setup has been fully applied.
- Try running
docker run hello-world
. If the installation of Docker was all successful Docker should pull the image and run it. - Test whether
docker compose help
works.
- Install Rancher Desktop (do not install Docker Desktop otherwise it will create conflicts)
- You won’t need Kubernetes so you can disable it during installation
- After the installation open the Preferences in Rancher, go to “Virtual Machine” and increase the Hardware limits, if possible at least 8 CPUs and 12 - 16 GB RAM
- Open a terminal and run
ln -s ~/.rd/bin/docker /usr/local/bin/docker
(if you get a permissions error try again prefixed withsudo
. This command ensures mutagen which we’ll install next works without issues. - Open a terminal and try running
docker run hello-world
. If the installation of Rancher was all successful Docker should pull the image and run it.
Mutagen is a synchronisation tool and enables the set up to perform at much higher levels than with regular Docker volume mounts (they are really slow on Mac OS).
- Install Homebrew
- Open your terminal and install mutagen using homebrew:
brew install havoc-io/mutagen/mutagen
- Register the mutagen daemon so it starts automatically:
mutagen daemon register
- Start the daemon with:
mutagen daemon start
- Run the command
mutagen sync list
to test whether it’s working. You should see an empty list of synchronisation options.
Clone the Totara source code (For Totara employees, please use internal
GIT repository) into your site folder and give it a name (e.g. cd ~/totara-sites && git clone REPO_URL integration
)
- If you have not created an SSH key yet, use these instructions to create one (make sure you use a strong password for your private key).
- Log into your Github account
- Add your public SSH key to your Github account
- Open a terminal
-
Clone this repository:
git clone [email protected]:totara/totara-docker-dev.git ~/totara-docker-dev
- In your
~/totara-docker-dev
directory copy the.env.dist
file to.env
:cp .env.dist .env
- Edit the file (e.g.
nano .env
) and change the following lines: - Set
LOCAL_SRC
to your totara-sites folder, e.g./Users/USERNAME/totara-sites
-
MacOS Only: Set (or add if not exists) this line to enable the use of mutagen:
USE_MUTAGEN=1
- Add the
~/totara-docker-dev/bin
folder to your PATH environment variable, e.g. by adding the following to your~/.bashrc
or~/.zshrc
file:export PATH="$HOME/totara-docker-dev/bin:$PATH"
- Copy the file template config.php from your totara-docker-dev folder to your Totara codebase,
cp ~/totara-docker-dev/config.php ~/totara-sites/integration
- Run the
tools/set_hosts.sh
script to add all required host entries to your/etc/hosts
file:sh ~/totara-docker-dev/tools/set_hosts.sh
(you will have to enter your password) -
MacOS Only: If you are using a Mac with Apple Silicon (M1/2/3/4 chip) follow the steps on Apple Silicon support to create a custom docker-compose file
~/totara-docker-dev/custom/arm.yml
- If PHP is not installed (check with php -v) then install it as it’s needed for some of our helper scripts:
-
MacOS: via Homebrew (see also):
brew install php
and verify withphp -v
-
Linux:
sudo apt-get update && sudo apt-get install php-cli
, verify withphp -v
-
MacOS: via Homebrew (see also):
- Run the following command to test whether everything is working:
tup php-8.3 pgsql13
-
MacOS Only: Now make sure the mutagen file synchronisation is running with
mutagen sync monitor totara
. It might take a while for the initial synchronisation to finish. You should see the status "Watching for changes" which marks a successful sync. - Download and install the extended font "Hack Nerd Font" to render additional icons in the container shells: Download site
-
MacOS: via
brew install font-hack-nerd-font
-
MacOS: via
- Set “Hack Nerd Font” as font for your terminal
- MacOS: in iTerm2 go to Settings → Profiles → Text
- Install and set up WSL2 following the instructions on Microsoft's website: https://docs.microsoft.com/en-us/windows/wsl/install (Ubuntu is the recommended choice)
- Either open the start menu, search and open “Ubuntu” (if you have used this as your distro) or open Windows Terminal (the app called "windows terminal", you may have to install it) and open a terminal to your Linux distro. From this point, all commands will be run inside the terminal.
- Follow the instructions to install Docker and Docker Compose
- Log out of the terminal and log back in to make sure the Docker setup has been fully applied.
- Try running
docker run hello-world
. If the installation of Docker was all successful Docker should pull the image and run it. - Test whether
docker compose help
works.
Clone the Totara source code (For Totara employees, please use internal
GIT repository) into your site folder and give it a name (e.g. cd ~/totara-sites && git clone REPO_URL integration
)
- Run the following from within your Ubuntu distro
- If you have not created an SSH key yet, use these instructions to create one (make sure you use a strong password for your private key).
- Log into your Github account
- Add your public SSH key to your Github account
-
Clone the repository:
git clone [email protected]:totara/totara-docker-dev.git ~/totara-docker-dev
- In your
~/totara-docker-dev
directory copy the.env.dist
file to.env
:cp .env.dist .env
- Edit the file (e.g.
nano .env
) and changeLOCAL_SRC
to your totara-sites folder, e.g./Users/USERNAME/totara-sites
- Add the
~/totara-docker-dev/bin
folder to your PATH environment variable, e.g. by adding the following to your~/.bashrc
or~/.zshrc
file:export PATH="$HOME/totara-docker-dev/bin:$PATH"
- Copy the file template config.php from your totara-docker-dev folder to your Totara codebase,
cp ~/totara-docker-dev/config.php ~/totara-sites/integration
- Run the following command to test whether everything is working:
tup php-8.3 pgsql13
- All containers should successfully start up without any warnings and errors.
- If PHP is not installed (check with
php -v
) then install it as it’s needed for some of our helper scripts. Install via:sudo apt-get update && sudo apt-get install php-cli
, verify withphp -v
.
- Download and install the extended font to render additional icons in the container shells.
- Set “Hack Nerd Font” as font for your terminal (in iTerm2 go to Settings → Profiles → Text)
- Update the hosts file (howto) and add the following to it. Note that you have to edit this file should you check out more sites in parallel (otherwise those are not reachable via sitename.totara83) or you need more PHP versions to be available (5.6 or earlier, or newly added ones).
127.0.0.1 totara74
127.0.0.1 totara80
127.0.0.1 totara81
127.0.0.1 totara82
127.0.0.1 totara83
127.0.0.1 integration.totara74
127.0.0.1 integration.totara80
127.0.0.1 integration.totara81
127.0.0.1 integration.totara82
127.0.0.1 integration.totara83
- If you are using VS Code as your IDE make sure you have the WSL extension installed. Check out its documentation for more information on how to use it
- If you are using PHPStorm check out its documentation for more information on how to use it with WSL.
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