This guide details how to set up logging from your host to Google Drive. Your group has to do this so that we can periodically grade your logs. It may take up to 15 minutes to complete (sorry).
Note: Commands in this format should be run in the terminal on your OpenVZ Host.
Begin by downloading the repository:
sudo apt-get install git
git clone https://github.com/ecthros/102
Now that you've downloaded the code, install the necessary dependencies:
cd 102
sudo ./setup.sh
Head to the Google Developers Console. Click on "Create Project" in the top right corner. Then select "Create a Project". Name the project anything (I named mine "Hacs 102 Group 2K).
Agree to the terms and press "Create". Wait for it to load, and then next to "Google Drive API", make sure to click "Enable":
Click on one of the tabs on the left labeled "Credentials". Choose “New Credentials > Service Account Key”.
Select "Compute Engine Default service account" and click "Create". A .json file will be downloaded.
Now that you've downloaded the .json file, you need to move the file to your host. There are a number of ways to do this - either using scp or uploading the file to dropbox and using wget. If you have port forwarding enabled, you could also copy and paste. You will need the location of this file for later.
You're almost there! Open the .json file, and you'll see an email associated with the "client_email" field. Copy it and share ALL your google sheets (or just your folder) with that email.
To run the script, use:
log -k <yourJSONfile> -s <sheetid> -d <data>
Where you need to replace the things inside the angle brackets (and the angle brackets themselves!) with the following data:
-
The JSON file should be the absolute path to the file, like: /root/stuff/hacs.json
-
And your sheetid is the URL of the Google Sheet. This is the full url, including https:// and edit#gid=0.
-
data is comma-separated values for your data, for example, "Toby,George,Matt,Louis-Henri". If I wanted to update the sheet with all the TAs' names, I would use the following command:
log -k /root/stuff/hacs.json -s 1tlssiBoaiolsFMpvJFaC9JCFA7tfrYu30rIU4TVvNcM -d "Toby,George,Matt,Louis-Henri"
You've finished!! Now you need to figure out how often you want to run the logging command and which logs you want to update.
If you want, feel free to play around with the -w and -d options. For help, type: log --help