author-ide v3.1.2
author-ide
Author IDE and Instruction Renderer
To start development
Create a
.npmrcfile from.npmrc.template. Replace <<YOUR_GH_PERSONAL_ACCESS_TOKEN>> with your github personal access token, configured with read package permissions. Make sure to allow SSO with ibm-skills-network. (This is required because author-ide uses the@ibm-skills-network/editor.mdpackage which is not public, so you need authorization in order fornpm installto install it)Create a
.envfile from.env.template.
- Gitlab-related ENV variables (Note, we are going to connect to SN self-hosted giltab runnin on apps-staging cluster):
GITLAB_TOKENcan be found here undercredentialfield.(Note this is an api token for SN self-hosted gitlab from staging)- Leave
GITLAB_URLset to"https://author-gitlab.staging.skills.network/api/v4/"in order to point to the SN self-hosted gitlab from staging.
- Set
PORTto 3002 in order to be inline with the default development settings of author-ide for other services likeatlasandauthor-workbench. - Leave
SECRETblank. LABS_BASE_URLcan be left blank. It should be set only if you need to test iframe communcations between author-ide and the labs ui locally (author-ide is iframed inside labs ui in a typical lab environment). You would have to run labs ui locally and setLABS_BASE_URLto the url of the locally running labs ui (usuallyhttp://monocle.localhost:5000)LABS_ACCESS_TOKENcan be found here. It needs to be set if you want to test theTestbutton inside author-ide(to make theTestbutton work, you also requires theLTIparams to be set (see below))LTIparams can be found here. Note, you're required to set theLTIparams only if you want to test theTestbutton inside author-ide. Note, theLTIcredentials provided are for the staging environment, so when a lab is loaded, the author-ide on the left will be from the staging environment and not your local environment.AWB_URLshould be set to the url of the locally running AWB (usuallyhttp://localhost:3000)AWB_CLIENT_IDandAWB_CLIENT_SECRETshould be generated in locally running AWB at http://localhost:3000/oauth/applications (requires admin role) and create a new application (just give it a name (something likeAuthor IDE) and leave the other fields blank).AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,COS_REGION,IBM_COS_ENDPOINT,S3_BUCKET, andS3_BUCKET_PRIVATEcan be found here
- Add this code block to the
config/settings/development.local.ymlfile inauthor-workbench:
author_ide:
url: "http://localhost:3002"
access_token: "<access token>"where <access token> is generated and displayed as "Admin Token:" in the logs in step 4. after running npm start
author-iderequiresauthor-workbenchto be running in order to hit theeditendpoints with valid tokens.
- Follow the commands below in your shell.
# Use the node version (v16.12.0) designated for this workspace
nvm install
# or
nvm use
# Install deps
npm install
# Start dev server (should hotload code changes)
npm startYou'll mostly be working with the edit/ and render/ endpoints. Read this to get started.
Building an Image
op run -- docker-compose buildEndpoints
- POST
/token- Generate a token - GET
/edit?token=<token>- HTML edit page - GET
/render?token=<token>- HTML render page
Read this for more details on the endpoints.
Deployment
See https://wiki.skills.network/en/Team/Development/how-we-develop-services
There is a chance that any public file might be cached by akamai and this may cause errors. It's usually a good idea to purge the akamai cache after deploying a new Author IDE image so this issue doesn't occur.
Follow this guide for clearing the akamai cache and make sure to select the CP Code for skills-network-apps-production
Tokens
Ideally, you shouldn't be creating tokens manually. Author workbench and Labs UI are responsible for generating token for authors and learners.
{
"atlas_token": <atlas token for a lab and its project>,
"tool_type": <tool type>,
"author": {
"email": <user email>,
"display_name": <user name>,
"user_id": <user id>
},
"gitlab": {
"id": <Gitlab project ID>,
"filename": "<filename>"
},
"asset_library_prefix_url": "<asset library prefix url>"
}e.g.
{
"atlas_token": "eyJhbGciOiJIUzI1NiJ9.eyJwcm9qZWN0X2lkIjoiMTAyNTciLCJsYWJfaWQiOjk3Nzl9.TXZrPT3qCS5TWg2b9dySJYd0v26awxCS70lZTlj5y3E",
"tool_type": "instructional-lab",
"author": {
"email": "fedorivy@mcmaster.ca",
"display_name": "Eugene Fedoriv",
"user_id": 2
},
"gitlab": {
"id": "39771753",
"filename": "labs/eugene-asdlkasjd.md"
},
"asset_library_prefix_url": "https://cf-course-data-dev.s3.us.cloud-object-storage.appdomain.cloud/IBM-GPXX0AISEN",
"admin": false,
"iat": 1664382344,
"exp": 1664468744
}1 year ago