|
| 1 | +# Running Testlink using Docker |
| 2 | + |
| 3 | +## Create a dotenv file for Docker |
| 4 | + |
| 5 | +You're going to need a file named `.env` in the project root directory. You can use `.env.example` or create your own. |
| 6 | + |
| 7 | +```bash |
| 8 | +cp -n .env.example .env |
| 9 | +``` |
| 10 | + |
| 11 | +## Build the image |
| 12 | + |
| 13 | +To build a docker image of testlink, you can use the following command: |
| 14 | + |
| 15 | +```bash |
| 16 | +docker build --tag testlink:1.9.20 --tag testlink:latest . |
| 17 | +``` |
| 18 | + |
| 19 | +Alternatively, build without cached layers: |
| 20 | + |
| 21 | +```bash |
| 22 | +docker build --no-cache --tag testlink-code:1.9.20 --tag testlink:latest . |
| 23 | +``` |
| 24 | + |
| 25 | +## Starting up Testlink using `docker compose` |
| 26 | + |
| 27 | +```bash |
| 28 | +docker compose up -d |
| 29 | +``` |
| 30 | + |
| 31 | +You should now be able to open https://localhost:8080 in your browser to proceed with the Testlink setup |
| 32 | + |
| 33 | +### Database configuration |
| 34 | + |
| 35 | +Based on the default `docker-compose.yml` and `.env` configuration, you'll use the following settings for the database setup: |
| 36 | + |
| 37 | +| Key | Value | |
| 38 | +| - | - | |
| 39 | +| Database type | MySQL/MariaDB (5.6+ / 10.+) | |
| 40 | +| Database host | testlink-mysql | |
| 41 | +| Database admin login | root | |
| 42 | +| Database admin password | masterkey | |
| 43 | + |
| 44 | +You can provide your own values for `Database name`, `TestLink DB login` and `TestLink DB password`. |
| 45 | + |
| 46 | +### Email configuration |
| 47 | + |
| 48 | +Copy the mail configuration to your installation with: |
| 49 | + |
| 50 | +```bash |
| 51 | +cp -n docker/custom_config.inc.php ./ |
| 52 | +``` |
| 53 | + |
| 54 | +You can view the test emails at http://localhost:1080 |
| 55 | + |
| 56 | +### Restoring the sample database |
| 57 | + |
| 58 | +There is a sample database in `docs/db_sample` which you can restore with: |
| 59 | + |
| 60 | +```bash |
| 61 | +docker compose up testlink-restore |
| 62 | +``` |
| 63 | + |
| 64 | +## Troubleshooting |
| 65 | + |
| 66 | +### Creating the Testlink database user manually |
| 67 | + |
| 68 | +You'll need to create the testlink user yourself should you be presented with the following error during setup: |
| 69 | + |
| 70 | +> 1045 - Access denied for user 'testlink'@'172.29.0.3' (using password: YES) |
| 71 | +> TestLink ::: Fatal Error |
| 72 | +> Connect to database testlink on Host testlink-mysql fails |
| 73 | +> DBMS Error Message: 1045 - Access denied for user 'testlink'@'172.29.0.3' (using password: YES) |
| 74 | +
|
| 75 | +Connect to the app or database container and, using the `mysql` CLI, execute the following commands: |
| 76 | + |
| 77 | +```sql |
| 78 | +/* update the database name, user name and password |
| 79 | + values based on what you specified during setup */ |
| 80 | +USE `testlink`; |
| 81 | +CREATE USER 'testlink'@'%' IDENTIFIED BY 'masterkey'; |
| 82 | +GRANT SELECT, UPDATE, DELETE, INSERT ON *.* TO 'testlink'@'%' WITH GRANT OPTION; |
| 83 | +``` |
| 84 | + |
| 85 | +### Resetting your database |
| 86 | + |
| 87 | +If you wish to reset your database, you'll need to delete the mysql volume and `config_db.inc.php`. |
| 88 | + |
| 89 | +```bash |
| 90 | +docker compose down |
| 91 | +docker volume rm testlink-code_mysql |
| 92 | +/bin/rm -f config_db.inc.php |
| 93 | +docker compose up -d |
| 94 | +``` |
0 commit comments