# Contributor Interviews – Jay Pfaffman

**URL:** <https://meta.discourse.org/t/contributor-interviews-jay-pfaffman/77504>\
**Category:** Site feedback\
**Tags:** contributor-interviews\
**Created:** [8 Gennaio 2018, 7:38pm UTC](https://meta.discourse.org/t/contributor-interviews-jay-pfaffman/77504 "2018-01-08T19:38:12Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [17 Gennaio 2018, 12:28am UTC](https://meta.discourse.org/t/contributor-interviews-jay-pfaffman/77504/14 "2018-01-17T00:28:39Z")

</div>

> [@cpradio](#):
>
> One of these days I’d love to hear more about your automation process

Well, ~~I don’t have the time to write up what I think you’re asking for, but~~ here’s what happens. When an order is placed, I get an email that has something like this:

```bash
export NAME="Pat Doe"
export EMAIL="user@gmail.com"
export DO_HOSTNAME="forum.mysite.com"
export DO_API_KEY="thediscoursekey"
export MG_API_KEY="key-mailgunkey"
cd ~/src/discourse-installer
irb
load 'do-create-droplet'
d=DOManager.new
d.do_create_droplet("forum.mysite.com", 'nyc3', '1gb')
sleep 45
d.install_discourse

```

I copy and paste that into a shell. I don’t just have that in a single shell script, because if something goes wrong, I can do some stuff in my little Ruby class to fix it up.

`do_create_droplet`, as the name implies, creates the droplet, and adds those DNS records to the Digital Ocean DNS. If the client uses Digital Ocean as their DNS provider, all of the DNS stuff (including what Mailgun requires) happens automatically, and https gets enabled and the Mailgun domain gets verified. This isn’t advertised because I’m afraid that someone will break all their sites changing to DO’s name servers. For sites that I set up for myself, the whole thing is entirely automated.

`install_discourse` does what you might guess, but it also uses the Mailgun API to create the domain and get the SMTP user and password to generate an install script that

- installs docker
- does an apt upgrade
- sets a root password
- enables automatic upgrades with automatic reboot
- turns off `transparent_hugepage`
- installs git
- installs Digital Ocean’s monitoring stuff
- runs `discourse-setup`, piping in all the values as if someone had typed them.
- reboots

The script is copied to the server and then run.

When it’s done, an email is generated with all of the DNS stuff that mailgun wants and puts it in a table with instructions that most people can follow.

The DNS settings table includes links to test the settings with G Suite Toolbox; there is also an API URL that allows the logs to be checked without logging in to Mailgun. If they do have trouble, I can generally figure out what the problem is with only what’s in the email they get.

If something goes wrong during the install, my ruby class also allows stuff like delete the droplet and start over. I also have functions to do things like:

- discourse\_to\_8080(hostname = @hostname)
- manager\_install\_apache
- install\_mysql(\_server\_ip = do\_server\_ip, lc\_user = @lc\_user)
- create\_user(\_server\_ip = do\_server\_ip, user = @lc\_user)
- install\_wordpress\_domain(hostname, \_database, \_server\_ip = do\_server\_ip)

A feature I just added that I’m happy about is that I start monitoring the site with uptimerobot. This way I get a notification once they set up DNS and I can follow up if there’s some need to do so.

One day, Real Soon Now, I’ll finish the rails app that will let this stuff happen without my intervention.

---

_[View the full topic](https://meta.discourse.org/t/contributor-interviews-jay-pfaffman/77504)._
