vlead / vlabs-learn-by-doing

Other
0 stars 2 forks source link

Making LbD server auto-deployable #1

Open kraghupathi opened 7 years ago

kraghupathi commented 7 years ago

Having explored moodle and mediawiki here and documentation of steps being done, a labspec of LbD is to be written and must be auto-deploy able.

kraghupathi commented 7 years ago

We prepared a labspec file and automation script for installation of moodle and mediawiki.

And also ran manually these scripts on local machine.

kraghupathi commented 7 years ago

By default the ADS service is taking ubuntu_12.04 template, but we need to run LdD server on CentOS_6.9 template.

We have changed template ubuntu-12.04 to centos-6.9 in base-config.py and centos-bridged-config.py files on ADS machine. But its giving following error.

File "src/adapters/adapter_server.py", line 34, in post (success, vm_id) = adapter_instance.create_vm(lab_spec) File "/root/ovpl/src/adapters/centos_bridged_adapter.py", line 170, in create_vm (vm_create_args, vm_set_args) = self.construct_vzctl_args(lab_spec) File "/root/ovpl/src/adapters/centos_bridged_adapter.py", line 420, in construct_vzctl_args config.supported_template) File "/root/ovpl/src/adapters/base_adapter.py", line 123, in find_os_template raise OSNotFound(msg) OSNotFound: u'OS = CENTOS is not supported'

kraghupathi commented 7 years ago

We need development team help to fix the above issue

madhavipuliraju commented 7 years ago

@kraghupathi we will look into this issue and update as soon as possible.

madhavipuliraju commented 7 years ago
kraghupathi commented 7 years ago

We prepared a script for automation of install mysql server with password . The script is available at here

kraghupathi commented 7 years ago

When we installed mysql-5.7.18 version on CentOS-6.9 will getting following error of setpriority().2017-07-07T08:20:40.555740Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!2017-07-07T08:20:40.555799Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error2017-07-07T08:20:41.156243Z 0 [ERROR] Plugin 'InnoDB' init function returned error.2017-07-07T08:20:41.156288Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.2017-07-07T08:20:41.156307Z 0 [ERROR] Failed to initialize plugins.2017-07-07T08:20:41.156323Z 0 [ERROR] Aborting2017-07-07T08:20:41.156341Z 0 [Note] Binlog end2017-07-07T08:20:41.157023Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

Its looke like mysql server has been failed

sivashankerN commented 7 years ago

@kraghupathi Refer this link https://stackoverflow.com/questions/34569373/install-mysql-community-server-5-7-via-bash-shell-script-in-centos-7-x64

In place of those commands use our mysql-community-server commands that are there in https://github.com/vlead/vlabs-learn-by-doing/blob/develop/scripts/install.sh ( Install mysql 5 section)

sivashankerN commented 7 years ago

Use the following script as it is ( But change "mysqlRootPass" password )

I tested this script and working

> #!/bin/bash

#mysqlRootPass="$(pwmake 128)"
mysqlRootPass="root123"
echo ' -> Removing previous mysql server installation'
service mysqld stop && yum remove -y mysql-community-server && rm -rf /var/lib/mysql && rm -rf /var/log/mysqld.log && rm -rf /etc/my.cnf

echo ' -> Installing mysql server (community edition)'
yum install wget -y
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
yum localinstall mysql57-community-release-el6-11.noarch.rpm -y
yum install mysql-community-server -y
service mysqld start

echo ' -> Starting mysql server (first run)'
chkconfig mysqld on
tempRootDBPass="`grep 'temporary.*root@localhost' /var/log/mysqld.log | tail -n 1 | sed 's/.*root@localhost: //'`"

echo ' -> Setting up new mysql server root password'
service mysqld stop
rm -rf /var/lib/mysql/*logfile*
wget -O /etc/my.cnf "https://my-site.com/downloads/mysql/512MB.cnf"
service mysqld start
mysqladmin -u root --password="$tempRootDBPass" password "$mysqlRootPass"
mysql -u root --password="$mysqlRootPass" -e "
    DELETE FROM mysql.user WHERE User='';
    DROP DATABASE IF EXISTS test; 
    DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'; 
    DELETE FROM mysql.user where user != 'mysql.sys'; 
    CREATE USER 'root'@'%' IDENTIFIED BY '${mysqlRootPass}';
    GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;
    FLUSH PRIVILEGES;"
#EOSQL
service mysqld status
echo " -> MySQL server installation completed, root password: $mysqlRootPass";
kraghupathi commented 7 years ago

LbD server is successfully deployed using ADS.

The following links are hosted on Base4 machine:

  1. moodle
  2. mediawiki

Next step is to copy jmoodledata and mediawiki files in above machine.

sivashankerN commented 7 years ago

Before "Next step is to copy jmoodledata and mediawiki files in above machine."

Replace the URLs https://gitlab.com/vlabs-external-projects/lbd-review-meeting/issues/5

sivashankerN commented 7 years ago

The links are actually coming from mysql database.

Replaced urls with the following steps

  1. Taken existing database( moodle database) dump
  2. Searched for "enhanceedu.iiit.ac.in" in mysql dump( backup database).
  3. Replaced "enhanceedu.iiit.ac.in" with "lbd.vlabs.ac.in"
  4. Created new database "testmoodle"( in 10.4.15.134 container)
  5. Imported dumped ( replaced urls database) into "testmoodle" database
  6. Modified config.php file so that it uses "testmoodle" database
  7. Tested the web page using http://10.4.15.134/moodle. and all urls got replaced as we expected.
kraghupathi commented 7 years ago

We tried to push moodle sources in github. But github takes only 531MB, the total size of moodle is 637MB.

Note: We pushed 637MB into github but when we clone the repository and will getting moodle size is 531MB.

kraghupathi commented 7 years ago

In the automation of LbD server will install only mediawiki and moodle without LbD (mediawiki and moodle) sources on Base4-machine because of the moodle and mediawiki size is 60GB, we cannot push 60GB in github as per above issue, so manually we can copy sources in it.