Indexhibit
Index + Exhibit

Login:

Created by
Daniel Eatock
Jeffery Vaska
And You

Indexhibit was updated to version 2.1.4 on April 10, 2017.

Migration from a shared server to an unmanaged server with v2

 

Indexhibit version: 2.0
Thread is not resolved.

colinklockner
UNITED STATES
8 month(s) ago
Permalink Post

I've been diving into the world of unmanaged virtual private servers over the last 3 days and think i've scoured every relevant tutorial regarding this. Indexhibit is honestly pretty good about its portability but it seems like the most common issues people forget about:

.htaccess
database settings/consistency
correctly reinstalling the framework of indexhibit in order to let the computer install adjust config.php to point to the database correctly.

I ended up writing a migration how-to for unmanaged servers since, as a novice, the increased variables made a steep learning curve. Vaska's tutorials are solid but there's a little neglect for server migrants. Keep in mind that this was written very specifically for myself, Mac OSX local, Ubuntu 16.04 server running LAMP on DigitalOcean's servers, and won't apply to you verbatim. That said, I found quite a few errors that are hard to track down answers for.


------------------------------------
Migration HOWTO for Unmanaged Server
------------------------------------
-- --- -- Indexhibit version 2 -- --- --

1. PREPARE WORK ENVIRONMENT

Change your Mac OSX platform to show invisible files. It'll save you grief throughout the process regarding .htaccess. This code is:

  1. defaults write com.apple.finder AppleShowAllFiles YES

This tutorial assumes that you are on an unmanaged server or VPS and that you have already gone through the steps of installing a LAMP stack (digitalocean.com/community/tutorials/…) and uses Ubuntu 16.04 as its reference point.

2. BACKUP

First things first, backup your whole site. Put it in an accessible place, maybe the user folder is good. Keep it in the exact same structure as when you started. Check to make sure that any invisible files, like .htaccess, have been copied as well.

Login to PHPMyAdmin via your current host. This is usually done by finding a tab that says "databases" or MySQL. Your current site is relying on this database that, on a shared server, is not on your root folder (usually). You'll need to export this. With my version of PHPMyadmin, after logging on I find a list that includes and "export" link. Click it. There is a following list of options that we seem to be able to ignore for the most part. Make sure that your current database is selected and check the box that says "Save to file" or similar. Many places say to export it as a compressed tar.gz but it works as an uncompressed .sql file. Save this near your backup.

3. (OPTIONAL) ARE YOU ALREADY SETUP TO HAVE MULTIPLE WEBSITES ON ONE SERVER? VIRTUAL HOSTS TUTORIAL: digitalocean.com/community/tutorials/…

4. IMPORT AND REINSTALL DATABASE

A) Let's start with transferring the sql file to the server. Place it in your website folder as a holding place while we work on it.

  1. scp [/path/to/your.sql] [USER]@[IP]:[/path/to/yoursite.com/]

This will secure copy it to the directory. Might as well, while we're at it, upload the site. It's useful to have zip unzip installed on your Ubuntu server to simplify uploads.

  1. scp [/path/to/yoursite.zip] [USER]@[IP]:[/path/to/yoursite.com/]

unzip your site while we're here, rename the folder (mv command) if necessary and makesure its folder name is being pointed to by apache, if you are doing this as a virtual host.

B) Login to mysql as root user that you made when installing LAMP.

  1. mysql -u root -p

C) Keep track of the credentials we set here, this will be important for setting your site's database. While noting that all SQL commands now must end in a semicolon (;), make a user that will strictly be used for this site's database.

  1. CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Give them permissions.

  1. GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Now we can make our database.

  1. CREATE DATABASE [database name];

It's a little unclear to me on whether that user is now granted sufficient privileges since root has given her privileges on the whole server, but just to be sure, you can add

  1. GRANT ALL ON [database name].* TO ‘[username]’@‘localhost’ IDENTIFIED BY 'password';

Let's navigate for a moment just to make sure everything went through.

  1. SHOW DATABASES;

will show you a list of all databases.

  1. SELECT DISTINCT User FROM mysql.user;

will show you a list of all users.

Let's check our privileges on the user we created

  1. FLUSH PRIVILEGES;
  2. quit

This will reload the privileges we've applied and exit us from mysql. Let's log back in as our new, non-root user.

  1. mysql -u username -p

Enter password and then lets see:

  1. SHOW GRANTS;

This should reveal both grants we've been given by root. If everything above has looked as it should, the database is in position and we can

  1. quit

to return to the filesystem.

D) IMPORT DATABASE CONTENT

There is a glitch that seems to come up with migrating CMS platforms -- they often have a line inside them that asks to CREATE the database that we've just created. If we hadn't just created the database, it would STILL error us, saying that the database doesn't exist. So before we import, let's go to the sql file with nano.

  1. nano path/to/your.sql

For indexhibit, after the first margin notes we will see a line that starts with CREATE and is followed by USE. We just want to delete the first line of CREATE since we've already done that. Control x, Y, and ENTER to exit and save.

Let's import this database into the one we just made in mysql.

  1. mysql -h localhost -u username -p password < /path/to/your.sql

If it went correctly after asking for your password, it will give no error notes.

5. ADJUST SITE FILES ACCORDING TO VASKA'S NOTES

  1. Download a new copy of indexhibit to your local computer and upload that fresh indexhibit structure either with SFTP or command line secure copy (scp).
  2. index.php
  3. /ndxzsite/
  4. /ndxzstudio/
  5. According to his notes, "DO NOT upload the /files/ folder as you already have this.

Add a folder called 'dimgs' to your /files/ folder.

Next, place 0777 (0755 if your host permits it) permissions on the following folders:

/files/dimgs/
/ndxzsite/config/
/ndxzstudio/cache/

For me, the install also asked for 777 permissions on

/files/gimgs/

but we can come back to this if there's an error on install.

6. INSTALL INDEXHIBIT/DATABASE UPDATE

After double checking that .htaccess has made it over to the domain's directory, direct yourself to the following url:

yourwebsite.com/ndxzstudio/…

and it should hold your hand through the rest. Make sure you still have your database credentials on hand, they will be needed. The database is stored on localhost in this setup.

7. TROUBLESHOOTING

-Whitescreen, but ndxzstudio/install.php says already installed

/etc/hosts

For a while, I was receiving an issue where this page said "You're already installed" and the home page was blank (not even a note regarding a database error). My issue was that while working on the new server, I incorrectly sent my hosts file to IP ADDRESS *.mysite.info when it should've been:

IP ADDRESS mysite.info

PHP7

I believe that the issues with PHP7 have been solved as of a few months ago (can we confirm?) so that shouldn't be the issue. This was part of my troubleshooting list so I did end up going back down to PHP 5.6 in case, a nice tutorial here: askubuntu.com/questions/761713/…

-Home page says database connection failed

Install not finished

The install procedure in step 6 should resolve this.

Database issues?

Of course, double check that all the mysql commands went through correctly. There seems to be little documentation on the conflict between your own CREATE command and the sql file's CREATE command, but this applies to Wordpress sites as well. There might be a correct way to use ON CONFLICT REPLACE in conjunction but that's not for me to confirm.

-No connection at all

Is the computer being pointed at the correct directory?

Make sure either your hosts file is pointing to your IP address or the public name servers are doing it. (For digital ocean, remember to not only set your domains nameservers to point to the IP, but also to register the domains in your droplet as well as double check that your A records and Cname records are appropriately filled.

Virtual hosts issue?

Part of that same earlier question, make sure that apache has enabled that domain name as a site -- the server needs to be restarted for the edited file and the enable command to take effect.

I know this is a very specific case study from an admitted novice, but it may be useful to someone out there! Please feel free to correct me on any errors.

colinklockner
UNITED STATES
8 month(s) ago
Permalink Post

Some inconsistencies in my code [username] username etc and a few typos but not sure I can edit from here.

colinklockner
UNITED STATES
8 month(s) ago
Permalink Post

Oh also, when creating that database in step 4, I forgot to add the extra utf8 notes that we delete in the .sql file in step 5.

  1. CREATE DATABASE database DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

will embed those settings, I believe.

Vaska A
UNITED STATES
8 month(s) ago
Permalink Post

Thanks for posting that Colin.

I'd like to state for anybody who tries this - back everything (sites files and database). If you don't do this - expect a disaster.

DO is also unmanaged hosting - it's a completely different kind of hosting. I would only recommend this for somebody who can understand what's happening.

colinklockner
UNITED STATES
8 month(s) ago
Permalink Post

Sorry, this is bad practice but I suppose I should be doing this on github or a place I can edit. Where we're importing the database into mysql, the correct code should be:

  1. mysql -h localhost -u username -p databasename < /path/to/your.sql 

(Accidentally wrote "password" where databasename should be.)

colinklockner
UNITED STATES
8 month(s) ago
Permalink Post

Hey Vaska,

Well after successfully navigating a migration with this setup, I've been running into a wall with a separate website I've been installing fresh on the same server.

I'm still troubleshooting but was wondering if you have any clues on the following symptoms:

-Everything looks good before install, domain root says "database not installed"
-After installing database in mysql, after indexhibit install, everything looks good and I change the default password.
After this, ndxzstudio almost looks fine but is not right. No default sections appear in the main site-structure page, the sections tab under admin says "none," and plugins won't "enable."
Domain home now doesn't connect to anything at all.

I suspect a database error only because all of Ndxzstudio almost works and the homepage is nonexistent but do you have any clues if that is correct or not? I've checked and rechecked all my database settings but can't find any inconsistencies so it may be something deeper ... unless if you've run into this ever before. No stress either way.

 

Only purchasers of Indexhibit are able to post in the forum.