The project uses vagrant to create an isolated application environment within a virtual machine. To prepare your system, ensure you have an official distribution of Python version 3.7+ and install vagrant by following the instructions here. Addtitionaly you will need a provider such as VirtualBox or Hyper-V installed.
You need to clone a new .env file from the .env.tempalate to store local configuration options. This is a one-time operation on first setup:
$ cp .env.template .env # (first time only)The .env file is used by flask to set environment variables when running flask run. This enables things like development mode (which also enables features like hot reloading when you make a file change). There's also a SECRET_KEY variable which is used to encrypt the flask session cookie.
You will need to create an OAuth app under a GitHub account. Follow the instructions 'here'. You will need to provide the following values:
- Homepage URL = "http://localhost:5000/"
- Authorization callback URL = "http://localhost:5000/auth/authorize" You will be provided with a "Client Id" upon creating the application, you need to set the AUTH_CLIENT_ID variable in your .env file to this value. From the app managment page you will see an option to "Generate a new client secret", you should do so and set AUTH_CLIENT_SECRET in the .env file to it's value.
$ docker run --name to-do-database -p 27017:27017 -d mongoDocker compose configurations are provided for both production and development modes. The production configuration uses Gunicorn, while the development configuration uses Flask development server which has the additional benifit of hot reloading.
To start the application within a docker container, firstly ensure you have docker desktop installed and running, then you can run either command from your terminal:
# Production Mode
$ docker-compose up# Development Mode
$ docker-compose -f docker-compose.development.yml upTo start the application in a vagrant virtual machine by running:
$ vagrant upAlternatively you can start the app on your own machine with poetry by running:
$ poetry install
$ poetry run flask runAfter the project dependancies are installed, you should see output similar to the following:
* Serving Flask app "app" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with fsevents reloader
* Debugger is active!
* Debugger PIN: 226-556-590Now visit http://localhost:5000/ in your web browser to view the app.
The end to end tests require you have the Chrome browser installed and that you download the corresponding version of the ChromeDriver:
- Download and install Chrome from
here - Download ChromeDriver from
hereand add the executable file to the root of the project.
Once the test setup requirments are completed, execute the tests by running:
$ poetry run pytestTo build the docker image by running:
$ docker build --target test --tag todo-app:test .To execute the unit and integration tests by running:
$ docker run todo-app:test testsTo execute the E2E tests by running:
$ docker run --env-file .env todo-app:test e2e_testsThe application is deployed with azure and is accessible at https://charlie-devops-to-do.azurewebsites.net/
New deployments are automatically triggered when commits are made to the main branch.