Skip to content

nushret/xapi-lrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xAPI LRS Implementation Guide

Complete installation and setup guide for xAPI LRS on Ubuntu Server.

System Requirements

  • Ubuntu Server 20.04 LTS or newer
  • Root access or sudo privileges

Step-by-Step Installation

1. Update System

sudo apt update
sudo apt upgrade -y

2. Install Node.js and NPM

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs

3. Install MongoDB

sudo apt install -y mongodb
sudo systemctl start mongodb
sudo systemctl enable mongodb

4. Install PM2 Process Manager

sudo npm install -g pm2

5. Apache2 Configuration for xAPI LRS

sudo apt install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http

Create Virtual Host Configuration:

sudo nano /etc/apache2/sites-available/xapi-lrs.conf

Add this configuration:

<VirtualHost *:80>
    ServerName lrs.yourdomain.com
    ServerAdmin [email protected]

    ProxyPreserveHost On
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/

    ErrorLog ${APACHE_LOG_DIR}/xapi-lrs-error.log
    CustomLog ${APACHE_LOG_DIR}/xapi-lrs-access.log combined
</VirtualHost>

Enable Site and Restart Apache:

sudo a2ensite xapi-lrs.conf
sudo systemctl restart apache2

6. Create Project Directory

sudo mkdir -p /opt/xapi-lrs
sudo chown -R $USER:$USER /opt/xapi-lrs
cd /opt/xapi-lrs

7. Create Project Files

nano app.js

Copy the complete app.js content from the repository.

Create public/index.html:

mkdir public
nano public/index.html

Copy the complete index.html content from the repository.

8. Initialize Project and Install Dependencies

npm init -y
npm install express mongoose body-parser cors basic-auth dotenv

9. Configure Environment Variables

nano .env

Add these lines:

LRS_USERNAME=admin
LRS_PASSWORD=secure_password

9. Start Application

pm2 start app.js --name xapi-lrs
pm2 startup
pm2 save

10. Verify Installation

Check MongoDB status:

sudo systemctl status mongodb

Check application logs:

pm2 logs xapi-lrs

Test the application:

curl http://localhost:3000

🚀 Usage

Access Points


🎯 Storyline Configuration

In Articulate Storyline, configure the following:

  • LRS URL: http://your-server:3000/TCAPI/
  • Username: admin (or as set in .env)
  • Password: secure_password (or as set in .env)

🛠️ Monitoring

Use pm2 for process management:

  1. Check status:

    pm2 status
  2. View logs:

    pm2 logs xapi-lrs
  3. Monitor processes:

    pm2 monit

📊 Database Management

Manage your MongoDB database with the following commands:

  1. Access the Mongo shell:

    mongosh
    use xapi-lrs
  2. View statements:

    db.statements.find()
  3. Clear all statements:

    db.statements.deleteMany({})

🔒 Security Recommendations

  1. Change default credentials in the .env file.
  2. Configure a firewall:
    sudo ufw allow 3000
    sudo ufw enable

🔧 Troubleshooting

  1. Check MongoDB connection:

    sudo systemctl status mongodb
  2. View application logs:

    pm2 logs xapi-lrs
  3. Restart services:

    sudo systemctl restart mongodb
    pm2 restart xapi-lrs

📂 Project Structure

The directory structure of the project is as follows:

/opt/xapi-lrs/
├── app.js
├── package.json
├── .env
└── public/
    ├── index.html
    └── report.html

🧰 Maintenance

  1. System updates:

    sudo apt update
    sudo apt upgrade
    npm update
    pm2 update
  2. Backup database:

    mongodump --db xapi-lrs

📌 Notes

  • Ensure that all sensitive data in .env is secured.
  • Regularly monitor logs and process statuses for optimal operation.

💡 Contribute

Feel free to contribute by submitting issues or pull requests.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published