#### 1. Connect to WB Dev machine (if you don't have the key set up, you can use a password) ``` wbdev@54.157.63.17 ``` ##### 2. (Optionally) From the WB Dev machine, enter a tmux session. You need a session in case you get disconnected and want to resume your work. ``` tmux new-session -s session_name ``` or ``` tmux attach-session -t session_name ``` #### 3. Find the database connection ENV variables To connect to the database, you will need to know the ENV variable names for the database connection. They are usually located in `convox.yml` for your service. You just read them from `convox.yml` on github or fetch from ENV with ``` kk env -- prod user | grep DB ``` #### 4. Connect your service's web instance In this case it's user service production ``` kk kon -- prod user ``` The command above will run the following on convox ``` usr/local/bin/convox exec --rack appex/production --app wb-user-service web-78d59d7494-wfm2s bin/entrypoint.sh bash ``` #### 5. Run the command to export to scv Below is the command to export facebook users from users service. ``` mysql -h $WB_USER_DB_HOST -D wbuser_production -u $WB_USER_DB_USERNAME -p$WB_USER_DB_PASSWORD -e "SELECT id, email, firstName, lastName, primaryLoginField, facebookIds FROM Users WHERE facebookIds IS NOT NULL ORDER BY id DESC" > facebook-users.tsv ``` #### 6. Upload the report to WB Dev machine Run this from inside the web instance ``` scp facebook-users.tsv wbdev@54.157.63.17:/home/wbdev/ ``` #### 7. Exit the web instance with ``` exit ``` #### 8. Download the report to your own PC Run this from your PC ``` scp wbdev@54.157.63.17:/home/wbdev/facebook-users.tsv . ```