SmartBeans is a gamified learning platform for programming languages. More screenshots !
- Install
npm
nodejs
. - Install
postgres
- Clone the repository.
- Create a database and database user:
- mysql
CREATE DATABASE smartbeans; CREATE USER 'user'@'localhost' IDENTIFIED BY 'change-this-password'; GRANT ALL PRIVILEGES ON smartbeans . * TO 'user'@'localhost';
- Configure
knexfile.js
- change db url
- change probably the port number
- add database name
- add database user
- add database user password
- Configure the following on
src/config.ts
:
export default {
sessionDuration: 43200,
staticAchievementPath: '/achievements',
staticAssetPath: '/assets',
padUrl: 'url-to-hedgedoc',
sandboxUrl: 'url-to-sandbox',
achievementUrl: 'url-to-achievement-checker',
registrationKeys: ['change-me'],
apiKeys: ['change-me'],
TOKEN_LENGTH: 36,
ltiConsumerSecret: 'secret',
leaderboardUsersLastSubmissionTimeout: 1000 * 60 * 60 * 24 * 30
};
- Initialize the node_modules via running:
npm install
- Install knex-cli
npm install knex -g
- Run migrations
knex --esm migrate:latest
- Add assets
- Clone the smartbeans-content repository.
- Run:
cd smartbeans-content
python src/generate-output.py
- `cp out/assets smartbeans/static/assets
- Build smartbeans
npm run build
- Create a systemd service
smartbeans.service
:
[Unit]
Description=The SmartBeans Backend
After=network.target
[Service]
Type=simple
User=change-me
Group=change-me
WorkingDirectory=path-to-smartbeans-build-folder
ExecStart=PORT=8080 node index.js
Restart=on-failure
# Other restart options: always, on-abort, etc
[Install]
WantedBy=multi-user.target
- Start the service:
systemctl start smartbeans.service
- Insert asset ids into smartbeans Go in the smartbeans-content repository and run the following:
python pipeline.py --url https://smartbeans-domain.tld/api/admin/asset --admin-api-key apikey --data out/assets-backend.json
For updates call git pull
, build smartbeans and restart the service.
Copyright (c) 2021 Ole Umlauft and other contributors
All contents of this repository are provided under the MIT License. See LICENSE for the full text.