vignettes/C_hosting_on_own_shiny_server.Rmd
C_hosting_on_own_shiny_server.Rmd
This tutorial explains how to deploy the quizzes and grading app to a shiny server that you have access to and that you have control over.
I assume that you are comfortable connecting to a Shiny server that you or someone else has set up for you, and that you know enough basic Linux/Unix commands (e.g., how to create folders, change permissions) to be able to set up everything.
I also assume that you set up your course and quizzes as described in this tutorial and are ready to deploy.
Combine all the documents and folders needed for deployment by
clicking the Make zip file for deployment
button in the UI.
Alternatively, you can run
create_serverpackage(courselocation = "path/to/location/for/course")
This will make a zip file containing almost all the files and folders you need. You’ll get a message telling you where the file has been placed (the main folder of your course).
Once you have this file, connect to your shiny server. Go into the
folder where you host shiny apps (usually
/srv/shiny-server/
), make a new folder. This can be called
quizgrader
or any other name, e.g., the name of the course
(mycoursename
). It will be the URL where students connect
to, e.g., https://shiny.mysite.com/mycoursename/
Copy the zip file from your local computer into that newly created
folder, then unzip it. You should now have a app.R
and
quizgrader.css
in the main directory, and 3 folders, namely
completequizzes
, studentlists
and
studentsubmissions
.
Change the permissions for at least the
studentsubmissions
folder and all its sub-folders such that
it allows write access by the shiny server/app. Also make sure
permissions to other files and folders are correct and at least allow
for user read access. Not having the right permissions is a common
problem leading to weird error messages for students. (I
usually just set permissions to full read-write-execute for all files
and folders. Is probably not the safest thing to do, but makes sure no
permission issues occur.)
Start the shiny server and if everything works, students should no be
able to go to the URL where your app lives (e.g.,
https://shiny.mysite.com/mycoursename/
) and start
submitting.
It goes without saying that you should test that everything works before telling students to start submitting. I suggest creating one or a few test users in the student tracking sheet, so you can test-submit quizzes to make sure things work as expected.
Once students start submitting, their submissions (filled Excel
sheets) are stored in the quiz-specific folder inside
studentsubmissions
. For each submission, there is also a
new entry (and in fact, a new file) created in the logs
folder. We decided to create new files instead of just modifying a
single one to have a better track record of all submissions. Only the
most recent log file is used, so if too many files start accumulating,
you can pull them to your local machine, archive there, and delete old
log files on the server.
You will want to pull all contents from the
studentsubmissions
folder to your local computer every so
often. To that end, log into the shiny server and copy everything in the
studentsubmissions
folder to the local versions of your
course. This can’t be done through the graphical interface, so for this
you need to find your local instance of the quiz and copy it there. Once
done, open quizmanager
, load the course you want to look
at, and use the Analyze Submissions
tab to see the
performance of students and how the different quiz questions are being
answered.
If you need to make any changes to the class list or the quizzes before submission has started, follow the steps in the course and quiz creation tutorial and the steps described above. You will simply overwrite the old version with your updated version.
This does not work anymore once students have started submitting.
If you need to make updates to either the main
gradelist.xlsx
file or the complete quizzes on the server,
proceed as follows:
Make any modifications to the quizzes you need to make. Generate and distribute updated student versions.
During a time when students won’t submit anything (e.g. right after a submission deadline or Saturday morning at 6am), download materials from the server as described above.
FIND A WAY TO UPDATE GRADELIST.
CONTINUE HERE AND MAKE SURE THE ONLINE SUBMISSION SYSTEM WORKS
This function takes the submission app file, the and places them to
the Shiny server. Students should now be able to go to the website
(e.g. shinyapps.io) and, after entering their identifying information, upload their quiz. The submission will be checked to make sure it is not past the due date or the number of allowed submissions has been exceeded. Then the quiz is graded by comparing the student submissions with those in the complete quiz files, the grade is recorded in the form of a score, and students are provided with immediate feedback on which questions they did get right and which they didn't. Anything entered into the
feedback`
column is also displayed. In addition, students can see information
about their cumulative performance so far.
Note that as long as any password is missing from the student list,
the app will display a not ready for submission
message.
By default, all student submission files and grade tracking files are kept on the server. This should be ok. If it takes up too much space, you can delete old files after transferring them to your local computer.
Using your own Shiny server is cheaper and you have more control. But it requires you knowing how to manage a Shiny server. If you go that route, I assume you know how to manage a shiny server and deploy apps. Here is a good tutorial on setting up and running your own server. Your company/university might also be able to set one up for you and help manage it. The Rstudio website has information on how to do this.