From 0a984e90d3052272bf793cb4393b9d642432aebb Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 13:45:03 +0200
Subject: [PATCH 1/6] Add scalingo support

---
 .buildpacks   |  2 ++
 scalingo.json | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 .buildpacks
 create mode 100644 scalingo.json

diff --git a/.buildpacks b/.buildpacks
new file mode 100644
index 000000000..29d7ee1e9
--- /dev/null
+++ b/.buildpacks
@@ -0,0 +1,2 @@
+https://github.com/Scalingo/ruby-buildpack
+https://github.com/Scalingo/nodejs-buildpack
diff --git a/scalingo.json b/scalingo.json
new file mode 100644
index 000000000..84b690e24
--- /dev/null
+++ b/scalingo.json
@@ -0,0 +1,87 @@
+{
+  "name": "Mastodon",
+  "description": "A GNU Social-compatible microblogging server",
+  "repository": "https://github.com/johnsudaar/mastodon",
+  "logo": "https://github.com/tootsuite/mastodon/raw/master/app/assets/images/logo.png",
+  "env": {
+    "LOCAL_DOMAIN": {
+      "description": "The domain that your Mastodon instance will run on (this can be appname.scalingo.io or a custom domain)",
+      "required": true
+    },
+    "LOCAL_HTTPS": {
+      "description": "Will your domain support HTTPS? (Automatic for *.scalingo.io, requires manual configuration for custom domains)",
+      "value": "true",
+      "required": true
+    },
+    "PAPERCLIP_SECRET": {
+      "description": "The secret key for storing media files",
+      "generator": "secret"
+    },
+    "SECRET_KEY_BASE": {
+      "description": "The secret key base",
+      "generator": "secret"
+    },
+    "SINGLE_USER_MODE": {
+      "description": "Should the instance run in single user mode? (Disable registrations, redirect to front page)",
+      "value": "false",
+      "required": true
+    },
+    "S3_ENABLED": {
+      "description": "Should Mastodon use Amazon S3 for storage? This is highly recommended, as Scalingo does not have persistent file storage (files will be lost).",
+      "value": "true",
+      "required": false
+    },
+    "S3_BUCKET": {
+      "description": "Amazon S3 Bucket",
+      "required": false
+    },
+    "S3_REGION": {
+      "description": "Amazon S3 region that the bucket is located in",
+      "required": false
+    },
+    "AWS_ACCESS_KEY_ID": {
+      "description": "Amazon S3 Access Key",
+      "required": false
+    },
+    "AWS_SECRET_ACCESS_KEY": {
+      "description": "Amazon S3 Secret Key",
+      "required": false
+    },
+    "SMTP_SERVER": {
+      "description": "Hostname for SMTP server, if you want to enable email",
+      "required": false
+    },
+    "SMTP_PORT": {
+      "description": "Port for SMTP server",
+      "required": false
+    },
+    "SMTP_LOGIN": {
+      "description": "Username for SMTP server",
+      "required": false
+    },
+    "SMTP_PASSWORD": {
+      "description": "Password for SMTP server",
+      "required": false
+    },
+    "SMTP_DOMAIN": {
+      "description": "Domain for SMTP server. Will default to instance domain if blank.",
+      "required": false
+    },
+    "SMTP_FROM_ADDRESS": {
+      "description": "Address to send emails from",
+      "required": false
+    },
+    "BUILDPACK_URL": {
+      "description": "Internal scalingo configuration",
+      "required": true,
+      "value": "https://github.com/Scalingo/multi-buildpack.git"
+    }
+  },
+  "scripts": {
+    "postdeploy": "bundle exec rails db:migrate && bundle exec rails db:seed"
+  },
+  "addons": [
+    "scalingo-postgresql",
+    "scalingo-redis"
+  ]
+}

From 79765d61f506e8e7dd08b683ebfdaabfba12b1fe Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 13:53:30 +0200
Subject: [PATCH 2/6] Install nodejs before ruby

---
 .buildpacks | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.buildpacks b/.buildpacks
index 29d7ee1e9..d295b0f5d 100644
--- a/.buildpacks
+++ b/.buildpacks
@@ -1,2 +1,2 @@
-https://github.com/Scalingo/ruby-buildpack
 https://github.com/Scalingo/nodejs-buildpack
+https://github.com/Scalingo/ruby-buildpack

From bf523fcd16cb7d4ffd81424d3d582e4dfab158b6 Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 14:13:34 +0200
Subject: [PATCH 3/6] Add node_modules and .cache to slugignore

---
 .slugignore | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 .slugignore

diff --git a/.slugignore b/.slugignore
new file mode 100644
index 000000000..cbf0615e7
--- /dev/null
+++ b/.slugignore
@@ -0,0 +1,2 @@
+node_modules/
+.cache/

From 152a1e578c46068dfac2888620798073d3d305b8 Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 15:26:36 +0200
Subject: [PATCH 4/6] Add Scalingo one click on readme

---
 README.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/README.md b/README.md
index 20499e6e3..3827a74ab 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,10 @@ Which will re-create the updated containers, leaving databases and data as is. D
 
 Docker is great for quickly trying out software, but it has its drawbacks too. If you prefer to run Mastodon without using Docker, refer to the [production guide](docs/Running-Mastodon/Production-guide.md) for examples, configuration and instructions.
 
+## Deployment on Scalingo
+
+[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/johnsudaar/mastodon#master)
+
 ## Deployment on Heroku (experimental)
 
 [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

From 5e7ec0fe573f11d9c853981ac0ae57a8b27cf9ce Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 15:52:06 +0200
Subject: [PATCH 5/6] Use root repository url

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 3827a74ab..fde4df6bb 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ Docker is great for quickly trying out software, but it has its drawbacks too. I
 
 ## Deployment on Scalingo
 
-[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/johnsudaar/mastodon#master)
+[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master)
 
 ## Deployment on Heroku (experimental)
 

From d6bab0c71cd94bff4f775b79a55493b6e02215a0 Mon Sep 17 00:00:00 2001
From: Jonathan Hurter <john@scalingo.com>
Date: Wed, 5 Apr 2017 16:00:48 +0200
Subject: [PATCH 6/6] Add doc

---
 README.md                               |  2 ++
 docs/Running-Mastodon/Scalingo-guide.md | 13 +++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 docs/Running-Mastodon/Scalingo-guide.md

diff --git a/README.md b/README.md
index fde4df6bb..db60b66f7 100644
--- a/README.md
+++ b/README.md
@@ -121,6 +121,8 @@ Docker is great for quickly trying out software, but it has its drawbacks too. I
 
 [![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master)
 
+[You can view a guide for deployment on Scalingo here.](docs/Running-Mastodon/Scalingo-guide.md)
+
 ## Deployment on Heroku (experimental)
 
 [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
diff --git a/docs/Running-Mastodon/Scalingo-guide.md b/docs/Running-Mastodon/Scalingo-guide.md
new file mode 100644
index 000000000..6552056a8
--- /dev/null
+++ b/docs/Running-Mastodon/Scalingo-guide.md
@@ -0,0 +1,13 @@
+Scalingo guide
+==============
+
+[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master)
+
+1. Click the above button.
+2. Fill in the options requested.
+  * You can use a .scalingo.io domain, which will be simple to set up, or you can use a custom domain.
+  * You will want Amazon S3 for file storage. The only exception is for development purposes, where you may not care if files are not saved. Follow a guide online for creating a free Amazon S3 bucket and Access Key, then enter the details.
+  * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests.
+3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard.
+
+You may need to use the `scalingo` CLI application to run `USERNAME=yourUsername rails mastodon:make_admin` to make yourself an admin.