This is a complement of the installation guide Install Tracks 2.5 on Ubuntu 20.10
(after upgrading to Ubuntu 22.04 it was required to install again
>apt install default-libmysqlclient-devseems that some mysqlclient upgrade didn't upgrade the dev lib, https://github.com/TracksApp/tracks/issues/2776 )
it is not the best practice... but normally I do
>sudo -i
at the beginning to avoid all the sudos during the update
Stop Apache and MySQL service
>systemctl stop mysql.service
>systemctl stop apache2
Move Gemfile
Move the files Gemfile and Gemfile.lock out of the /var/wwww/tracks directory
Normally they are modified after the last "pull" (retrieval) of git so when you pull again git will inform a conflict due to the late modifications, so we move them to avoid the conflict.
Update the files from the repository
>cd /var/www/tracks
>git pull
Check the parameter files
compare the configuration file database.yml.tmpl with yours database.yml
compare the configuration file site.yml.tmpl with yours site.yml
Update the Ruby libraries known as ‘gems’
>cd /var/www/tracks
>bundle update
you can also use
>bundle install
Adjust owner and owner group for the downloaded files
(may be this is not needed)All the files should be owned by the user ''www-data'' which is the user that runs Apache.
To set the owner and the owner group of all the files to www-data, at /var/www execute
>chown -R www-data:www-data tracks
then you need to set the access rights, the simplest way is at /var/www execute
>chmod -R 777 tracks
later once you have all running you can correctly set
> find /var/www/tracks -type d -exec chmod 700 '{}' \;
> find /var/www/tracks -type f -exec chmod 600 '{}' \;
> find /var/www/tracks/script -type f -exec chmod 700 '{}' \;
The ''find'' and ''chmod'' commands will set permissions as ''700'' for all directories and files inside the ''script'' directory.
All other files will have permissions set to ''600''.
Start MySQL service
>systemctl start mysql.service
Update database
>cd /var/www/tracks
>bundle exec rake db:migrate RAILS_ENV=production
If you get the error : "ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime", that means that yourJavaScript runtime has lost its magic or you don't have a JavaScript runtime installed.
When we installed "libapache2-mod-passenger" it suggested to install "nodejs"; so just install (or re-install) it."
>apt install nodejs
Precompile assets
>cd /var/www/tracks
>bundle exec rake assets:precompile RAILS_ENV=production
Start Apache service
>systemctl start apache2