Skip to content

Heroku Setup

Robert Konigsberg edited this page Feb 14, 2023 · 14 revisions

NOTE As of 2022-11-28, Heroku no longer has a free tier. However, it is still our recommended way to deploy, as those are our clearest instructions.

To install and run

  1. Install git on Terminal
  2. Sign up for a free Heroku account
  3. Install Heroku CLI on your Terminal
  4. cd to the location where you want to put the TM web app folder
  5. git clone https://github.com/bafolts/terraforming-mars.git
  6. cd terraforming-mars
  7. heroku login
  8. Enter your Heroku credentials
  9. heroku create [app name] ([app name] is whatever you want to call your server. The server will eventually be [app name].herokuapp.com, and the git repo will be https://git.heroku.com/[app name].git.)
  10. git remote add heroku https://git.heroku.com/[app name].git
  11. git push heroku main. If you want to push from another branch, for example, dev, use dev:main ref

To update

  1. cd to the root directory of the terraforming-mars repo.
  2. git pull origin main
  3. git push heroku main (or dev:main)

To customize your server

Edit the dot env file to customize your server such as how many days to keep unfinished games before deleting them.

To set up a database for game seeds

The free Heroku server falls asleep after 20-30 minutes of inactivity. You can set up a database to contain seeds from previously played games. Without setting this up, the seeds will be wiped after Heroku server goes to sleep. This instruction is from 13and3.

  1. Go to your Heroku dashboard
  2. Click on your TM server app
  3. Configure Add-ons
  4. In the add-ons search box, type "Heroku Postgres" and select it. Plan name: [Hobby Dev - Free]. Provision to add it to the server.
  5. Go to Settings
  6. Reveal Config Vars
  7. Copy the text postgres://... from the text field next to DATABASE_URL to the one below next to POSTGRES_HOST.

Screenshots:

Click "Configure Add-ons" from the Heroku app running your TM server

https://imgur.com/a/zKJgNHO

Search for and select Heroku Postgres

https://imgur.com/a/zKJgNHO

Go to Settings of your app

https://imgur.com/a/zKJgNHO

Click "Reveal Config Vars"

https://imgur.com/a/zKJgNHO

Copy the line next to DATABASE URL to the line below next POSTGRES_HOST

https://imgur.com/a/zKJgNHO

Clone this wiki locally