-
Notifications
You must be signed in to change notification settings - Fork 3
LRS SQL Setup
LRS SQL is an open-source xAPI Learning Record Store from Yet Analytics that provides a simple, lightweight solution for storing and managing learning records. This guide will walk you through the complete setup process, from downloading LRS SQL to testing your integration with LearnMCP-xAPI.
LRSQL is a SQL-based Learning Record Store that supports multiple SQL database management systems (DBMSs) like SQLite and Postgres. It's perfect for development and testing because:
- Zero Configuration Database: Uses SQLite by default - no database setup required
- Web-Based Interface: Built-in admin dashboard for managing statements and credentials
- xAPI 1.0.3 Compliant: Conformant with the ADL LRS Test Suite
- Cross-Platform: Runs on Windows, Linux, and macOS
- Open Source: Released under the Apache 2.0 license
-
Visit the GitHub Releases page: Go to https://github.com/yetanalytics/lrsql/releases
-
Download the latest release: Download lrsql.zip from the latest release
-
Extract the package: Unzip the package to a directory of your choice (e.g.,
C:\lrsql
on Windows or~/lrsql
on macOS/Linux)
Before starting LRS SQL, you need to set up admin credentials:
-
Navigate to the config directory in the extracted LRS SQL folder
-
Rename lrsql.json.example to lrsql.json
-
Edit the config/lrsql.json file using any text editor and remove the object
database
-
Set your admin credentials by updating these fields:
"adminUserDefault": "your-admin-username", "adminPassDefault": "your-admin-password"
-
Open a terminal/command prompt in the extracted LRS SQL directory
-
Run LRS SQL with SQLite (simplest option):
# On Windows .\bin\run_sqlite.bat # On macOS/Linux ./bin/run_sqlite.sh
-
Wait for startup: You should see output indicating that LRS SQL is starting up. Look for a message like:
Starting new webserver at host 0.0.0.0, HTTP port 8080, and SSL port 8443
-
Verify it's running: Open your web browser and navigate to
http://localhost:8080
. You should see the LRS SQL admin interface.
Once LRS SQL is running, you need to create API credentials for LearnMCP-xAPI to authenticate with the LRS.
-
Open your browser and go to
http://localhost:8080
- Login with credentials adminUserDefault and adminPassDefault
- Navigate to Credentials: Look for a "Credentials management" section in the admin interface
- Click "Add New Credentials"
-
Configure the credential (Optional):
- Label: Give it a descriptive name like "LearnMCP-xAPI"
- Permissions: Ensure it has read and write permissions for statements
After creating the credential, you'll see:
-
API Key: A string like
abc123def456
(this is your LRSQL_KEY) -
API Key Secret: A longer string like
xyz789uvw012
(this is your LRSQL_SECRET)
Now that LRS SQL is running and you have API credentials, configure LearnMCP-xAPI to connect using the LRS SQL plugin.
Create or edit your .env
file in the LearnMCP-xAPI directory:
# Plugin Selection
LRS_PLUGIN=lrsql
# LRS SQL Configuration
LRSQL_ENDPOINT=http://localhost:8080
LRSQL_KEY=your-api-key-here
LRSQL_SECRET=your-api-secret-here
# Actor Configuration (unique per student)
ACTOR_UUID=student-alice-12345
# Optional Configuration
ENV=development
LOG_LEVEL=INFO
Replace the placeholders:
-
your-api-key-here
: Use the API Key from Step 3 -
your-api-secret-here
: Use the API Secret from Step 3 -
student-alice-12345
: Use a unique identifier for each student
Start LearnMCP-xAPI to verify the connection:
python -m learnmcp_xapi.main
If configured correctly, you should see log messages indicating successful connection to the LRS SQL instance.
Connection Refused Error
- Verify LRS SQL is running on port 8080
- Check that no firewall is blocking the connection
- Ensure you're using
http://localhost:8080
(not https)
Authentication Failed Error
- Double-check your API key and secret
- Verify the credentials have proper read/write permissions
- Ensure you're using the API credentials, not the admin login credentials
Database Errors
- Make sure the SQLite database file is writable
- Check available disk space
- Restart LRS SQL if database corruption is suspected
Once statements are being recorded, you can view them in the LRS SQL admin interface:
- Go to
http://localhost:8080
- Login with your admin credentials
- Navigate to the "Statements" or "xAPI Statements" section
- You'll see all recorded learning activities from LearnMCP-xAPI
LRS SQL provides a robust foundation for xAPI-based learning analytics. With this setup complete, you're ready to start capturing and analyzing learning activities through the LearnMCP-xAPI integration!