-
Notifications
You must be signed in to change notification settings - Fork 33
Installation
Mark Metcalfe edited this page Nov 27, 2024
·
35 revisions
- Install and set up WSL2 with Ubuntu following the instructions on Microsoft's website: https://docs.microsoft.com/en-us/windows/wsl/install
- Open Windows Terminal and open a Ubuntu terminal instance
- Follow the Ubuntu Prerequisites, running commands inside your Ubuntu terminal instance
- Follow the instructions to install Docker Engine using the apt repository from the Docker docs
- Add your user to the docker group via
sudo groupadd docker -f && sudo usermod -aG docker $USER
- Log out and log back in to make sure the Docker setup and permissions have 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 or Docker Engine 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
sudo rm -f /usr/local/bin/docker && sudo ln -s ~/.rd/bin/docker /usr/local/bin/docker
- 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. - 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
- Windows Note: Make sure you are using a Ubuntu terminal, and not Command Prompt or Powershell
-
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.
vim .env
) and change the following lines:- Set
LOCAL_SRC
to your totara-sites folder, e.g.~/totara-sites
-
MacOS Only: Set (or add if not exists) this line to enable the use of mutagen:
USE_MUTAGEN=1
- Set
- 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
- Update your
/etc/hosts
file to include the totara host entries-
MacOS & Ubuntu: Run
~/totara-docker-dev/tools/set_hosts.sh
(requires your sudo password) -
Windows: 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).
Hosts file example
127.0.0.1 totara74 127.0.0.1 totara74.debug 127.0.0.1 totara80 127.0.0.1 totara80.debug 127.0.0.1 totara81 127.0.0.1 totara81.debug 127.0.0.1 totara82 127.0.0.1 totara82.debug 127.0.0.1 totara83 127.0.0.1 totara83.debug 127.0.0.1 integration.totara74 127.0.0.1 integration.totara74.debug 127.0.0.1 integration.totara80 127.0.0.1 integration.totara80.debug 127.0.0.1 integration.totara81 127.0.0.1 integration.totara81.debug 127.0.0.1 integration.totara82 127.0.0.1 integration.totara82.debug 127.0.0.1 integration.totara83 127.0.0.1 integration.totara83.debug
-
MacOS & Ubuntu: Run
-
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
-
Ubuntu / Windows:
sudo apt update && sudo apt 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
- Windows: via this installer
-
MacOS: via
- Set “Hack Nerd Font” as font for your terminal
- MacOS: in iTerm2 go to Settings → Profiles → Text
- Windows: in Windows Terminal, go to Settings → Profiles → Ubuntu → Appearance → Font face
Windows Only: IDE Setup with WSL
VS Code: Make sure you have the WSL extension installed. Check out its documentation for more information on how to use it
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