Skip to content

aoisupersix/moodle-plugin-devcontainer

Repository files navigation

moodle-plugin-devcontainer

This is a sample code to create a moodle plugin development environment with vscode remote containers. The plugin is a sample that adds a static HTML block. Based on moodle plugin development guide.

DevContainer packed with:

  • Docker image for moodle plugin development with php,composer,xdebug,phpcs preconfigured.
  • Maria db container with persistent volumes.
  • Preconfigured remote debugging with xdebug on vscode.
  • Preconfigured linter and formatter by phpcs configured for moodle based on moodle-local_codechecker.
  • phpMyAdmin manipulating a moodle db.

Requirement

Installation

  1. Clone repository
$ git clone https://github.com/aoisupersix/moodle-plugin-devcontainer
$ code moodle-plugin-devcontainer/
  1. Run Extensions: Configure Recommended Extensions (Workspace Folder) from the vscode command palette

  2. Run Remote-Containers: Open Workspace in Container... from the vscode command palette

  3. Open http://localhost:8080 and do the moodle installation

Debugging

Select XDebug on DevContainer from RUN AND DEBUG on vscode.

Using phpMyadmin

Open http://localhost:8081

Change moodle version

Change the MOODLE_VERSION in .devcontainer/docker-compose.yml

args:
- MOODLE_VERSION=${moodle_version}

Change plugin type and plugin name

Change directory path of the following properties↓

"workspaceFolder": "/var/www/html/${plugin_type}/${plugin_name}",
volumes:
    - './php.ini:/usr/local/etc/php/php.ini'
    - './container-volumes/moodledata_data:/var/www/moodledata'
    - '..:/var/www/html/${plugin_type}/${plugin_name}:cached'
"pathMappings": {
    "/var/www/html/${plugin_type}/${plugin_name}": "${workspaceFolder}"
}

Change moodle settings

Change .devcontainer/moodle/config.php

Change server timezone and locale

Change .devcontainer/moodle/Dockerfile

# Set timezone
ENV TZ Asia/Tokyo
RUN echo "${TZ}" > /etc/timezone \
    && dpkg-reconfigure -f noninteractive tzdata

# Set locale
RUN echo 'ja_JP.UTF-8 UTF-8' >> /etc/locale.gen \
    && locale-gen \
    && update-locale LANG=ja_JP.UTF-8

Clear container volumes

rm -rf .devcontainer/container-volumes

About

Moodle plugin dev container for vscode

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published