gallery 2 migration

doomdead

Joined: 2003-04-06
Posts: 174
Posted: Thu, 2005-03-24 17:58

I installed gallery 2 on my home server, migrated all my albums/photos from gallery 1. Everything went smooth. Now I'm paying for a host with a ton of space/bandwidth and I wanted to migrate my gallery there.

I exported mysql from my server, imported it into mysql on the new host. Uploaded gallery and tried to run it. got errors. So i tried to go through the install process again, got errors.

So I did a fresh install (including new mysql db) and everything went fine. Gallery is functioning as it should. However. Instead of uploading the 3 gigs of photos i have in my gallery1/albums folder and doing a g1-->g2 import, can i somehow upload my g2data folder and maintain my directory structure?

In other words. How the heck do we backup/restore settings if we want to migrate our gallerys?

----

Gallery URL (optional):
Gallery version: g2 beta 1 dark fibre
Webserver (with version): apache
Datatabase (with version): mysql 4.1.10
PHP version (eg 4.2.1): 4.3.10
phpinfo URL (optional):
Graphics Toolkit(s): imagemagick
Operating system: redhat 8
Web browser/version:
G1 version (for migration bugs):

 
ryanspeers

Joined: 2004-08-31
Posts: 20
Posted: Sat, 2005-03-26 13:08

I would love to know how to migrate from G2 to a new install of G2 as I'm currently moving to a new host because my old one enabled PHP safe-mode!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-03-26 13:29

0. Upgrade G2 on the old server to the same G2 version which you plan to install on the new server.
1. deactivate the url rewrite module if it is active
2. Backup G2 on your old host = backup the database and the g2data folder.
3. copy the g2data folder and import the mysql database to your new host
4. install the gallery2 codebase (extract gallery2.tar.gz/zip) on the new host. It should be the same G2 version or newer.
5. Have your webhosting partner change the owner of the g2data dir recursively to the webserver user, unless php cgi + suexec is used. If you don't understand this instruction, forward it directly to your webhosting partner. The webhost has to do this only once, I'm sure they will do it.
6. I guess I wouldn't copy the config.php from the old host to the new host. Just run the installer, i.e. browse to newhost/gallery/install/. Make sure you choose "reuse existing database tables" in the database step. Point the installer in the appropriate step to the g2data folder (which is now not empty). And finish the installer.

This should work.

If you choose to copy the config.php, you have to manually change:
- the g2data path
- galleryId (at the bottom of config.php)
- db name/user if, ...

But IMO it's easier to just rerun the installer. That will create the config.php but should not harm your existing g2data/db.

 
eosguy

Joined: 2005-07-27
Posts: 38
Posted: Wed, 2005-08-17 04:10

Can I just run the installer, create a new g2data folder, finish installation and then just copy the contents of the current g2data folder into the new one?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2005-08-17 04:18

No, the DB wouldn't have any of the information. You need to follow valiant's instructions. The instructions here are probably a little more up to date, if anything has changed.
http://codex.gallery2.org/index.php/Gallery2:faq#How_can_I_move_my_gallery_installation_from_one_server_to_another.3F

 
eosguy

Joined: 2005-07-27
Posts: 38
Posted: Wed, 2005-08-17 11:33

I've been emailing the webhosting company's tech support back and forth, and they still don't know what really needs to be done with the g2data folder. They told me that currently the g2data folder is already under my webserver username, and not 'NOBODY'.

 
eosguy

Joined: 2005-07-27
Posts: 38
Posted: Wed, 2005-08-17 12:27

OK, managed to do it the unconventional way, can view everything now. However, I had to set a few folders inside g2data to 777 in order for the thumbnail regeneration to go through. can I reset them to 755?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2005-08-17 14:18

If those files are under your username and Apache runs as 'nobody' then it can't write to those file unless they are 777. If you reset them to 755 you'll run into this same problem again.

In most installs g2data is set to 777, then the user Apache runs as (usually 'nobody' or 'www' or 'apache' or something like that) creates the rest of the files. Since it owns them they can be set at 755 because it is the owner (the first digit).

If all those files are owned by you and not the user Apache runs as then you copied them over there and from a different install. They must all be set at 777, any new files you upload though will be set at 755.

In my opinion, on a shared server, setting your files to 755 or 777 isn't a big deal if the web server already owns the files. If someone wanted to they could write a script, install it on their site, run it as the Apache user and do what ever they wanted to any files owned by the Apache user.

 
eosguy

Joined: 2005-07-27
Posts: 38
Posted: Fri, 2005-08-19 14:47

OK, still don't really understand that much, will leave the files and folders as it is. The problem with my migration was that g2data was set to 777 but the other folders, ie cache etc, and the subfolders in it had to be set to 777 as well. My webhosting company told me that the folders are set under my username (for the webhosting package)... still am a but blur here.

Anyways, the g2data folder is located in the same level as public_html. Is it safer here, or should I had put it in public_html folder or in the gallery folder?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-08-20 15:54

Permissions:
The directories and such below g2data had to be set to 777 because your user account created them, not the webserver's user account (the account Apache runs as).

By default, you set g2data to 777, then you start installing G2 and G2 then creates files under g2data setting the folders to 755 and the files to 644. Meaning the webserver can now write to those directories and change the files, but group and world cannot.

The first digit in the permissions is the owner (user) of the files. The other two are for group and everyone (world). There are a lot of pages that can explain Unix permissions better than I can, http://www.google.com/search?hl=en&lr=&q=unix+permissions&btnG=Search

g2data:
It depends on how you have your site setup. Here's how mine is structred:
/public_html
/g2data
/mywebsitedomain.com
/myothersite.com
/mysite3.com

As you can see g2data is still in a location where the webserver account can access it, which it needs to, and it's above my website's directory so nobody accessing the site with their browser can access the directory.

What's important is that it's not in your website's directory, if you want better protection than what's offered with G1 that is, and the webserver can still access it, which it appears you've done if everything is working correctly.

 
irvken_

Joined: 2004-12-15
Posts: 9
Posted: Tue, 2006-11-21 13:52

I'm having a similar probelm, in that I have albums in g2data folder from a previous install, but no database. I have a blank new install of G2 and am wondering if there is an easy way of importing them rather than manually image by image?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-11-21 14:26
 
irvken_

Joined: 2004-12-15
Posts: 9
Posted: Tue, 2006-11-21 15:09

that is so very cool, thx v.much