You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.3 KiB

  1. Heroku guide
  2. ============
  3. [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?button-url=https://github.com/tootsuite/mastodon&template=https://github.com/tootsuite/mastodon)
  4. Mastodon can be run on a free [Heroku](https://heroku.com) app. It should be
  5. noted this has limited testing and could have unpredictable results.
  6. ## Basic setup
  7. Click the button above to start creating a Heroku app with the Mastodon repo as
  8. the source. This tells Heroku to use the `app.json` file which does things like
  9. prompt for config variables, set up the right buildpacks, run a postdeploy task,
  10. and add the appropriate addons.
  11. If you don't use the deploy button and app.json approach, you will need to do
  12. some of that manually.
  13. ## Domain names and SSL
  14. You can add your domain name to the Heroku app's setting, and then also use
  15. Heroku's (free) auto renewal program for Lets Encrypt certificates, by
  16. requesting a cert from the settings screen. You'll have to point your hostname
  17. DNS at Heroku using the values heroku gives you on this screen, using whatever
  18. method is appropriate for your DNS setup.
  19. You should set the Heroku config vars of `LOCAL_DOMAIN` to your hostname, and
  20. `LOCAL_HTTPS` to "true" as well.
  21. ## Email
  22. Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans
  23. that should suit your interests. Look in `production.rb` to see which config
  24. variables need to be set on Heroku for outgoing email to work.
  25. ## File storage
  26. You will want Amazon S3 for file storage. The only exception is for development
  27. purposes, where you may not care if files are not saved. Follow a guide online
  28. for creating a free Amazon S3 bucket and Access Key, then enter the details.
  29. If you deploy from the web, the format for all the S3 bits use Paperclip conventions:
  30. S3 Bucket is just the name of the bucket, e.g. `bucketname` not the full ARN.
  31. S3 Region is the AWS code for the region e.g. `ap-northeast-1` not the name of the city displayed on the AWS Dashboard.
  32. To protect the privacy of the users of the your instance, you should have permissons on the your S3 bucket set to no-read and no-write for the public and non-application-specific AWS users, with only one authorized IAM user or group set up to be able to upload or display content. This is an example of an IAM policy used for the S3 bucket used Mastadon instance hentai.loan:
  33. {
  34. "Version": "2012-10-17",
  35. "Statement": [
  36. {
  37. "Effect": "Allow",
  38. "Action": [
  39. "s3:ListAllMyBuckets"
  40. ],
  41. "Resource": [
  42. "arn:aws:s3:::*"
  43. ]
  44. },
  45. {
  46. "Effect": "Allow",
  47. "Action": [
  48. "s3:*"
  49. ],
  50. "Resource": [
  51. "arn:aws:s3:::hentailoan”,
  52. "arn:aws:s3:::hentailoan/*"
  53. ]
  54. }
  55. ]
  56. }
  57. ## Deployment
  58. You can deploy from the Heroku web interface or from the command line. Run:
  59. `heroku run rails db:migrate`
  60. after you first deploy to set up the first database.
  61. To make yourself an admin, you may need to use the `heroku` CLI application after creating an account online:
  62. `heroku rake mastodon:make_admin USERNAME=yourUsername`