Skip to content
Snippets Groups Projects
Commit d0d0526b authored by Mitchell Moore's avatar Mitchell Moore
Browse files

Update README.md

parent a3fc9d30
No related branches found
No related tags found
1 merge request!35Version 1b openstack rabbitmq
......@@ -4,51 +4,68 @@
To clone this repo use the command:
```
$ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git
```
## Prerequisites
###Clone Repository
### Clone Repository
- 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)
- Note, this project requires a virtual environment running python2 (2.7.x)
- Ensure Flask and other dependencies are installed using the following commands:
```
$ git checkout version-1b-local-rabbitmq
$ cd ~/your/repo/path/flask_user_reg
$ git checkout version-1b-openstack-rabbitmq
$ source venv/bin/activate
$ pip install -r requirements.txt
```
- Note, to install flask in your own `$HOME` use `pip install --user Flask`.
### RabbitMQ
(Reference [Tutorial Part Four](https://www.rabbitmq.com/tutorials/tutorial-four-python.html))
- Install RabbitMQ server on the host machine. (Tutorials [here](https://www.rabbitmq.com/download.html).)
- Additionally, if on a Mac, it is recommended that you add the following line to your `.bash_profile`:
### 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`:
`export PATH=$PATH:/usr/local/opt/rabbitmq/sbin`.
- Run the command `$ rabbitmq-server`. (Note, this implementation assumes RabbitMQ is running on localhost on standard port 5672)
- 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.
## Test RabbitMQ
For a simple example on the functionality of RabbitMQ, do the following:
- Open 4 separate terminal sessions whilst in the `flask_user_reg` directory and enter one of the following commands per window:
- 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 in First
$ python ohpc_consumer.py
# Run in Second
$ python ood_consumer.py
# Run in Third
$ python message_manager.py
# Run consumer on ohpc node
$ python base_consumer.py ohpc
```
- You will notice that the scripts are all awaiting a message to be sent to them.
- To produce a message run the following in the forth terminal session:
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:
```
# Run in Forth Window
$ python test_producer.py
$ python test_producer.py ohpc
```
- Notice that the producer sends only to the specified `ood` and `ohpc` consumers and not to the `message_manager` consumer.
- **Note,** that the `test_producer.py` script is identical to the code within the `ingest_data()` function in `run.py`.
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`.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment