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

Integrate SIB with Moodle Instance Through Docker #126

Open
akidSLU opened this issue Apr 29, 2024 · 2 comments
Open

Integrate SIB with Moodle Instance Through Docker #126

akidSLU opened this issue Apr 29, 2024 · 2 comments
Assignees

Comments

@akidSLU
Copy link
Collaborator

akidSLU commented Apr 29, 2024

In order to accomplish our final goal of integrating SIB with Canvas, we need to first integrate with Moodle LMS to show SLU admin what we will be doing with Canvas LMS in order for SLU admin to grant us a developer key to integrate SIB with Canvas. Chintak Joshi successfully created a Github repository that installs a local env for Moodle through Docker. In order for SIB to communicate with Moodle for integration purposes, both SIB and Moodle need to communicate with each other through a Docker network. This requires SIB to be run on a Docker container. The purpose of this issue is to create a Docker file in the SIB repository, successfully run SIB through Docker, clone Chintak's repository to run a Moodle instance, and connect the SIB instance with the Moodle instance for necessary communicate for integration with an LMS.

@akidSLU akidSLU self-assigned this Apr 29, 2024
@akidSLU
Copy link
Collaborator Author

akidSLU commented Apr 29, 2024

Mid-Sprint Update 4/29/24:

  • Started viewing LTI Spotlight: Build A Tool With Martin Lenord - LTI 1.3 Launch video series shared by Chintak Joshi
  • Reviewed Chintak Joshi’s Github for installing a local environment for Moodle through Docker https://github.com/chintakjoshi/moodle-docker-local
  • Had a meeting with Chintak to discuss next steps of creating a docket network through which to run SIB and then connect the Moodle instance with that
  • Installed Docker on my local machine, researched basics of Docker, and worked through tutorials on Docker Desktop to understand basics of Docker

@akidSLU
Copy link
Collaborator Author

akidSLU commented May 6, 2024

Progress:

  • Successfully created Dockerfile inside SeeingIsBelieving root
  • Successfully cloned and ran Chintak's repository to spin up a local instance of Moodle

Steps to Run Instance of Seeing Is Believing Through Docker

  1. Install Docker Desktop on your local machine
  2. Navigate to the SeeingIsBelieving root directory
  3. Create Dockerfile
FROM node:18-alpine

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json (or yarn.lock)
COPY package.json package-lock.json* ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Build the application
RUN npm run build

# The port Next.js will listen on
EXPOSE 3000

# Command to start the Next.js application
CMD ["npm", "start"]
  1. Build Docker Image
    docker build -t sib .
  2. Run Docker Container
    docker run --env-file .env.production -p 3000:3000 sib

Run Instance of Moodle Through Docker by following instructions in Chinktak's Github Repository

[https://github.com/chintakjoshi/moodle-docker-local]

Integrating Moodle and NextJS through Docker

  • I created a folder call nextjs for all of the current version of SIB
  • I created a second folder in which I cloned Chintak's Moodle repository
  • I created a docker-compse.yml file in the same root as nextjs and moodle-docker-local (Here's the current version to give whoever takes this issue next a starting point)
services:
  myapp:
    build: ./nextjs
    ports:
      - "3000:3000"
    env_file:
      - .env.production
    networks:
      - app-network

  moodle:
    image: lthub/moodle
    depends_on:
      - moodle-db
    environment:
      MOODLE_DB_TYPE: mariadb
      MOODLE_DB_HOST: moodle-db
      MOODLE_DB_NAME: moodle
      MOODLE_DB_USER: moodle
      MOODLE_DB_PASSWORD: password
      MOODLE_URL: http://localhost:8080
    ports:
      - "8080:80"
    networks:
      - app-network
    volumes:
      - ./.data/web:/moodledata:rw
    command: /bin/bash -c "echo 'ServerName localhost' >> /etc/apache2/apache2.conf && apache2-foreground"
    
  moodle-db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: moodle
      MYSQL_USER: moodle
      MYSQL_PASSWORD: password
    volumes:
      - moodle_db_data:/var/lib/mysql
    networks:
      - app-network

networks:
  app-network:
    driver: bridge

volumes:
  moodle_db_data:
  moodle_web_data:

The command to start the Docker instance is
docker-compose up -d

I was unable to successfully connect the Moodle Instance and NextJS instance through one Docker Compose file.

  • With the NextJS application: I keep getting errors when I try to log in that the API credentials are not accurate. I think this must be related to the way I'm pulling the environment variables from the .env files
  • With the Moodle Instance, I keep getting errors about the ServerName not being set and Shibboleth Configuration errors:
    [mod_shib:crit] [pid 72] child_init: mod_shib failed to load configuration: XML error(s) during parsing, check log for specifics

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

1 participant