Skip to content

Instantly share code, notes, and snippets.

@hany
Created April 20, 2016 02:06
Show Gist options
  • Save hany/308ccd9c5e3fa5f859eb7c4a87471a12 to your computer and use it in GitHub Desktop.
Save hany/308ccd9c5e3fa5f859eb7c4a87471a12 to your computer and use it in GitHub Desktop.
# General
## Find out what the bot can do
```
user 1> @vmbot what can you do?
vmbot> I can do many things. Examples:
- Notifications
- Common tasks such as pausing monitoring, managing SSH access, scaling up or down, listing graphs, deploying appliances
- Custom tasks
- Documentation
- Tickets
- Account management
user 1> @vmbot what kind of notifications do you send?
vmbot> I can send notifications about VM Farms-opened tickets, outages, security advisory and other important topics.
```
# Notifications
## VM Farms Opened Tickets
```
vmbot> Hey there! Humans have opened up ticket [#12410 - We are investigating SWAP alerts on prod-db01].
```
## Outages
```
user 1> hey guys, just deployed that bug fix.
user 2> Fantastic! Thanks.
vmbot> Oh oh, I've detected an outage on https://yoursite.com. I've paged a human.
user 1> whoops! i think something happened with the database.
*vmops joins the room*
vmops> hey folks, looks like that last deploy caused a lockup on the DB. Should we kill off the query?
user 2> Yes, please!
vmops> Done!
vmbot> Looks like the site has recovered!
```
## Security Advisory and other blasts
```
vmbot> Hey there, looks like an [nginx security advisory] has been issued. It affects the following servers:
- stage-core-lb-01
- prod-core-lb-01
vmbot> A human will be applying the patch on October 8th to stage-core-lb-01 and October 9th to prod-core-lb-01!
```
## Billing Related
```
vmbot> Hey there, looks like your credit card (Visa ending in 2345) is expiring next month! Please use this link to update your billing details: https://vmf.io/cds32rve
```
# Common Tasks
## Pause Monitoring
```
user 1> @vmbot pause monitoring 15 min
vmbot> No problem! Monitoring is paused for 15 minutes. I'll notify you 3 minutes before expiry.
```
## Environment Cloning
```
user 1> i think we need to test this out in a separate environment
user 2> Agreed.
user 2> @vmbot clone production environment and call it testing.
vmbot> Coming right up!
```
## Scaling up
```
user 1> marketing tells me we're expecting a burst of traffic later today. probably need to scale up ahead of time
user 2> Agreed.
user 2> @vmbot add 5 more production app servers.
vmbot> I'm on it.
```
```
user 1> @vmbot please scale up to 4 app servers.
vmbot> I'm sorry @user1, that job is not configured yet. If you'd like, I can log a ticket on your behalf to request configuration. Let me know.
user 1> Yes, please.
vmbot> Done! I've logged ticket [#12451] to track this. A human will be in touch shortly.
```
## Listing Graphs
```
user 1> @vmbot show me graphs for prod-app01
vmbot> There are a lot. You can view them all here: https://vmf.io/32csd823
user 1> @vmbot show me load graphs for prod-db01
vmbot> No problem!
<link>
```
## Deploying Appliances
```
user 2> I think Redis would be a good fit for that. We should test it.
user 1> yeah, good idea.
user 1> @vmbot what versions of redis are supported?
vmbot> We support versions 2.8 and 3.0.
user 1> @vmbot please add a Redis 3.0 server to the testing environment.
vmbot> Coming right up.
```
## Adding DB Users
```
user 1> @vmbot i need a read-only database user name dbread created on prod-core-db01.
vmbot> No problem. Give me a minute.
vmbot> Done! Here are the credentials: https://vmf.io/cdsagr2nkvd
```
## Adding SSH Keys
```
user 1> @vmbot i need to update my SSH key.
vmbot> I'll need someone with administrative privileges to authorize that request.
user 2> @vmbot approved.
vmbot> Thanks! @user1, please give me your new key.
user 1> ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwkdSIYUv1U8TsouMVujqyr8QqmFVIMoDdj3+9pWlNJP8MnNYUrPvu67q1HbgemccerhumK7lrGXQrQ2dtUyfXZmoUlXOq+X4+qgNQCy/l3TEkeFJBhrXD5rqKA+mOYuUZWwF6BTyxOQ6eGmsyw3jRS9stJEgl0KMaD9HfQag4SG+AGBSWnpfUU9oKAgG9rYGjLra4zLPZfswiTTpKXN864R1hkfmFib6qsJSV2tYXZdK6UBVGjNxlGpdD2PZz7h+8dxMW5feOSzFAbzj2Kf0jxdNFcdObjmUvtHFWC0Ib7Sp0I96LioWJbfsPxKR6zjPZXivMfrHRzByrhLP4pHh5w== hany@mbp
vmbot> Thanks! Please give me a minute.
vmbot> Done! Your key has been added to the following servers:
- prod-app01
- prod-db01
vmbot> You can add this to your `~/.ssh/config` file:
Host prod-app01
Hostname 1.2.3.4
Username deploy
Host prod-db01
Hostname 1.2.3.5
Username deploy
```
## DB Backup Restores
```
user 1> i think we need a backup of this database server.
user 1> @vmbot restore a backup of prod-db01 from 2 days ago to a new server.
vmbot> No problem! Please standby.
vmbot> OK, the backup has been restored to a new server, temp-db01.
```
## File Backup Restores
```
user 1> @vmbot i need a backup restored of /data/web/app.com/images on prod-app01 from 2 nights ago.
vmbot> No problem! Please give me a minute.
vmbot> @user1 I've recovered the backup. It is 40GB in size and will be available for the next 24 hours. You can retrieve it here: https://vmf.io/cdsa494820 (link to tar on object store)
```
# Custom Tasks
```
vmops> Hey @user1, I've programmed the bot to control your custom sync process. If you want to run the task, ask the bot to run the job "db sync".
user 1> perfect, thanks!
user 2> @vmbot Run job db sync.
vmbot> OK, no problem! I've kicked off the DB Sync job. Average runtime is 2 minutes 45 seconds. I'll let you know when it's done.
user 1> @vmbot status of db sync job.
vmbot> DB Sync job is still running. Runtime is 1 minute.
vmbot> @user1, DB Sync job is done!
```
# Documentation
## How-To Guides
```
user 1> @vmbot how do i connect to the production database?
vmbot> You can follow [this guide] for connecting to MySQL using various clients.
vmbot> However it appears your SSH key is not present on this server. I'll need someone with administrative privileges to authorize your account addition.
user 2> @vmbot approved
vmbot> Thanks! @user1 I will add your SSH key. Standby.
vmbot> @user1 done!
```
# Tickets
## Log a ticket
```
user 1> i'm seeing some strange errors in production...
user 2> Yeah, I see the same thing.
user 2> @vmbot we need to talk to a human.
vmbot> No problem. I'll file a ticket on your behalf. What's the nature of the request?
user 2> @vmbot we're seeing some Redis errors in production.
vmbot> Thanks! I've logged ticket [#50143]. If you have more info, please paste it here.
```
```
user 1> @vmbot what version of ruby do we have installed?
vmbot> You have Ruby 2.0 in both production and staging.
user 2> @vmbot please upgrade it to 2.1 in staging.
vmbot> No problem. Ruby 2.1 is supported. I've opened up ticket [#81949] A human will be with you shortly.
```
# Urgent Requests
## Emergency Chat
```
user 1> i don't think that migration went as smoothly as I thought.
user 1> @vmbot i need to speak to a human urgently.
vmbot> Right away! I've paged a human. Ticket [#50211] to track this.
*vmops enters the room*
vmops> Hey folks, how can I help?
```
## VM Farms Chat
```
vmops> Hey folks, we're seeing a spike in load on your database server. Looks related to a recent deploy.
vmops> @vmbot show load graph for prod-db-01.
vmbot> <link for load graph>
user 1> ah yes, I know what that is. Thanks for pointing that out.
```
# Account Management
## Change Billing
```
user 2> @vmbot I need to update our billing information.
vmbot> No problem! You can update the info here: https://vmf.io/cds32190v
```
## Billing Info
```
user 1> @vmbot what is our current billing method.
vmbot> You're currently paying with a Visa card ending in 4562.
```
```
user 2> What is our current address?
vmbot> We have the following on file:
123 Street Road.
Toronto, Ontario
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment