This project is a server that uses the Flask Python Web Framework, PyMongo(MongoDB), Gunicorn WSGI, Nginx running on Ubuntu 16.04 LTS in Vagrant.
On startup of the server, the application and associated processes will be started automatically. The application will be available on localhost:7500.
If you already have Vagrant set up and Ubuntu 16.04 LTS box installed, skip this section
You will need to have Vagrant (minimum version 1.9.1) and VirtualBox (minimum version 5.1.14) installed to run this. Once those are installed, add the Ubuntu 16.04 LTS box by running the command vagrant box add ubuntu/xenial64
.
First fork this repository and then clone your forked repository by running git clone https://github.com/<username>/mean-vagrant
. Then cd
into the cloned repository and run vagrant up
.
Installs:
- Nginx (newest version)
- Python (v2.7)
- MongoDB (v3.4)
- PyMongo (newest version)
- Gunicorn WSGI (newest version)
- Supervisor (newest version)
By default, changes made to the files will restart the server (Supervisor set up to watch files)
Once installed, replace app.py with your own Flask application.
Note: If you want to rename your main Flask file from app.py to something else, go to .provision/flask_project.conf
file. Modify the command where it says app:app
to <filename>:app
.
Clone the files and in terminal cd
to the directory.
-
If the OS is outdated run:vagrant box update
-
To start server:
vagrant up
-
To access server shell:
vagrant ssh
-
Only do this if you need a fresh server
To remove server:
vagrant destroy
-
Use this instead when you need to shut down server
To shutdown server:
vagrant halt
-
To put server to sleep:vagrant suspend
-
To reload server:vagrant reload
-
To reload server to updated provisions:
vagrant reload --provision
The server should be up and running. To check, visit http://localhost:7500 in your browser.
To make changes to the box and automate the process of installing environment dependencies, place the commands in the Vagrantfile.
Refer to the LICENSE file in this repository.