-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
239 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.wip |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
## Running Edrys | ||
|
||
To run the Edrys server, clone the code repo and launch the app bundle in | ||
`/dist` using Deno: | ||
|
||
``` | ||
deno run -A dist/app.js --address localhost:8000 --secret makeUpSomeSecretTextHere | ||
``` | ||
|
||
You can also run `server/app.ts` instead if you plan on modifying the source | ||
code. | ||
|
||
## Configuration | ||
|
||
The server accepts various configuration variables. All variables can be passed | ||
in either via environment variables (`EDRYS_{NAME}`) or through command line | ||
arguments (`--{name}`). | ||
|
||
### Basics | ||
|
||
- `address`: defines hostname and port the server will listen on, eg. | ||
`localhost:8000` | ||
- `secret`: some string that will be used for as a private key behind the | ||
scenes. Make up a long strong password | ||
- `config_class_creators_csv`: a list of emails that can create new classes | ||
(defaults to `*` for anyone) | ||
|
||
### Email Sending | ||
|
||
Email sending is used to send email verification messages. If not set up, | ||
messages are simply logged to console instead. You can use any SMTP provider. | ||
These for example include Gmail, SendGrid, Mailgun, or AWS SES. | ||
|
||
- `smtp_tls`: true or false | ||
- `smtp_host`: eg. smtp.example.com | ||
- `smtp_port`: eg. 465 | ||
- `smtp_from`: email where messages will be sent from | ||
- `smtp_username` | ||
- `smtp_password` | ||
|
||
### Data Storage | ||
|
||
Edrys does not use a database, instead it stores data either directly to file or | ||
uses an S3-compatible API. | ||
|
||
- `data_engine`: either `file` (default) or `s3` | ||
|
||
For file: | ||
|
||
- `data_file_path`: the path where data will be stored. Defaults to `./.edrys` | ||
|
||
For S3: | ||
|
||
- `data_s3_endpoint` | ||
- `data_s3_port` | ||
- `data_s3_use_ssl` | ||
- `data_s3_region` | ||
- `data_s3_access_key` | ||
- `data_s3_secret_key` | ||
- `data_s3_bucket` | ||
|
||
### Advanced | ||
|
||
- `frontend_address`: use if the front-end is on a different address (enables | ||
CORS) | ||
- `frontend_path`: file path to where static files will be served (defaults to | ||
`./static`) | ||
- `default_modules_json`: can be used to override the default modules in a newly | ||
created class | ||
- `jwt_lifetime_days`: defines how long before users have to log-in again | ||
(defaults to 30) | ||
|
||
## Running in production | ||
|
||
While you can directly expose Edrys to your users (and this will be the goal in | ||
the future), it is currently not recommended. There is no HTTPS or rate limiting | ||
implemented. We recommend running Edrys behind a reverse proxy such as | ||
[Caddy](https://caddyserver.com/docs/quick-starts/reverse-proxy) to quickly gain | ||
these features. | ||
|
||
Besides self-hosting, an easy way to host Edrys is | ||
[Deno Deploy](https://deno.com/deploy) (no affiliation). | ||
|
||
Be aware that the Edrys front-end has to be served on the same host where the | ||
API is (which is the case by default). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
Edrys classes are based on the concept of "modules". A module is a class | ||
building block. You can create your own modules or explore existing modules and | ||
add them to your class. | ||
|
||
A module is just an HTML page that is run in an iframe and shown to your | ||
students, teachers, and on stations. You can make the module behave differently | ||
depending on where it is currently loaded. Modules use the Edrys.js API to send | ||
and receive messages in real time, allowing you to build any live functionality | ||
without setting up any real-time infrastructure, authenticating users, or | ||
configuring anything else, as that is all handled upstream by Edrys. | ||
|
||
## Usage | ||
|
||
To use a module you simply host it anywhere and paste its link into the Edrys | ||
app. | ||
|
||
- To explore existing modules, check out the | ||
[`edrys-module` tag on GitHub](https://github.com/topics/edrys-module) | ||
- The easiest way to start developing modules is to use the | ||
[Official Module Template](https://github.com/edrys-org/module) | ||
- To start from scratch, you can find | ||
[Edrys.js here](https://github.com/edrys-org/edrys/blob/main/module/edrys.js) | ||
and include it in your HTML pages | ||
|
||
## The API | ||
|
||
When using Edrys.js, you have to listen for the onReady event that will be | ||
called when the module has been fully loaded: | ||
|
||
```js | ||
Edrys.onReady(() => console.log("Module is loaded!")); | ||
``` | ||
|
||
### Metadata | ||
|
||
Edrys scrapes module HTML files for metadata. It looks at meta tags in your HTML | ||
and stores this information. The following meta tags can be set: | ||
|
||
- `description`: module description that will be shown to people adding your | ||
module | ||
- `show-in`: defines where the module will be shown. Can be "*" to load it | ||
everywhere, "chat" for the Lobby and other chat-rooms, or "station" to load it | ||
only on Stations | ||
- Page title: the page title tag will be used as the module name | ||
|
||
For an example of how to use meta tags, check out the | ||
[tags in the template module](https://github.com/edrys-org/module/blob/main/index.html). | ||
|
||
### Config | ||
|
||
Users of the module can pass in some run-time configuration to your module to | ||
customize its behavior. The content and structure of this config is entirely up | ||
to you. You can read the config in this manner: | ||
|
||
```js | ||
console.log(Edrys.module.config); // Always available | ||
console.log(Edrys.module.studentConfig); // Only available when this module is loaded to a student | ||
console.log(Edrys.module.teacherConfig); // Only available when this module is loaded to a teacher | ||
console.log(Edrys.module.stationConfig); // Only available when this module is loaded on a station | ||
``` | ||
|
||
To get where the module is currently loaded: | ||
|
||
```js | ||
console.log(Edrys.role); // Is one of "teacher", "student", or "station" | ||
``` | ||
|
||
### Messaging | ||
|
||
Modules can send and receive messages. Messages are transferred in real time to | ||
everyone else in the same room. Messages each have a "subject" and a "body" | ||
which you can use however you want (eg. Use subject for message type and body as | ||
stringified JSON). | ||
|
||
To send a message: | ||
|
||
```js | ||
Edrys.sendMessage("subject", "body"); | ||
``` | ||
|
||
To receive messages: | ||
|
||
```js | ||
Edrys.onMessage(({ from, subject, body }) => | ||
console.log("Got new message: ", from, subject, body) | ||
); | ||
``` | ||
|
||
### Room State | ||
|
||
Messaging can be used when at-most-once delivery is okay (that is, newly joining | ||
users cannot see previously sent messages). When you want to have state that can | ||
be seen by users that join the room at any time, you use room state. | ||
|
||
There are three room states: | ||
|
||
```js | ||
console.log(Edrys.liveRoom.studentPublicState); // Can be seen and edited by the module when loaded to students | ||
console.log(Edrys.liveRoom.teacherPublicState); // Can only be edited by teachers but seen by students | ||
console.log(Edrys.liveRoom.teacherPrivateState); // Can only be seen/edited by teachers | ||
``` | ||
|
||
This `Edrys.liveRoom` object is reactive, meaning you can change it anywhere in | ||
your code and Edrys will automatically update it in all other modules in | ||
real-time. For example: | ||
|
||
```js | ||
Edrys.liveRoom.studentPublicState = "test"; // Every student and teacher with this module loaded in this room will now have this update! | ||
``` | ||
|
||
To listen to changes (eg. to re-render UI on change): | ||
|
||
```js | ||
Edrys.onUpdate((e) => console.log("Some state has changed!")); | ||
``` | ||
|
||
### Persistent State | ||
|
||
Room state is not persistent, meaning it will be wiped if the server is | ||
restarted or if the class ends and starts again. This is by design as Room State | ||
is only meant to last in the short term. For more persistent state that will | ||
remain forever until deleted, you can for example use an S3 API and store data | ||
there at a known location. A more integrated solution will be available in the | ||
future. | ||
|
||
### Other data | ||
|
||
Edrys modules receive lots of data which can be useful in developing extra | ||
functionality into Edrys. This can be found in `Edrys.liveClass`, which is also | ||
reactive in real-time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Welcome to the Edrys documentation! | ||
|
||
- 📖 Use the contents below to get started | ||
- 💬 For questions and discussions, please visit our | ||
[Gitter community](https://gitter.im/edrys-org/community) | ||
- 🐞 For bug reports and feature requests, visit the | ||
[issues tab](https://github.com/edrys-org/edrys/issues) | ||
|
||
## Contents | ||
|
||
1. [Deploying Edrys](Deployment.md) (if you don't already have access to an | ||
instance) | ||
2. [Developing Modules](modules.md) | ||
3. [Working with Stations](Stations.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Stations | ||
|
||
Edrys Stations are a feature that allows building remote labs, automated | ||
grading, and other experiences that require a non-human teacher at the other | ||
end. A station is simply an Edrys class open in the browser in "station mode" | ||
and left to respond to student queries. This functionality is also handled by | ||
the module loaded on the station end. |