Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Note

This documentation is for Release 7.0 and above. For documentation on previous releases, please select from the options below.

  • Release 1.x version of this page: v.81
  • Release 2.x version of this page: v.87.
  • Release 3.0-3.1 version of this page: v.111.
  • Release 3.2 version of this page: v.116.
  • Release 4.0 version of this page: v.143.
  • Release 5.x version of this page: v.163.
  • Release 6.0 version of this page: v.177
  • Release 6.3-6.5 version of this page: v.201

...

Code Block
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
...etc...
mysql>

Create a database for the Avalon web application and add a user to it

code
create database rails;
create user 'rails'@'localhost' identified by 'rails';
grant all privileges on rails.* to 'rails'@'localhost';
flush privileges;

Check your work and exit

Code Block
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| rails              |
| test               |
+--------------------+
5 rows in set (0.00 sec)
mysql> select user, host from mysql.user;
+--------+--------------+
| user   | host         |
+--------+--------------+
| root   | 127.0.0.1    |
|        | 129.79.32.87 |
| root   | 129.79.32.87 |
|        | localhost    |
| rails  | localhost    |
| root   | localhost    |
+--------+--------------+
7 rows in set (0.00 sec)
 
mysql> exit;
Bye

See documentation for your version of MySQL Server for detailed syntax (http://dev.mysql.com/doc/refman/5.1/en/create-database.html )

Media Streaming Server

Warning

Nginx replaces Red5 as the default streaming server since Avalon 6.3. With the upgrade to MediaElementjs 4, we now rely completely on HLS.

...

Code Block
su - root
git clone https://github.com/avalonmediasystem/avalon.git /var/www/avalon
chown avalon:avalon /var/www/avalon/public/

Configure

...

As of 6.3, Avalon is using the flexible and increasingly popular Config gem. Default settings for Avalon now live at config/settings.yml, which should not be altered. Any custom config should be placed in config/settings/<environment>.local.yml which will selectively override the default values.

Properly formatted environment variables can also override Avalon settings. For example, SETTINGS__REDIS__HOST will override

...

redis:
  host:

A list of config values can be found at Configuration Files#config/settings.yml

Warning

If using vim with default settings and pasting the the code below, it will automatically comment out the last line. To prevent that, enable paste using the command :set paste and then use just ctrl+shift+v instead of going into insert mode.

Create /var/www/avalon/config/setup_load_paths.rb and add:

Code Block
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
   begin
     gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
     ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
     require 'rvm'
     RVM.use_from_path! File.dirname(File.dirname(__FILE__))
   rescue LoadError
     raise "RVM gem is currently unavailable."
   end
 end
 # If you're not using Bundler at all, remove lines bellow
 ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
 require 'bundler/setup'

Configure database database settings
Anchor
mysql2
mysql2

...

Replace database.yml with the correct values for your production environment

Code Block
developmentproduction:
  adapter: mysql2
  host: localhost
  database: rails
  username: rails
  password: rails
  pool: 5
  timeout: 5000

...

Code Block
yum install cmake #<--will be required for rugged gem
yum install mariadb-devel
su - avalon
gem install activerecord-mysql2-adapter
gem install mysql2
vim /var/www/avalon/Gemfile

Run the bundle install

Code Block
# as root
yum install nodejs # Javascript runtime 

# as avalon
cd /var/www/avalon
gem update debugger-ruby_core_source
geminstall bundler
bundle install bundler--with bundlemysql installproduction --withwithout development mysqltest

Finish configuring Avalon

Edit /var/www/avalon/config/solr.yml and /var/www/avalon/config/blacklight.yml

Code Block
  developmentproduction:
    url: http://localhost:8983/solr/avalon

Edit /var/www/avalon/config/fedora.yml

Code Block
  developmentproduction:
    user: fedoraAdmin
    password: fedoraPassword
    url: http://127.0.0.1:8984/fedora4/rest
    base_path: ""

...

Code Block
cd /var/www/avalon
export RAILS_ENV=production
rake secret

 grab grab the output of rake secret and add it to secrets.yml where instructed.

...

Code Block
# as avalon user
cd /var/www/avalon
rake db:create

If you get an error message saying that you can't connect to the database, take a look at this post and follow some of the troubleshooting steps.

...

Code Block
rake db:migrate

Set rails environment to developmentproduction, if it has not defaulted to this. On the first line of /var/www/avalon/config/environment.rb make sure it says 'developmentproduction'

Code Block
ENV['RAILS_ENV'] ||= 'developmentproduction'

Sidekiq

Avalon uses Sidekiq for background processing, which relies on Redis as its key-value store.

Install Redis

Code Block
yum install redis

Start Resque

Code Block
# as avalon (replace production with development if necessary)
cd /var/www/avalon/
RAILS_ENV=production sidekiq -d -C config/sidekiq.yml

Sidekiq logs to log/sidekiq.log in the avalon directory. 

...

 redis

Install Sidekiq

Code Block
# as root
wget https://raw.githubusercontent.com/mperham/sidekiq/master/examples/systemd/sidekiq.service -O /lib/systemd/system/sidekiq.service

Edit the following lines in sidekiq.service 

Code Block
WorkingDirectory=/var/www/avalon
ExecStart=/bin/bash -lc '/home/avalon/.rvm/gems/ruby-2.5.7/bin/bundle exec sidekiq -e production'
User=avalon
Group=avalon


Code Block
# as root
systemctl start sidekiq

Sidekiq logs STDOUT. 

Additional Configurations

...