Daqinv

From DaqWiki
Jump to navigation Jump to search

Welcome

Welcome to the DAQ inventory database. Please follow links below to enter the inventory database webapp. Use username and password "inv".

Links

News

  • 2015-Aug-11 - inventory web app access restricted, use username "inv", password "inv"

Installation instructions

  • start with base SL6
  • install: yum install mod_ssl apr-devel apr-util-devel httpd-devel
  • install ruby gems packaging system: yum install rubygems ruby-devel
  • install ruby on rails:
    • gem install rails -v '2.3.5'
    • gem install fastthread
    • gem install mysql
    • gem install passenger -v4.0.59 ### or -v4.0.8 as on ladd00
    • gem install rdoc
  • install passenger_mod (apache httpd module)
    • find passenger location (look under "Installed at"): gem list -d passenger
    • cd /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8
    • ./bin/passenger-install-apache2-module
    • say "yes" to all prompts, at the end the script will print information similar to that below:
   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8
   PassengerDefaultRuby /usr/bin/ruby
  • configure apache
    • cd /etc/httpd/conf.d
    • edit daqinv.conf to read: (the LoadModule, etc lines are copied from the output of passenger-install-apache2-module above)
# config file for DAQ inventory "ruby on rails" app 
 
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so 
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8 
PassengerDefaultRuby /usr/bin/ruby 
 
PassengerLogLevel 0 
 
PassengerDefaultUser daqinv 
 
RailsBaseURI /daqinv

<Location /daqinv> 
        SSLRequireSSL 
</Location> 
 
#end 
  • ln -s /home/daqinv/inventory2/public /var/www/html/daqinv
  • create crontab for mysql backups and old session cleanup: /etc/cron.d/daqinv.cron
# daqinv.cron cron job for daq inventory system periodic activity
#11 * * * * root wget --spider localhost:3000/config/trigger
#11 2 * * * root wget --spider --no-check-certificate https://localhost:3001/config/trigger >& /dev/null
11 2 * * * root cd /var/tmp; wget --spider --no-check-certificate https://ladd00/daqinv/config/trigger   >& /dev/null
10 1 * * * root find /home/daqinv/inventory2/tmp/sessions -mtime +8 -exec /bin/rm -vf {} \; >& /dev/null

php update & etc

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
~yum remove php-common
~yum install "php56w*" --exclude "php56w-conflicting"
https://daq03.triumf.ca/~bcitinv/public/index.php?token=JDVJKUYCMTUQWCQ
https://daq03.triumf.ca/~bcitinv/inventory3/public/index.php/home
https://ladd00.triumf.ca/~daqinv/inventory3/public/index.php/home

migrate inventory3 to daq00 ubuntu

apt install php-pear ### install pecl
apt install php7.4-dev ### install phpize
apt install mcrypt libmcrypt-dev
pecl install mcrypt
xemacs -nw /etc/php/7.4/apache2/php.ini ### add "extension=mcrypt.so"
systemctl restart apache2
ssh daqinv@ladd00
mysqldump -h localhost -u daqinv -p daqinv > backup.sql
ssh root@daq00
mysql -p
MariaDB [(none)]> CREATE DATABASE daqinv;
MariaDB [(none)]> CREATE USER 'daqinv'@'localhost' IDENTIFIED BY '123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON daqinv.* TO 'daqinv'@'localhost' WITH GRANT OPTION;
ssh daqinv@daq00
mysql -udaqinv -p daqinv < backup.sql

migrate inventory2 from ladd00 to daq00

  • mkdir inventory2_ubuntu, cd there, rsync -av ../inventory2/ .
  • ln -s /home/daqinv/inventory2_buntu/public /var/www/html/daqinv
  • add password protection:
  • xemacs -nw /etc/apache2/sites-enabled/daq00-ssl.conf
  • apt install ruby-dev
  • apt install apache2-dev
  • gem install rails -v '2.3.5'
  • gem install rdoc
  • gem install fastthread ### bombs!
  • gem install mysql ### bombs!
  • gem install mysql2 ### success
  • gem install passenger -v4.0.59
  • gem list -d passenger ### note location of gems
  • cd /var/lib/gems/2.7.0/gems/passenger-4.0.59/
  • ./bin/passenger-install-apache2-module ### accept all default answers, at the end it prints:
   LoadModule passenger_module /var/lib/gems/2.7.0/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /var/lib/gems/2.7.0/gems/passenger-4.0.59
     PassengerDefaultRuby /usr/bin/ruby2.7
   </IfModule>
  • also prints this:
<VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
         # Uncomment this if you're on Apache >= 2.4:
         #Require all granted
      </Directory>
   </VirtualHost>
  • xemacs -nw /etc/apache2/sites-enabled/daq00-ssl.conf ### add following to front of file:
   LoadModule passenger_module /var/lib/gems/2.7.0/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so 
   <IfModule mod_passenger.c> 
     PassengerRoot /var/lib/gems/2.7.0/gems/passenger-4.0.59 
     PassengerDefaultRuby /usr/bin/ruby2.7 
     PassengerLogLevel 0  
     PassengerDefaultUser daqinv  
     RailsBaseURI /daqinv 
   </IfModule> 
  • systemctl restart apache2
  • try https://daq00.triumf.ca/daqinv/frontend, get syntax errors in inflector.rb
  • fix many ruby errors
  • copy ladd00 /usr/lib/ruby/1.8/xsd, soap, parsedate.rb, date/format.rb
  • loads, but gives error 500, ruby exceptions in /var/log/apache2
  • tweak, now, still error 500, but nothing in /var/log/apache2...