diff --git a/docs/install_ubuntu_1604.md b/docs/install_ubuntu_1604.md new file mode 100644 index 0000000..f7c532c --- /dev/null +++ b/docs/install_ubuntu_1604.md @@ -0,0 +1,116 @@ + +## Installing on Ubuntu 16.04 + + - Clone the repository, preferably to your home folder `~`, by issuing the following command. Answer "yes" if fingerprint question about the authenticity of host comes up. + +```bash +git clone https://github.com/boun-cmpe-soslab/drenaj.git +``` + + - Install dependencies by running following commands. + +```bash +sudo apt-get update +sudo apt-get upgrade +sudo apt-get install build-essential python python-pip python-dev ntp ntpdate +sudo pip install virtualenvwrapper +``` + + - Run following commands to modify and run `.bashrc`. + +```bash +echo -e 'export WORKON_HOME=$HOME/.virtualenvs\nsource /usr/local/bin/virtualenvwrapper.sh' >> ~/.bashrc +source ~/.bashrc +``` + + - Rename configuration template as configuration file. + +```bash +mv ~/drenaj/drenaj/client/config/config.py.tmpl ~/drenaj/drenaj/client/config/config.py +``` + + - Optional: If you want to tweets to be saved to a file for external processing, you need to edit `~/drenaj/drenaj/client/workers/streamcatcher.py`. Find the `post_to_gateway` function, and append the following right after `if not tmp: return`, without changing the indentation level. + +```python3 + f = open("/tmp/stream_out.json", "a") + for tweet in tmp: + tweet['campaign_id']=params['campaign_id'] + f.write(bson.json_util.dumps(tweet)) + f.write("\n") + f.close() +``` + + - Before going further, it is suggested that you launch a tmux window and operate under that. + +```bash +tmux +``` + + - Make sure you are at the correct directory. + +```bash +cd ~/drenaj +``` + + - Now, let's create a virtual environment. After this is done, you should see `(drenaj_client)` at the beginning of the line. + +```bash +mkvirtualenv drenaj_client +``` + + - Call `client_setup.py` as follows. It might give a warning about installing libzmq, let the script install it. You may also observe warnings for C/C++ objects, that you can ignore. This might take a few minutes. + +```bash +python client_setup.py install +``` + + - After `client_setup` is done, now you can finally start drenaj for the first time. To do so, issue the following command from the very same `~/drenaj` directory. + +```bash +drenaj_client setup +``` + + - As soon as you issue the command, it will ask you to authorize yourself through Twitter by providing a link. Visit the link, authenticate yourself and put the pincode back to terminal. You can add as many Twitter accounts as you like. When you want to stop, just give empty pincode. When you finish authenticating, you should see `Direnaj Local Visualization and Interaction Manager Starting on port 19999` on your tmux screen. + + - You can visit [http://localhost:19999/campaigns/list](http://localhost:19999/campaigns/list) to create/spawn campaigns, and [http://direnaj-staging.cmpe.boun.edu.tr](http://direnaj-staging.cmpe.boun.edu.tr) to see the results. + + - To keep drenaj running, detach tmux by pressing `CTRL B` at the same time, and then pressing `D`. You can always attach it back by `tmux at` command. + + - To exit drenaj, press `CTRL C`. If it doesn't work, use `Ctrl Z` and run `kill %1`. Leave virtual environment by running `deactivate`. + + - You can check whether drenaj is still running or not by issuing `pgrep drenaj`. If it gives you a number, that will be the process id drenaj is running under. + + + + + +## Running on Ubuntu 16.04 + + - Get into a `tmux` screen, and make sure you are at the right directory. + +```bash +tmux +cd ~/drenaj +``` + + - Get into virtual environment. + +```bash +workon drenaj_client +``` + + - Run drenaj. + +```bash +drenaj_client runserver +``` + + + +## Seeing all tweets in JSON + + - Using Google Chrome, visit [http://direnaj-staging.cmpe.boun.edu.tr](http://direnaj-staging.cmpe.boun.edu.tr) and load the campaign page of interest. + - Right click the page once loaded, and click `inspect element`. This will make developer tools visible. + - Find the `network` tab in developer tools, and select it. Then, reload the page. + - You should see a `filter` item in network tab. Right click it, and select open in new tab. + - You can use [Chrome Extensions](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en) for displaying pretty JSON. \ No newline at end of file diff --git a/docs/temp_client_instructions_to_be_fixed b/docs/temp_client_instructions_to_be_fixed deleted file mode 100644 index 669f594..0000000 --- a/docs/temp_client_instructions_to_be_fixed +++ /dev/null @@ -1,76 +0,0 @@ -!!!WE NEED A SERIOUS CLEANUP OF THIS KIND OF DOCUMENTATION!!! - -h2. How to Setup Drenaj Client on Linux - -The below text was written for the version 0.5 of the Drenaj client. However, they are applicable to -the current state. - -# Run these commands to install dependencies: -
sudo apt-get install build-essential python python-pip python-dev ntp ntpdate -sudo pip install virtualenvwrapper-# Copy next two lines to ~/.bashrc file -
export WORKON_HOME=$HOME/.virtualenvs -source /usr/local/bin/virtualenvwrapper.sh-And you should run following command. -
source ~/.bashrc-# Download http://voltran.cmpe.boun.edu.tr/attachments/download/46/drenaj_client-0.5-localfile.tar.gz and extract the contents. -# Edit config.py file by running following command. -
gedit drenaj_client-0.5-localfile/drenaj/client/config/config.py-If you get an error, you should probably change your location. -In this file, you should change some of commented lines, so that they look like below: -
-#DRENAJ_APP_HOST = 'localhost' -DRENAJ_APP_HOST = 'direnaj-staging.cmpe.boun.edu.tr' -#DRENAJ_APP_PORT['development'] = 9999 -DRENAJ_APP_PORT['development'] = 80 --# Edit stream catcher file as noted below. -
gedit drenaj/client/workers/streamcatcher.py-You should go to line 159, which looks like this: -
f = open("~/.drenaj/tweets.json", "a")-You have to remove the tilde from the path. You have to write full path to that line. -# Create a virtual environment by the next line. -
mkvirtualenv drenaj_client-# Now you should call client_setup.py as follows. -
python client_setup.py install-# You have to be in the drenaj folder, otherwise you will get a 500 error. Once you're there, run following. -
drenaj_client setup-When you do this, application will give you a link and ask for a pin. you can go to that link, authenticate your Twitter account and give the pin back to the application. -You can authenticate more than one accounts. Once you're done with authentication, you can press enter to finish this step. -# At this point, setup is completed. You can go to http://localhost:19999/campaigns/list to create/spawn campaigns, http://direnaj-staging.cmpe.boun.edu.tr to see the results. -# You can exit drenaj by Ctrl+C. If it doesn't work, do a Ctrl+Z and run
kill %1You can check whether drenaj is still running or not by typing
fgYou an leave virtual environment by the next command.
deactivate- - - - - - - -h2. How to Run Drenaj v0.5 on Linux - -This part assumes that you had installed drenaj in the way described above. - - -# Get into virtual environment. -
workon drenaj_client-# You have to be in the drenaj folder, otherwise you will get a 500 error. Once you're there, run following. -
drenaj_client runserver-# At this point, drenaj is running. You can go to http://localhost:19999/campaigns/list to create/spawn campaigns, http://direnaj-staging.cmpe.boun.edu.tr to see the results. -# You can exit drenaj by Ctrl+C. If it doesn't work, do a Ctrl+Z and run
kill %1You can check whether drenaj is still running or not by typing
fgYou an leave virtual environment by the next command.
deactivate- - -h2. How to see all tweets in json format - -# Go to any campaign page on drenaj-staging (eg. http://direnaj-staging.cmpe.boun.edu.tr/#/statuses/filter/tayyip ) -# On Google Chrome, right click the page, click inspect element. -# Go to network tab and reload the page. Find filter?auth_pass=... on the left, right click it and open link in new tab. -# You can see the json file. You may use JSONView extension to display it better. You can download it at https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en . - -OR - -# Go directly to http://direnaj-staging.cmpe.boun.edu.tr/statuses/filter?auth_password=tamtam&auth_user_id=drenaj&campaign_id=direnodtu&limit=10&skip=0 . You should probably change campaign_id, limit and skip. You may still use JSONView extension, find the link above. - - -h2. How to run Drenaj continuously - -When you shut down drenaj on your personal computer, the campaign will stop collecting tweets. One possible way to run campaigns continuously is to keep your computer on and connected all the time. Another reasonable way is to set up a server instance in the cloud. You can use services such as http://www.DigitalOcean.com or http://aws.amazon.com/ec2/ . When you're working on the cloud through ssh, you should probably use tmux. That is, you should run tmux before running drenaj. Once you run drenaj client in tmux, you can do CTRL+B then D to "detach" drenaj. You can then exit ssh with CTRL+D, and drenaj will continue to run in your cloud.