Skip to content

Install Tracks 2.5.1 on Ubuntu 20.04 LTS on AWS with SSL support

Jyri-Petteri Paloposki edited this page Nov 15, 2021 · 4 revisions

Installing Tracks 2.5.1 on a clean server (Ubuntu 20.04 LTS) running on Amazon Web Services with a Let's encrypt SSL certificate for a secure HTTPS access.

Install all required dependencies

$ sudo apt-get install git nano wget ruby ruby-dev build-essential libsqlite3-dev shared-mime-info -y

This command has also installed a default bundler but we have to replace it with a newer version due to a bug in the package served with Ubuntu.

$ bundler2.7 --version
Bundler version 2.1.2

Install a newer version

$ sudo gem install bundler
Fetching bundler-2.2.25.gem

So now we have a newer version installed

$ bundle --version
Bundler version 2.2.25

Download tracks

$ wget https://github.com/TracksApp/tracks/archive/v2.5.1.zip
$ unzip v2.5.1.zip
$ cd tracks-2.5.1/
$ rm Gemfile.lock

Edit Gemfile, I'm using nano

$ nano Gemfile
$ cp config/database.yml.tmpl config/database.yml
$ nano config/database.yml

Change to use sqlite backend

production:
#  adapter: mysql2
# database: tracks
  # set this if you are storing utf8 in your mysql database to handle strings
  # like "Réné".Not needed for sqlite. For PostgreSQL use encoding: unicode
  # encoding: utf8
#  host: localhost
#  username: root
#  password:

# The following is an example to configure Tracks to use sqlite

#production:
  adapter: sqlite3
  database: db/tracks-20-blank.sqlite3.db
  pool: 5
  timeout: 5000

Temporary fix

As long as https://github.com/TracksApp/tracks/issues/2630 is not fixed, you have to add

gem "mini_racer"

at the end of the Gemfile, such as here

https://github.com/TracksApp/tracks/pull/2632/commits/67d8da45a36d3e2bb41b378c6324258868975014

Configuration

$ cp config/site.yml.tmpl config/site.yml
$ nano config/site.yml

Change change-me in secret_token to some random value. Then compile packages (takes some time).

Install using bundler

We will be installing all Ruby packages into this local folder for not messing up with other possible system-wider libraries

$ bundle config set --local path 'vendor/bundle'
$ export RAILS_SERVE_STATIC_FILES=true
$ bundle install --without=mysql --without=postgresql # Edit per your needs

Compile static assets

$ bundle exec rake assets:precompile RAILS_ENV=production

I have the following script for launching Tracks properly with SSL:

#!/bin/sh
export RAILS_SERVE_STATIC_FILES=true
bundle exec puma -e production -b 'ssl://0.0.0.0:3000?key=/etc/letsencrypt/live/myserver.com/privkey.pem&cert=/etc/letsencrypt/live/myserver.com/cert.pem'
Clone this wiki locally