diff --git a/BUGS.md b/BUGS.md index 0e06b53..d9933ac 100644 --- a/BUGS.md +++ b/BUGS.md @@ -19,6 +19,9 @@ ou usar push (websockets?) # TODO +- gerar teste qd o prof autoriza. +- enviar resposta de cada pergunta individualmente. + - experimentar gerador de svg que inclua no markdown da pergunta e ver se funciona. - imagens jpg/png nas perguntas. - suportar cotacao to teste diferente de 20 (e.g. para juntar perguntas em papel). opcao "points: 18" que normaliza total para 18 em vez de 20. diff --git a/README.md b/README.md index ccd4db5..448a5cd 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ 2. [Running a demo](#running-a-demo) 3. [Troubleshooting](#troubleshooting) -## Installation +## 1. Installation -### Requirements +### 1.1 Requirements The webserver is a python application and requires `python3.6` and `pip` to be installed, plus the following additional packages: @@ -16,13 +16,14 @@ The webserver is a python application and requires `python3.6` and `pip` to be i - Pygments - SQLAlchemy - bcrypt +- markdown These can be installed for a single user (recommended), in a python virtual environment or system wide. #### Installing packages for a single user (recommended) ```.bash -pip3 install --user tornado mistune pyyaml pygments sqlalchemy bcrypt +pip3 install --user tornado mistune pyyaml pygments sqlalchemy bcrypt markdown ``` #### Installing packages in a virtual environment (alternative) @@ -31,7 +32,7 @@ pip3 install --user tornado mistune pyyaml pygments sqlalchemy bcrypt pyvenv-3.6 venv/perguntations # or other virtualenv directory source venv/perguntations/bin/activate # activate virtualenv -pip3 install tornado mistune pyyaml pygments sqlalchemy bcrypt +pip3 install tornado mistune pyyaml pygments sqlalchemy bcrypt markdown ``` #### Installing packages system wide (alternative) @@ -51,7 +52,7 @@ port install py36-py36-tornado py36-mistune? py36-yaml py36-pygments... ``` -### Install and setup perguntations +### 1.2 Install and setup perguntations There is no installer, pip or otherwise. It's still in development and has to be run from sources. Use `git` to get the sources: @@ -65,11 +66,35 @@ where USERNAME is your account on bitbucket. The server will run an https server and requires valid certificates. To generate certificates, there are two possibilities: public server with static IP address or a private server. -#### Generating certificates for a public server +#### Generating certificates for a public server (FreeBSD) -For a public server, `letsencrypt` will allow a certificate to be generated. +```sh +sudo pkg install py27-certbot # FreeBSD +``` + +Shutdown the firewall and any server running. Then run the script to generate the certificate: + +```sh +sudo service pf stop # disable pf firewall (FreeBSD) +sudo certbot certonly --standalone -d www.example.com +sudo service pf start # enable pf firewall +``` + +Certificates are saved under `/usr/local/etc/letsencrypt/live/www.example.com/`. Copy them to `aprendizations/certs` and change permissions to be readable: -TODO: explain... +```sh +sudo cp /usr/local/etc/letsencrypt/live/www.example.com/cert.pem . +sudo cp /usr/local/etc/letsencrypt/live/www.example.com/privkey.pem . +chmod 400 cert.pem privkey.pem +``` + +Renews can be done as follows: + +```sh +sudo service pf stop # shutdown firewall +sudo certbot renew +sudo service pf start # start firewall +``` Copy certificates `cert.crt` and `cert.key` to the `perguntations/certs/` directory. @@ -79,7 +104,7 @@ Self-signed certificates are not certified by a recognised authority and browser ```bash cd perguntations/certs/ -openssl req -x509 -newkey rsa:4096 -keyout cert.key -out cert.crt -days -nodes +openssl req -x509 -newkey rsa:4096 -keyout cert.key -out cert.crt -days 365 -nodes ``` ## Running a demo @@ -92,12 +117,14 @@ To run the demonstration test: cd WHERE/YOU/INSTALLED/perguntations # create and initialize database using one of the following methods: -./initdb.py students.csv # from CSV file -./initdb.py --demo # initialize with fake students -./initdb.py # only adds the administrator account +./initdb.py students.csv # initialize from a CSV file +./initdb.py --admin # only adds the administrator account +./initdb.py --add 123 "Asterix Gaules" # add one student + +# a database file "students.db" is created mv students.db demo/ -# create directory to save the student's tests +# create directory to save the finished tests mkdir demo/ans # edit test configuration and check if everything looks right -- libgit2 0.21.2