Skip to content

Commit 9d2ad6e

Browse files
authored
Update README.md (#127)
* Update README.md * Update README.md again * Update README.md
1 parent 780b798 commit 9d2ad6e

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

README.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,34 @@ The portal is a public-facing website that allows students to submit a request f
66

77
The recent loss of a previous tutoring portal is a major motivation for the development of this project. In addition, the transition to online classes and online tutoring has driven inspiration for some new features as well, such as marking tickets as online/on-campus depending on whether the student has been helped remotely or in person and auto-calculating the time spent on helping a student (which was previously manually provided by a tutor). These features will help in providing useful statistics about the kind of help students are requesting from the tutoring center and how often.
88

9+
Visit the [docs](https://claytonmsafranek.github.io/UNO-CSLC-Ticket-Portal/) for more info.
10+
911
## Release Notes
1012

11-
The application is currently a work in progress. The following is a list of currently existing features in the application:
13+
The following is a list of currently existing features in the application:
1214

1315
- Form for submitting a ticket.
1416
- Page for viewing tickets.
1517
- Ability to claim/close tickets.
1618
- Editable tickets (can update most fields set for the ticket).
17-
- Front-end for administrative console.
19+
- Administrative console backend for adding tutors, courses, configuring the portal app and downloading reports.
20+
- Tutor, Admin and Owner permissions (restrict views for authenticated users based on permission level).
1821
- A home page that asks to log in or shows username when logged in.
1922
- Login management; only authenticated users can view certain pages (Unauthenticated users will be redirected to Microsoft sign-in).
2023
- Automatically generated, self-signed SSL certificates for HTTPS connections
2124

22-
Next Milestone [Milestone 5](https://github.com/claytonmsafranek/UNO-CSLC-Ticket-Portal/milestone/5) (still working on):
23-
24-
- Creating automated unit tests for selenium.
25-
- Automatic deployment to Azure Dynamic Web Apps.
26-
- Administrative console backend for adding tutors, courses, configuring the portal app and downloading reports.
27-
- Tutor and Admin permissions (restrict views for authenticated users based on permission level).
28-
29-
Visit the [docs](https://claytonmsafranek.github.io/UNO-CSLC-Ticket-Portal/) for more info.
25+
Next Milestone [Milestone 6](https://github.com/claytonmsafranek/UNO-CSLC-Ticket-Portal/milestone/6).
3026

3127
## Configuration
3228

3329
### Flask
30+
The program can be run locally for testing and development. The main file is `portal/app/__init__.py` which contains a definition for the `create_app()` factory function (flasks expect this and automatically calls the function). Before you can run the app, you need to install the dependencies via `pip install -r portal/requirements.txt` (assuming your current working directory is in the root folder of this project). This installs the core dependencies for the project, you can also install the development dependencies located in `portal/requirements/dev.txt` if you intend on running tests and linting. The following commands are one way to locally run the program:
31+
32+
```
33+
export FLASK_APP=portal/app
34+
flask run --debug
35+
```
36+
3437
The flask app (located in `portal/`) has a `default_config.py` script providing some default configuration for the project. *This does not need to be changed to configure the project*. If you would like to set additional options or override existing ones, then create a `.env` file in the `portal/` directory which sets the options to the desired values (prefixed with `FLASK_`).
3538

3639
Example `portal/.env`:
@@ -43,16 +46,12 @@ FLASK_SECRET_KEY=my_secret
4346

4447
These values will override any values specified in `default_config.py`.
4548

46-
### Nginx
47-
The Nginx web server can be configured via its `nginx/nginx.conf` file. This configuration file is simply copied into the docker container which is generated by docker-compose and replaces the default configuration for Nginx.
48-
49-
When using URLs or connections to applications in different containers make sure you provide the name of the container as the hostname. Example: `http://portal:8000` would connect to the application on port 8000 in the "portal" container using the HTTP scheme.
50-
51-
### MySQL
52-
By default, the docker-compose file will auto-generate a docker MySQL image and set the `FLASK_SQLALCHEMY_DATABASE_URI` env variable (this will override any settings in `default_config.py` and in `portal/.env`). The MySQL database can be configured via its configuration file located in `mysql/mysql.cnf`, which will extend/override any default configurations existing in the MySQL image.
49+
Using flask debug mode is recommended for getting feedback on errors rather than HTTP internal server error status codes. The local flask app will use a local sqlite3 database (which should be created in `portal/instance/` at runtime). This should make it easy to ensure that the application is saving objects to the database correctly. The application needs to be configured with an *owner* account by setting the `FLASK_DEFAULT_OWNER_EMAIL` to a desired email environment variable in the `.env` file. **This is necessary in deployment and development for using the application as certain routes are restricted to higher permission levels only (of which owner is the highest)**. NOTE: You will need to configure Microsoft authentication to login, which is explained later.
5350

54-
The Flask app will use the local MySQL docker database when running in production (via docker-compose). However, if you wish to use a custom remote MySQL server then you will need to change the `FLASK_SQLALCHEMY_DATABASE_URI` in the `docker-compose.yml` file to refer to that database. The default installed database connector is `PyMySQL`, if a different one is desired it will need to be installable via pip (so that docker can install it in the container), otherwise, this will require manual intervention from the user.
51+
#### Visual Studio Code
52+
Additionally, if you are using Visual Studio Code you can configure a `launch.json` and `settings.json` file for debugging and automatic linting. You can download and use the sample [launch.json](https://gist.github.com/Mr-Oregano/9873bebd7f8d871e36e5c5361b4bad9d) and [settings.json](https://gist.github.com/Mr-Oregano/388bbff7736d6fd7f166b697cb6ed48d) files and copy them into a `.vscode/` folder in the root directory of the project. *Make sure you have [flake8](https://pypi.org/project/flake8/) and [pytest](https://pypi.org/project/pytest/) installed!*. You can install these via `pip install -r portal/requirements/dev.txt`
5553

54+
For other IDE/editors you are on your own in terms of setup.
5655
### Microsoft Azure App Directory Authentication
5756

5857
The application uses the Azure App Directory API for authentication and will need to be registered as a legitimate application in the app directory at https://portal.azure.com/. This requires some configuration on behalf of the user.
@@ -81,20 +80,20 @@ Subservices will exist inside isolated docker containers and will communicate wi
8180

8281
Clients will interface with the application through a browser and an internet connection.
8382

84-
### Local Development
85-
Running the program locally is recommended for testing and development rather than actual deployment. The main file is `portal/app/__init__.py` which contains a definition for the `create_app()` factory function (flasks expect this and automatically calls the function). The following commands are one way to locally run the program:
83+
### Nginx
84+
The Nginx web server can be configured via its `nginx/nginx.conf` file. This configuration file is simply copied into the docker container which is generated by docker-compose and replaces the default configuration for Nginx.
8685

87-
```
88-
export FLASK_APP=portal/app
89-
flask run --debug
90-
```
86+
When using URLs or connections to applications in different containers make sure you provide the name of the container as the hostname. Example: `http://portal:8000` would connect to the application on port 8000 in the "portal" container using the HTTP scheme.
9187

92-
Using flask debug mode is recommended for getting feedback on errors rather than HTTP internal server error status codes. The local flask app will use a local sqlite3 database (which should be created in `portal/instance/` at runtime). This should make it easy to ensure that the application is saving objects to the database correctly.
88+
### MySQL
89+
By default, the docker-compose file will auto-generate a docker MySQL image and set the `FLASK_SQLALCHEMY_DATABASE_URI` env variable (this will override any settings in `default_config.py` and in `portal/.env`). The MySQL database can be configured via its configuration file located in `mysql/mysql.cnf`, which will extend/override any default configurations existing in the MySQL image.
90+
91+
The Flask app will use the local MySQL docker database when running in production (via docker-compose). However, if you wish to use a custom remote MySQL server then you will need to change the `FLASK_SQLALCHEMY_DATABASE_URI` in the `docker-compose.yml` file to refer to that database. The default installed database connector is `PyMySQL`, if a different one is desired it will need to be installable via pip (so that docker can install it in the container), otherwise, this will require manual intervention from the user.
9392

9493
### Deployment
9594
When deploying this application, however, the portal app uses the gunicorn wsgi web server to run the application instead of flask. This is a production-ready server designed to handle more requests than flask. The `portal` and `mysql` containers will only be accessible through localhost on port 8000 and port 3306 respectively. Instead, the `nginx` container will be remotely accessible on either port 80 (HTTP) or port 443 (HTTPS) which will forward requests to the flask app.
9695

97-
These settings are already automatically configured by docker and docker-compose so there shouldn't be a need to do anything besides running `docker-compose up`, which will build the images and then run them. Additional settings can be configured in the `docker-compose.yml` file or the individual `Dockerfile`'s for each subsystem.
96+
These settings are already automatically configured by docker and docker-compose so there shouldn't be a need to do anything besides running `docker-compose up -d`, which will build the images and then run them. Additional settings can be configured in the `docker-compose.yml` file or the individual `Dockerfile`'s for each subsystem.
9897

9998
The application can be deployed on any system running `docker` and `docker-compose`. If deploying on Microsoft Azure Cloud, the application can be installed as an [App Service](https://learn.microsoft.com/en-us/azure/app-service/overview) running a multi-container app (The `docker-compose.yml` file will need to be modified for this and any pre-generated images will either need to be pushed to azure or docker-hub). Unfortunately, this does not easily support automatic deployment without using the Azure CLI. Automatic deployment is currently being investigated.
10099

0 commit comments

Comments
 (0)