Newer
Older
$ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git
- Ensure `pip` is installed (see: https://packaging.python.org/guides/installing-using-pip-and-virtualenv/ ).
- Check if installed by typing `$ pip` for Mac/Linux or `$ py` for Windows.
- Mac/Linux: Install pip using `$ python -m pip install --user --upgrade pip`.
- Windows: Install pip using `$ py -m pip install --upgrade pip`
- Ensure you have created a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments)
called `venv` setup within the cloned project.
- Note, this project requires a virtual environment running python2 (2.7.x)
- Ensure Flask and other dependencies are installed using the following commands:
$ cd ~/your/repo/path/flask_user_reg
$ source venv/bin/activate
$ pip install -r requirements.txt
- Note, to install flask in your own `$HOME` use `pip install --user Flask`.
### Install RabbitMQ
(Reference: [here](https://www.rabbitmq.com/tutorials/tutorial-four-python.html))
- Install RabbitMQ server on the host machine. ([Installation Guide](https://www.rabbitmq.com/download.html))
- #### Mac/Linux
- `$ brew update`
- `$ brew install rabbitmq`
- it is recommended that you add the following line to your `.bash_profile`:
- Start server using the command `$ rabbitmq-server`. (Note, this implementation assumes RabbitMQ is running on localhost on standard port 5672)
- #### Windows
- Download the installer from [here](https://github.com/rabbitmq/rabbitmq-server/releases) and run.
- Post install, the server should be running. To check, run `$ rabbitmqctl.bat status`.
- #### CentOS 7
- First, import signing key using `$ rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc`
- Next, install Erlang using `$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm`
- Finally, install RabbitMq using `$ yum install rabbitmq-server-3.8.2-1.el8.noarch.rpm`
- The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the
daemon by default when the system boots, as an administrator run: `$ chkconfig rabbitmq-server on`.
- As an administrator, start and stop the server as usual: <br/>`/sbin/service rabbitmq-server start`
<br/> `/sbin/service rabbitmq-server stop`
- Add the user "reggie" using the command `$ rabbitmqctl add_user reggie reggie`.
- The current configuration assumes the following username password combination. To change the password, type
`$ rabbitmqctl change_password reggie <new_password>`.
- Note that rabbitmqctl may require sudo permissions and that changing the password will require a password
change in the credentials within `test_producer.py` and `base_consumer.py` as well.
For a simple example on the functionality of RabbitMQ, do the following:
- Open up a new ssh terminal and ssh into your ohpc node and, in a separate window, ssh into your ood node.
- Once in, ensure your rabbitmq server is running using the command ` `
- Additionally, ensure you have a rabbitmq user configured with the username and password as `reggie`.
-
# Run consumer on ohpc node
$ python base_consumer.py ohpc
You will notice that the script is awaiting a message to display.
To produce a message, run the following on the ood node terminal session:
You should now see that the message has been sent and displayed on the ohpc node.
- **Note,** that the `test_producer.py` script is identical to the code within the `ingest_data()` function in `run.py`.