Daqinv: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
 
(38 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Welcome =
Welcome to the DAQ inventory database. Please follow links below to enter the inventory database webapp. Use username and password "inv".
= Links =
= Links =


* https://ladd01.triumf.ca/daqinv
* https://ladd00.triumf.ca/daqinv
* https://ladd00.triumf.ca/~daqinv/inventory3/public/index.php/home
 
= News =
 
* 2015-Aug-11 - inventory web app access restricted, use username "inv", password "inv"


= Installation instructions =
= Installation instructions =


* start with base SL6
* 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 gems packaging system: yum install rubygems ruby-devel
* install ruby on rails:
* install ruby on rails:
Line 11: Line 21:
** gem install fastthread
** gem install fastthread
** gem install mysql
** gem install mysql
** gem install passenger
** gem install passenger -v4.0.59 ### or -v4.0.8 as on ladd00
** gem install rdoc
** gem install rdoc
* install passenger_mod (apache httpd module)
* 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
** cd /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8
** ./bin/passenger-install-apache2-module
** ./bin/passenger-install-apache2-module
Line 22: Line 33:
   PassengerDefaultRuby /usr/bin/ruby
   PassengerDefaultRuby /usr/bin/ruby
</pre>
</pre>
* 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)
<pre>
# 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
</pre>
* ln -s /home/daqinv/inventory2/public /var/www/html/daqinv
* create crontab for mysql backups and old session cleanup: /etc/cron.d/daqinv.cron
<pre>
# 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
</pre>
* touch /etc/crontab
* go to https://ladd00/daqinv, everything should work
= php update & etc =
<pre>
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
~yum remove php-common
~yum install "php56w*" --exclude "php56w-conflicting"
</pre>
<pre>
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
</pre>
= migrate inventory3 to daq00 ubuntu =
* https://ladd00.triumf.ca/~daqinv/inventory3/public/index.php/home
* try https://daq00.triumf.ca/~daqinv/inventory3/public/index.php/home, "404 not found"
* ln -s ~daqinv/inventory3 /var/www/html/
* try https://daq00.triumf.ca/inventory3/public/index.php/home, "Mcrypt PHP extension required.", good
* add password protection:
* xemacs -nw /etc/apache2/sites-enabled/daq00-ssl.conf
* htpasswd -b /etc/apache2/htpasswd inv inv
* install mcrypt php extension:
<pre>
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
</pre>
* try https://daq00.triumf.ca/inventory3/public/index.php/home, "ErrorException (E_DEPRECATED) Function mcrypt_get_iv_size() is deprecated"
* xemacs -nw app/config/app.php ### add "error_reporting(error_reporting() & ~E_DEPRECATED);", see https://stackoverflow.com/questions/42515368/function-mcrypt-get-iv-size-is-deprecated-on-laravel-4/42515505
* chown www-data /home/daqinv/inventory3/app/storage/logs/laravel.log
* chown www-data /home/daqinv/inventory3/app/storage/sessions/
* try https://daq00.triumf.ca/inventory3/public/index.php/home, "SQLSTATE[HY000] [1045] Access denied for user 'daqinv'@'localhost' (using password: YES)", good we did not copy the database yet.
* copy database:
<pre>
ssh daqinv@ladd00
mysqldump -h localhost -u daqinv -p daqinv > backup.sql
</pre>
<pre>
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;
</pre>
<pre>
ssh daqinv@daq00
mysql -udaqinv -p daqinv < backup.sql
</pre>
* try https://daq00.triumf.ca/inventory3/public/index.php/home, seems to work ok.
= 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 bigdecimal
* 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:
<pre>
  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>
</pre>
* also prints this:
<pre>
<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>
</pre>
* xemacs -nw /etc/apache2/sites-enabled/daq00-ssl.conf ### add following to front of file:
<pre>
  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>
</pre>
* 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...
* run ./script/server, watch log files in ./log
= SL6 development machine for BCIT ISSP project =
usrname: inv, password: inv
* https://daq13.triumf.ca/daqinv/
* https://daq13.triumf.ca/~daqinv/inventory3/public/index.php/home

Latest revision as of 20:08, 6 May 2022

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 bigdecimal
  • 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...
  • run ./script/server, watch log files in ./log

SL6 development machine for BCIT ISSP project

usrname: inv, password: inv