Developers
Local development setup
At a glance
You need
docker,docker compose,make,composerandnpminstalled- PHP 8.2 or later on your computer, with the PHP extensions Leantime needs (
make run-devruns Composer there) - A copy (clone) of the Leantime repository
Where you'll work
- A terminal in the root of the Leantime repository
- Your browser, to open Leantime and the test tools
At the end
A local Leantime for development, with its own MySQL database, a mail catcher (MailDev), Redis and S3 test storage.
How to run Leantime from source to work on its code. To run Leantime for your team, use Docker or a package installation instead.
Development using Docker
Section titled “Development using Docker”You need git, docker (with docker compose), make, composer, npm, and PHP 8.2 or later on your computer with the PHP extensions Leantime needs. make run-dev runs composer install on your computer before it starts the containers, and Composer checks that PHP and those extensions are there.
-
Clone the repository and open its folder:
Terminal window git clone https://github.com/Leantime/leantime.gitcd leantime -
Install the dependencies, build the JavaScript and CSS, and start the containers:
Terminal window make run-dev -
Open http://localhost:5080 (or
https://localhost:5443) and follow the installer.
The containers mount your repository folder, so code changes show up without a rebuild. After changing JavaScript or CSS, run npx mix again.
What the development environment includes
Section titled “What the development environment includes”| Service | What it’s for | How to reach it |
|---|---|---|
leantime-dev |
Leantime, with Xdebug | http://localhost:5080 |
leantime-db |
MySQL 8.4. Database, user and password are all leantime |
From your computer: run docker compose --file .dev/docker-compose.yaml port leantime-db 3306 for the port |
maildev |
Catches emails so you can read them | Web interface: run docker compose --file .dev/docker-compose.yaml port maildev 8081 for the port |
leantime-redis |
Redis, for testing the Redis cache and sessions | Inside Docker as leantime-redis |
s3ninja |
A local S3 server, for testing S3 file storage | Inside Docker as s3ninja |
The database settings are set in .dev/docker-compose.yaml. Leantime doesn’t send email to MailDev until you point it there in config/.env:
LEAN_EMAIL_USE_SMTP = trueLEAN_EMAIL_SMTP_HOSTS = 'maildev'LEAN_EMAIL_SMTP_PORT = 465LEAN_EMAIL_SMTP_AUTH = falseLEAN_EMAIL_SMTP_AUTO_TLS = falseXdebug
Section titled “Xdebug”Xdebug is on and connects to port 9003 on your computer, with the IDE key PHPSTORM. Change the key in .dev/xdebug.ini if your IDE uses another one. Your firewall must allow incoming connections on port 9003, because connections from Docker to your computer count as external.
make unit-test # unit testsmake acceptance-test # browser testsBoth use the development containers. They restart leantime-dev in test mode: with .dev/test.env as its configuration, the leantime_test database, and also on port 8002. To go back to development, run make run-dev again.
Development on your own machine
Section titled “Development on your own machine”You need PHP 8.2 or later with the extensions in System Requirements, MySQL 8.0+ or MariaDB 10.6+, a web server, composer and npm.
-
Clone the repository and create an empty database.
-
Install the dependencies and build the JavaScript and CSS:
Terminal window make build-devThis runs
npm install,composer installandnpx mix. -
Point your web server’s document root at the
public/folder. -
Copy
config/sample.envtoconfig/.envand fill in your database settings (LEAN_DB_HOST,LEAN_DB_USER,LEAN_DB_PASSWORD,LEAN_DB_DATABASE). -
Open
http://<your local domain>/installand follow the installer.
Ready to send a change back? See Contributing. To build a plugin, see Plugin Development.
Was this page helpful?
Thanks, glad it helped.
Thanks for telling us. What was missing?
