Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document a little bit how to use the Docker image from Moodle #13

Open
stronk7 opened this issue Nov 24, 2021 · 2 comments
Open

Document a little bit how to use the Docker image from Moodle #13

stronk7 opened this issue Nov 24, 2021 · 2 comments

Comments

@stronk7
Copy link
Member

stronk7 commented Nov 24, 2021

When looking to some problems @ MDL-70658 related to this image... it was not straightforward to know what is needed to get it working in a local environment.

So I had to look to both this and moodle-ci-runner (that already supports it) to see how to configure my local testing environment.

It would be great to get that minimally documented, maybe in the README.

For the records, this is what I did here to get the image working with both phpunit and behat. Tricky that we use that dynamic hash (not sure why), but it works. Added to config.php:

// Also keep the BBB docker mock server at hand if we are running tests.
// docker run -d -p 8080:80 moodlehq/bigbluebutton_mock:latest
$mockhash = sha1($CFG->wwwroot);
if (defined('BEHAT_TESTS') || defined('BEHAT_SITE_RUNNING')) {
    $mockhash = sha1($CFG->behat_wwwroot);
}
define("TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER", 'http://127.0.0.1:8080/hash' . $mockhash);
@stronk7
Copy link
Member Author

stronk7 commented Nov 25, 2021

It seems that it's really hard to get the image working for local environments where the web server is not dockerized but running in the host and without any dns, but generic 127.0.0.1 or localhost. All sort of things have been tried (network=host, only for linux, host.docker.internal for mac/win, hacking the tests to connect there, also --add-host=hostdns:hostip...).

So surely, the best (easiest, quickest and working) solution for local testing is to just run the symfony app locally and done. Updated mine, this is how my config.php looks now:

// Also keep the BBB docker mock server at hand if we are running tests.
// docker run -d -p 8001:80 moodlehq/bigbluebutton_mock:latest
// !!! Cannot use the container locally because it's not able to callback to the host, so using server instead:
//   cd /Users/stronk7/git_moodle/bigbluebutton_mock/application
//   symfony server:start --port=8001 --no-tls --allow-http
//   If it's not started, follow the instructions @ https://github.com/moodlehq/bigbluebutton_mock
$mockhash = sha1($CFG->wwwroot);
if (defined('BEHAT_TESTS') || defined('BEHAT_SITE_RUNNING')) {
    $mockhash = sha1($CFG->behat_wwwroot);
}
define("TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER", 'http://127.0.0.1:8001/hash' . $mockhash);

@paulholden
Copy link
Member

Just saw this issue, semi-related but I always wanted to document how to use the mock server in conjunction with moodle-docker so created #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants