We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Migrating from old server to new server | Forum

Topic location: Forum home » Support » General Questions
mahmood
mahmood Sep 8 '18

Hi. I am trying to migrate an Oxwall powered website from one server to another. The specifications are




OLD (ubuntu):

$ mysql -V

mysql  Ver 14.14 Distrib 5.5.60, for debian-linux-gnu (x86_64) using readline 6.3

$ mysqldump -p mdb > ~/mdb.sql

$ scp mdb.sql newserver:/home/user



NEW (Centos):

# mysql -V

mysql  Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1

# mysql -u root -p mdb < /home/user/mdb.sql


Problem is that, after importing that, I am not able to login with previous users. I mean I had an account of the old server, but I am not able to use that in the new server.


Is that normal? Some questions are


1) Should I create the same user names on the servers? Currently they are mahmood@oldserver and snadmin@newserver.


2) During the installation of the social network and in the web installation phase, I provide an admin user which controls the database. Is it important to use exactly the same name in two servers?



Any comment is appreciated. I really need to migrate the website.

AppXprt
AppXprt Sep 8 '18
The actual root/admin user accessing the database doesn't necessarily matter as long as you have the correct credentials set in you ow config and it is able to access the DB assuming it is the correct DB admin account. The usernames should be accessible from old to new, but I'm not sure what would happen if you tried creating the same user on the new that already existed in the old. I would imagine it wouldn't let you, but I guess there is a possibility of it overwriting your password? I've done this before, but it's been a while and I don't remember having too many issues. As long as ow can access db and you imported the entire db then your user logins should work I believe, but is there any more info you might be able to provide?
The Forum post is edited by AppXprt Sep 8 '18
mahmood
mahmood Sep 8 '18

Let me state in other words.


OLD server:

That is an Ubuntu machine with two user accounts: root and mahmood. As root, I ran


mysql> CREATE DATABASE mdb;

mysql> GRANT ALL PRIVILEGES ON mdb.* TO 'mahmood'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

mysql> FLUSH PRIVILEGES;


During the installation of the website, I created a master account as the administrator with

user: poweruser

pass: something


I also introduced the mdb with the owner mahmood@localhost to the website. Now, and after some months with dozens of users, I have exported the database with the following command


$ mysqldump -p mdb > ~/mdb.sql





NEW server:

Now this is a Centos machine with two user accounts: root and snadmin

As root, I ran

mysql> CREATE DATABASE mdb2;

mysql> GRANT ALL PRIVILEGES ON mdb2.* TO 'snadmin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

mysql> FLUSH PRIVILEGES;


As you can see this is an empty database. Next, during the installation of the website I created a master account (owner of the website) with

user: snadmin

pass: something


I also introduced the *empty* mdb2 with the owner snadmin@localhost to the website. After the installation I am now able to login to the website with snadmin/something and this is the only user in the social network!

Everything looks good... I now want to import the mdb from the old server. This is the command I use


# mysql -u root -p mdb2 < /home/user/mdb.sql


The command doesn't return any error.
Now... after a window refresh, I see the login page and I am not able to login with either

snadmin/something

or

poweruser/something



Is there any way to increase the verbosity of mysql or ow to see what happens when I enter the user names?

The Forum post is edited by mahmood Sep 8 '18
AppXprt
AppXprt Sep 8 '18
No output when importing DB is normal and your DB is uploaded or you would have seen issues. You overwrote the database so everything is from the old database. I remember some of the issues I had now were from initialized values that get set during install not being present in the new setup's config. Compare the config files in ow_includes of each server against each other to see what I mean. 

OW Debugging from Dave:

Oxwall Debugging


Probably seed value for password hashing

The Forum post is edited by AppXprt Sep 8 '18
AppXprt
AppXprt Sep 8 '18
ow_includes/config.php:

define('OW_PASSWORD_SALT'


Make sure your Password Salt is the same as the old server for the new server.

DO NOT paste it here

The Forum post is edited by AppXprt Sep 8 '18
mahmood
mahmood Sep 9 '18

The OLD server is

define('OW_PASSWORD_SALT',


The NEW server is

define('OW_PASSWORD_PEPPER', 


I used the old config in the new server and I am now able to login with the old username. One step forward.


After login, I don't see the web frame and theme. Although I have downloaded the them in ow_themes/ but I see many warnings and errors. I don't know if any difference in the theme version can cause such issue.



OW Debug - Warning
Message:     Can't generate URI! Route `questions-index` not found!
File:     /var/www/html/test/ow_core/router.php
Line:     236




OW Debug - Error
Message:     Can't Render url using smarty!. ReflectionException: Class IISSUGGESTFRIEND_CMP_UserIisSuggestFriendWidget does not exist in /var/www/html/test/ow_system_plugins/base/components/drag_and_drop_item.php:208 Stack trace: #0 /var/www/html/test/ow_system_plugins/base/components/drag_and_drop_item.php(208): ReflectionClass->__construct('IISSUGGESTFRIEN...') #1 /var/www/html/test/ow_system_plugins/base/components/drag_and_drop_item.php(92): BASE_CMP_DragAndDropItem->checkComponent('IISSUGGESTFRIEN...') #2 /var/www/html/test/ow_system_plugins/base/components/drag_and_drop_frontend_panel.php(113): BASE_CMP_DragAndDropItem->setContentComponentClass('IISSUGGESTFRIEN...') #3 /var/www/html/test/ow_smarty/template_c/cbe755aae9055df41a3fcd7d3879f82c786c360b_0.file.drag_and_drop_entity_panel.html.php(145): BASE_CMP_DragAndDropFrontendPanel->tplComponent(Array, Object(Smarty_Internal_Template)) #4 /var/www/html/test/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(128): content_5b94bceb118786_49143555(Object(Smarty_Internal_Template)) #5 /var/www/html/test/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(172): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #6 /var/www/html/test/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(206): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template)) #7 /var/www/html/test/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(216): Smarty_Internal_Template->render(false, 0) #8 /var/www/html/test/ow_libraries/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(107): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, NULL, NULL, 0) #9 /var/www/html/test/ow_core/view_renderer.php(82): Smarty_Internal_TemplateBase->fetch('/var/www/html/t...') #10 /var/www/html/test/ow_core/view.php(187): OW_ViewRenderer->renderTemplate('/var/www/html/t...') #11 /var/www/html/test/ow_core/component.php(80): OW_View->render() #12 /var/www/html/test/ow_system_plugins/base/controllers/component_panel.php(156): OW_Component->render() #13 /var/www/html/test/ow_system_plugins/base/controllers/component_panel.php(182): BASE_CTRL_ComponentPanel->action('dashboard', 1, false, Array, 'drag_and_drop_e...') #14 [internal function]: BASE_CTRL_ComponentPanel->dashboard(Array) #15 /var/www/html/test/ow_core/request_handler.php(250): ReflectionMethod->invokeArgs(Object(BASE_CTRL_ComponentPanel), Array) #16 /var/www/html/test/ow_core/request_handler.php(226): OW_RequestHandler->processControllerAction(Object(ReflectionMethod), Object(BASE_CTRL_ComponentPanel)) #17 /var/www/html/test/ow_core/application.php(346): OW_RequestHandler->dispatch() #18 /var/www/html/test/index.php(79): OW_Application->handleRequest() #19 {main}
File:     /var/www/html/test/ow_core/view_renderer.php
Line:     84







AppXprt
AppXprt Sep 9 '18
Looks like you may be missing some plugins on the new server?
mahmood
mahmood Sep 10 '18

OK. After some days, I think the following approach is overwhelming:

Install a new oxwall website and migrate from a previous installation



What I decided to do is to completely move the old website to the new server. In this case, I ran scp command to transfer all files in /var/www/html to the new server and I also moved the database to the new server.


While the  logic seems to be fine, after entering the new URL, I see the following error


OW Debug - Error

Message:     Can't Render url using smarty!. --> Smarty: unable to write file /var/www/html/ow_smarty/template_c/wrt5b960682616e98_12321394 <--

File:     /var/www/html/ow_core/view_renderer.php

Line:     84



Thing is that when I refresh the page, I see that the number of the folder changes.


OW Debug - Error

Message:     Can't Render url using smarty!. --> Smarty: unable to write file /var/www/html/ow_smarty/template_c/wrt5b96068dd4b979_72350531 <--

File:     /var/www/html/ow_core/view_renderer.php

Line:     84




I wonder why that happens because the write permission is granted to the apache user. In Centos, the user:group is apache:apache while in Ubuntu it is www-data:www-data



# ls -l ow_smarty/
total 4
drwxrwxr-x. 2 apache apache 4096 Sep  9 20:36 plugin
drwxrwxrwx. 2 apache apache    6 Sep 10 10:21 template_c




Any idea?

dave Leader
dave Sep 10 '18
Regardless where you are moving your site it is really very very easy, i have moved mine many times.  This is assuming you have already set up your domain name and all that on the new server. 


1. Whatever dir your oxwall install is in, make a zip file of that dir.  Example if your oxwall is installed in the public_html then zip up the public_html, if your oxwall is in a sub dir then zip up that sub dir folder. (remember you will be getting everything in that dir so if you have other subs you will get them too). 

Download that zip and save it. 


2. Export your database.  Go to phpMyAdmin and select the database for your oxwall install on the list.  Then click export (at the top).     A new page will load and you can just go with the default value - this will export all data and all structure of the database..  


   2a.  Just so you have it - do another export this time choose custom option.  And export just the structure. Just scroll down that page and you will see options for structure and data... choose structure..   This will export all the table names and fields without data. 


   2b.  Now do another export and this time choose data from that option. This will export all the data that goes into each table but without the tables.  


   2a and 2b you will not need any further for this process but save them.


Both of these options come in handy when restoring a database but we wont go into how to do that because that is another lesson.


3. Upload your zip file - You dont even have to run install on the new server. Just upload your files  into public_html (if that is where they were last time) if you dont have one, or if there is already a public_html you can either delete that (or rename it) and then unzip your file in there. If your oxwall install came from a sub then unpack it there. The point here is that you want to put your files into the same place they were on the old server. 


4. Creat your new database, call it the same as your old database and give it the same login credentials with the same user as before. 


5. import the first export you did - the one with the structure and data, the complete one. Just go to phpMyAdmin and click on the database name you want to import to.. Then click on import (at the top), choose the file name from your computer (make sure its the complete version - NOT the separate data and structure you made after) 


6.  Clear your site cache. 


7. Enter the Domain into the url and BAM DONE!


hope that helps... 


Now yes there are some cases where you might want to run the install, but i never have in a long time.  I just move the site image from one place to the other and bam.. done.. 


Remember it does not matter where your site is, as long as the db info is the same and the config url, dbinfo, and salt, are the same it will run.  As long as your system still meets the requirements. 


Important - if you are changing the domain name then that is much more difficult because all the newsfeed items in the database are hard coded for the old domain.  So none of those will load and it will bomb on you. Yes i know it was not smart for oxwall to do it that way using static url on data.   


But anyway your only hope in that case is one of these: 


   A. Go through the database using either phpMyAdmin search and replace. 


   B.  Exporting the database and doing a programers notepad search and replace every single occurance of the old url. Then dumping all the db tables and reimport the new edited file. 


    C.  Creating either a php file or a manual sql in phpMyAdmin to search and replace every occurance of the old url. 


One final thing folks... remember if you download database files you are in fact "keeping peoples data" so store it securely and remember that privacy is becoming more and more a critical issue so NEVER just toss those in the trash can or leave them (on disk or not) laying around.  You are responsible for protecting peoples privacy... 


dave :)

The Forum post is edited by dave Sep 10 '18
mahmood
mahmood Sep 12 '18

Hi,


So, I compressed the old web site in /var/www/html and then used scp to transfer the the site to the new server. I also exported the database and imported that in the new server.


After modifying ow_include/config.php to point to the new URL, I was able to login with my credentials, as the admin (user id 1).



The new problem is the email notifications!

As I go to the management panel and test the SMTP account, everything is perfect. I don't get any phpmailer error.


However, when I post to a group, the email notification is not send to the users and that is really bad.


Any way to debug more?


dave Leader
dave Sep 12 '18
is your cron running...    so after you cause an email to be created check the ow_base_mail table (i think thats the right name)   the email will sit there until cron processes it, then it will dissappear... 


It may only be there for a moment in that table... so what you can do is pull up the table browse on your screen for that table...  then on your site create the email..  then keep refreshing the browse on the table until you see an email come and go...


If you see the email and it just sits there forever, then your cron has issues and its not running. 

mahmood
mahmood Sep 13 '18

Thank you very much. Since the new server is Centos, I want to know who should run the cron job? root? normal user? apache?


In the old server which was Ubuntu, www-data run the cron job.

dave Leader
dave Sep 13 '18
php -q /home/xxxxx/public_html/xxxxxx/ow_cron/cron.php


how are you serving up your php.... whats your api ?    CGI/FastCGI  



The Forum post is edited by dave Sep 13 '18
mahmood
mahmood Sep 14 '18

> whats your api ?    CGI/FastCGI 


Really don't know!

dave Leader
dave Sep 14 '18
Run a phpinfo report, it will tell you near the top section of the report.. here is how


https://developers.oxwall.com/forum/topic/47677



  

mahmood
mahmood Sep 14 '18

Please see the output below. There no word about cgi



The Forum post is edited by mahmood Sep 14 '18
dave Leader
dave Sep 14 '18
ok please edit and removed that, its too dangerious to have it up there... 


ok your API is showing 


Server API => Command Line Interface


Oh so your not using a panel at all.. just the command line  


I dont do the whole command line interace deal, so i have no clue how to run or schedule cron that way. 


The Forum post is edited by dave Sep 14 '18
mahmood
mahmood Sep 14 '18

So, what is your recommendation? What is that panel? I some times use php for some small projects.

Not a PHP expert.

dave Leader
dave Sep 14 '18
Well we know you need to start cron so lets start there, help me search and lets find out how to setup and start cron from the command line, that is our next challenge. 


Just fyi, a panel is a server panel user interface that pretty much takes all the command lines and puts them into a script so that you dont have to know bash, you can just push buttons.  example is cPanel  and there are free open source panels as well like webmin

The Forum post is edited by dave Sep 14 '18
mahmood
mahmood Sep 15 '18

What is the need for MAILTO?

I already have setup the SMTP in the Oxwall admin panel.

Pages: 1 2 »