Skip to content

Commit 91b216a

Browse files
committed
Add test docker files
1 parent 6f28431 commit 91b216a

9 files changed

Lines changed: 334 additions & 0 deletions

File tree

docker-compose.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
services:
2+
web:
3+
build: docker/web
4+
ports:
5+
- "80:80"
6+
volumes:
7+
- ./www:/var/www/html
8+
- ./docker/config/roslogin-connect.php:/var/www/html/www.reactos.org_config/roslogin-connect.php
9+
- ./docker/config/testman-connect.php:/var/www/html/www.reactos.org_config/testman-connect.php
10+
- ./docker/config/gitinfo-connect.php:/var/www/html/www.reactos.org_config/gitinfo-connect.php
11+
depends_on:
12+
db:
13+
condition: service_healthy
14+
ldap:
15+
condition: service_started
16+
17+
db:
18+
image: mysql:8.0
19+
environment:
20+
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
21+
volumes:
22+
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
23+
- db_data:/var/lib/mysql
24+
healthcheck:
25+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
26+
interval: 5s
27+
timeout: 5s
28+
retries: 10
29+
30+
ldap:
31+
build:
32+
context: docker/ldap
33+
dockerfile: Dockerfile
34+
volumes:
35+
- ./resources/ldaptest/testserver.py:/app/testserver.py
36+
ports:
37+
- "389:389"
38+
39+
volumes:
40+
db_data:

docker/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Docker Development Environment
2+
3+
Runs the ReactOS web services locally using three containers:
4+
5+
| Container | Description |
6+
|-----------|-------------|
7+
| `web` | Apache + PHP 8.2 serving all four services |
8+
| `db` | MySQL 8.0 with roslogin, testman, and gitinfo databases |
9+
| `ldap` | In-memory LDAP stub (replaces real LDAP for local testing) |
10+
11+
## Starting
12+
13+
```bash
14+
docker compose up --build
15+
```
16+
17+
The `--build` flag is only needed the first time or after changing files in `docker/web/` or `docker/ldap/`. On subsequent runs, `docker compose up` is sufficient.
18+
19+
## Services
20+
21+
Once running, the following URLs are available:
22+
23+
| URL | Service |
24+
|-----|---------|
25+
| http://localhost/roslogin/ | Authentication / user management |
26+
| http://localhost/testman/ | Build and test results |
27+
| http://localhost/getbuilds/ | Pre-built revision downloads |
28+
| http://localhost/rosweb/ | Shared interface component |
29+
30+
## Test Credentials
31+
32+
The LDAP stub is pre-populated with these test accounts:
33+
34+
| Username | Password | Groups |
35+
|----------|----------|--------|
36+
| test | test12 ||
37+
| test2 | test12 ||
38+
| test3 | test12 ||
39+
| testmod | test12 | Moderators |
40+
| testadmin | test12 | Moderators, Administrators |
41+
42+
## Database Access
43+
44+
Connect directly to the database for debugging:
45+
46+
```bash
47+
docker compose exec db mysql -u roslogin roslogin
48+
docker compose exec db mysql -u testman testman
49+
```
50+
51+
## Configuration
52+
53+
The files in `docker/config/` are Docker-specific overrides for the connection settings in `www/www.reactos.org_config/`. They redirect database connections to the `db` container and LDAP to the `ldap` container. The original config files are not modified.
54+
55+
## Stopping
56+
57+
```bash
58+
docker compose down # stop containers, keep database volume
59+
docker compose down -v # stop containers and delete database volume
60+
```

docker/config/gitinfo-connect.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
// DB Settings
3+
define("GITINFO_DB_HOST", "db");
4+
define("GITINFO_DB_USER", "gitinfo_reader");
5+
define("GITINFO_DB_PASS", "");
6+
define("GITINFO_DB_NAME", "gitinfo");

docker/config/roslogin-connect.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
// DB Settings
3+
define("ROSLOGIN_DB_HOST", "db");
4+
define("ROSLOGIN_DB_USER", "roslogin");
5+
define("ROSLOGIN_DB_PASS", "");
6+
define("ROSLOGIN_DB_NAME", "roslogin");
7+
8+
// LDAP Settings
9+
define("ROSLOGIN_LDAP_HOST", "ldap");
10+
define("ROSLOGIN_LDAP_BIND_DN", "uid=roslogin,ou=Service Accounts,o=ReactOS Website");
11+
define("ROSLOGIN_LDAP_BIND_PW", "test");
12+
define("ROSLOGIN_LDAP_BASE_DN", "ou=People,o=ReactOS Website");
13+
14+
// Single Sign-On Settings
15+
define("ROSLOGIN_COOKIE_DOMAIN", "localhost");
16+
define("ROSLOGIN_COOKIE_VALIDITY", 60 * 60 * 24 * 365); // 1 Year
17+
define("ROSLOGIN_SESSION_VALIDITY", "1 YEAR");
18+
19+
// Self-Service Settings
20+
define("ROSLOGIN_MAIL_FROM", "ReactOS Website <noreply@reactos.org>");
21+
define("ROSLOGIN_MAIL_LINK", "http://localhost/roslogin/?p=confirm&");
22+
define("ROSLOGIN_MAIL_VALIDITY", "1 DAY");
23+
24+
// Captcha Settings
25+
define("ROSLOGIN_RECAPTCHA_SITEKEY", "YOUR_GOOGLE_RECAPTCHA_SITEKEY_HERE");
26+
define("ROSLOGIN_RECAPTCHA_SECRET", "YOUR_GOOGLE_RECAPTCHA_SECRET_HERE");
27+
28+
// Miscellaneous Website Settings
29+
define("ROSLOGIN_TITLE_SUFFIX", " | ReactOS Project");
30+
31+
// Admin panel settings
32+
define("ROSLOGIN_ADMIN_GROUP", "LDAP Administrators");
33+
define("ROSLOGIN_MODERATOR_GROUP", "Moderators");
34+
define("ROSLOGIN_MATTERMOST_URL", "https://chat.reactos.org");
35+
define("ROSLOGIN_MATTERMOST_TOKEN", "YOUR_MATTERMOST_TOKEN_HERE");

docker/config/testman-connect.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
// DB Settings
3+
define("TESTMAN_DB_HOST", "db");
4+
define("TESTMAN_DB_USER", "testman");
5+
define("TESTMAN_DB_PASS", "");
6+
define("TESTMAN_DB_NAME", "testman");

docker/ldap/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3.11-slim
2+
3+
RUN pip install --no-cache-dir ldaptor twisted
4+
5+
WORKDIR /app
6+
COPY testserver.py .
7+
8+
EXPOSE 389
9+
10+
CMD ["python", "testserver.py", "389"]

docker/mysql/init.sql

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
-- ReactOS Web Services - Docker database initialization
2+
3+
-- -------------------------------------------------------
4+
-- Databases
5+
-- -------------------------------------------------------
6+
CREATE DATABASE IF NOT EXISTS `roslogin` CHARACTER SET utf8 COLLATE utf8_general_ci;
7+
CREATE DATABASE IF NOT EXISTS `testman` CHARACTER SET latin1 COLLATE latin1_general_ci;
8+
CREATE DATABASE IF NOT EXISTS `gitinfo` CHARACTER SET utf8 COLLATE utf8_general_ci;
9+
10+
-- -------------------------------------------------------
11+
-- Users
12+
-- -------------------------------------------------------
13+
CREATE USER IF NOT EXISTS 'roslogin'@'%' IDENTIFIED WITH mysql_native_password BY '';
14+
CREATE USER IF NOT EXISTS 'testman'@'%' IDENTIFIED WITH mysql_native_password BY '';
15+
CREATE USER IF NOT EXISTS 'gitinfo_reader'@'%' IDENTIFIED WITH mysql_native_password BY '';
16+
17+
GRANT SELECT, INSERT, UPDATE, DELETE ON `roslogin`.* TO 'roslogin'@'%';
18+
GRANT SELECT, INSERT, UPDATE, DELETE ON `testman`.* TO 'testman'@'%';
19+
GRANT SELECT ON `gitinfo`.* TO 'gitinfo_reader'@'%';
20+
21+
FLUSH PRIVILEGES;
22+
23+
-- -------------------------------------------------------
24+
-- roslogin schema
25+
-- -------------------------------------------------------
26+
USE `roslogin`;
27+
28+
CREATE TABLE `forbidden_maildomains` (
29+
`domain` varchar(254) COLLATE utf8_bin NOT NULL,
30+
PRIMARY KEY (`domain`)
31+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
32+
33+
CREATE TABLE `forbidden_usernames` (
34+
`username` varchar(60) COLLATE utf8_bin NOT NULL,
35+
PRIMARY KEY (`username`)
36+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
37+
38+
CREATE TABLE `pending` (
39+
`username` varchar(60) NOT NULL,
40+
`email` varchar(254) NOT NULL,
41+
`verification_key` char(32) NOT NULL,
42+
`timeout` datetime NOT NULL,
43+
`type` enum('mailchange','registration','resetpassword') NOT NULL,
44+
KEY `username` (`username`)
45+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
46+
47+
CREATE TABLE `sessions` (
48+
`id` char(32) CHARACTER SET utf8 NOT NULL,
49+
`username` varchar(60) CHARACTER SET utf8 NOT NULL,
50+
`timeout` datetime NOT NULL,
51+
PRIMARY KEY (`id`)
52+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
53+
54+
-- -------------------------------------------------------
55+
-- testman schema
56+
-- -------------------------------------------------------
57+
USE `testman`;
58+
59+
CREATE TABLE `sources` (
60+
`id` int(10) unsigned NOT NULL auto_increment,
61+
`name` varchar(100) collate latin1_general_ci NOT NULL,
62+
`password` char(32) collate latin1_general_ci NOT NULL,
63+
PRIMARY KEY (`id`)
64+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
65+
66+
CREATE TABLE `winetest_logs` (
67+
`id` int(10) unsigned NOT NULL auto_increment,
68+
`log` mediumblob NOT NULL,
69+
PRIMARY KEY (`id`)
70+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
71+
72+
CREATE TABLE `winetest_results` (
73+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
74+
`test_id` int(10) unsigned NOT NULL,
75+
`suite_id` int(10) unsigned NOT NULL,
76+
`status` enum('ok','crash','canceled') COLLATE latin1_general_ci NOT NULL,
77+
`count` int(10) NOT NULL DEFAULT '0',
78+
`failures` int(10) unsigned NOT NULL DEFAULT '0',
79+
`skipped` int(10) unsigned NOT NULL DEFAULT '0',
80+
`todo` int(10) unsigned NOT NULL DEFAULT '0',
81+
`time` float unsigned NOT NULL DEFAULT '0',
82+
PRIMARY KEY (`id`),
83+
UNIQUE KEY `test_and_suite` (`test_id`,`suite_id`),
84+
KEY `suite_id` (`suite_id`)
85+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
86+
87+
CREATE TABLE `winetest_runs` (
88+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
89+
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
90+
`finished` tinyint(1) NOT NULL DEFAULT '0',
91+
`source_id` int(10) unsigned NOT NULL,
92+
`revision` varchar(40) NOT NULL,
93+
`platform` varchar(24) COLLATE latin1_general_ci NOT NULL,
94+
`comment` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
95+
`count` int(10) unsigned NOT NULL DEFAULT '0',
96+
`failures` int(10) unsigned NOT NULL DEFAULT '0',
97+
`boot_cycles` bigint(20) unsigned NOT NULL DEFAULT '0',
98+
`context_switches` int(10) unsigned NOT NULL DEFAULT '0',
99+
`interrupts` int(10) unsigned NOT NULL DEFAULT '0',
100+
`reboots` int(10) unsigned NOT NULL DEFAULT '0',
101+
`system_calls` int(10) unsigned NOT NULL DEFAULT '0',
102+
`time` float unsigned NOT NULL DEFAULT '0',
103+
PRIMARY KEY (`id`),
104+
KEY `revision` (`revision`),
105+
KEY `platform` (`platform`)
106+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
107+
108+
CREATE TABLE `winetest_suites` (
109+
`id` int(10) unsigned NOT NULL auto_increment,
110+
`module` varchar(50) collate latin1_general_ci NOT NULL,
111+
`test` varchar(50) collate latin1_general_ci NOT NULL,
112+
PRIMARY KEY (`id`)
113+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
114+
115+
-- -------------------------------------------------------
116+
-- gitinfo schema
117+
-- -------------------------------------------------------
118+
USE `gitinfo`;
119+
120+
CREATE TABLE `master_revisions` (
121+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
122+
`rev_hash` char(40) NOT NULL,
123+
`author_name` varchar(100) NOT NULL,
124+
`author_email` varchar(100) NOT NULL,
125+
`commit_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
126+
`message` blob NOT NULL,
127+
PRIMARY KEY (`id`),
128+
UNIQUE KEY `rev_hash` (`rev_hash`)
129+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
130+
131+
CREATE TABLE `master_revisions_todo` (
132+
`oldrev` char(40) NOT NULL,
133+
`newrev` char(40) NOT NULL,
134+
UNIQUE KEY `oldrev` (`oldrev`),
135+
UNIQUE KEY `newrev` (`newrev`)
136+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

docker/web/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM php:8.2-apache
2+
3+
RUN apt-get update && apt-get install -y \
4+
libldap2-dev \
5+
libonig-dev \
6+
&& docker-php-ext-configure ldap \
7+
&& docker-php-ext-install mysqli ldap mbstring \
8+
&& a2enmod rewrite \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
COPY apache.conf /etc/apache2/sites-available/000-default.conf

docker/web/apache.conf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<VirtualHost *:80>
2+
DocumentRoot /var/www/html/www.reactos.org
3+
DirectoryIndex index.php
4+
5+
<Directory /var/www/html/www.reactos.org>
6+
Options -Indexes
7+
AllowOverride None
8+
Require all granted
9+
</Directory>
10+
11+
# PHP services: getbuilds, roslogin, rosweb, testman
12+
<LocationMatch "^/(getbuilds|roslogin|rosweb|testman)(/.*)?$">
13+
<FilesMatch "\.php$">
14+
SetHandler application/x-httpd-php
15+
</FilesMatch>
16+
</LocationMatch>
17+
18+
# Fallback for non-service paths: serve static content
19+
AliasMatch "^/(?!getbuilds|roslogin|rosweb|testman)(.*)" /var/www/html/www.reactos.org_content/$1
20+
21+
<Directory /var/www/html/www.reactos.org_content>
22+
Options -Indexes
23+
AllowOverride None
24+
Require all granted
25+
php_admin_flag engine off
26+
</Directory>
27+
28+
ErrorLog ${APACHE_LOG_DIR}/error.log
29+
CustomLog ${APACHE_LOG_DIR}/access.log combined
30+
</VirtualHost>

0 commit comments

Comments
 (0)