Skip to content

Commit

Permalink
[docs] improved development README and use kialo docker network
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-kialo committed Jan 30, 2024
1 parent b83a128 commit 7411a76
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
19 changes: 15 additions & 4 deletions development/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# In this docker compose setup, the Moodle plugin uses http://localhost:5000 as the Kialo instance to test with by default.
# If you are running Kialo in docker, you may want to set this to your network IP so that Moodle and Kialo can reach each other.
# TARGET_KIALO_URL=http://192.168.X.X:5000
# In order for LTI to work, both Kialo and the Moodle server need to be able to reach each other.
# Therefore their hostnames need to be resolvable from each other.

# This is the URL that the Kialo Moodle plugin will use to refer to Kialo.
# Set this to your BACKEND_SERVER_URL (without trailing slash).
# This needs to be resolvable from within the Moodle Docker container.
TARGET_KIALO_URL=https://localhost.kialolabs.com:5000

# This is the hostname of Moodle itself.
# This needs to be resolvable from the Kialo app (e.g. from within Docker or on your localhost when using honcho).
# If you are running Kialo in docker, you may want to change this to your network IP address so that
# Moodle and the Kialo backend can reach each other.
# IMPORTANT: This must not include a protocol (http:// or https://) or a trailing slash, since this is a hostname.
# MOODLE_HOST=192.168.X.X:8080
MOODLE_HOST=192.168.X.X:8080

# Alternatively, you could also add "127.0.0.1 moodle" to your system's `/etc/hosts` file,
# and use that, since `moodle` is the hostname of the Moodle Docker container,
which is accessible from within the Kialo Docker container.
# MOODLE_HOST=moodle:8080
15 changes: 12 additions & 3 deletions development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,29 @@ into the mounted moodle plugin folder on every change.

## How to run Moodle

Before you run Moodle copy `.env.example` to `.env` and adjust the values to your needs.
See `.env.example` for instructions.

The following command starts Moodle locally on port 8080 with MariaDB running on port 3366.
This is using non-default ports to avoid conflicts with already running services.
It also starts the hosted version of the Moodle app on port 8100.


```shell
cd development
cp .env.example .env # before starting compose, check instructions in this file
docker compose up
```

By default there is only one user with the username "user" and password "kialo1234". This is the admin user.
After you started Moodle for the first time, do the following to set some useful default settings:

Afterward, see `/development/config/README.md` for steps to apply default settings that are useful for development.
* Copy `development/config.php` into `development/moodle` to apply some default settings useful for development.
* Import `development/config/kialo-admin-preset.xml` via http://localhost:8080/admin/tool/admin_presets/index.php?action=import.

The admin presets are important, as they adjust Moodle's curl blocklist and allowed ports. Without that,
testing Kialo locally won't work, as communication will be blocked by Moodle.
This also enables web services for mobile (required for the mobile app) and enables debug messages for developers.

By default there is only one user with the username "user" and password "kialo1234". This is the admin user.

The folder `moodle` is mounted locally in the `development` folder. To test changes to the plugin code,
you can use `development/sync.sh` to copy over the code into the `moodle/mod/kialo` folder.
Expand Down
8 changes: 0 additions & 8 deletions development/config/README.md

This file was deleted.

4 changes: 4 additions & 0 deletions development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ services:
image: moodlehq/moodleapp:latest-dev
ports:
- '8100:80'
networks:
# join the existing network when running Kialo locally
default:
name: kialo

0 comments on commit 7411a76

Please sign in to comment.