How to push a simple Drupal web site from test to production

Now that I've re-done my web site, using the Drupal open source content management system, I am going to need to take the development version of my site and push those new features to the hosting provider that actually runs the live site. I have my basic web pages + my Transcode blog showing up on the Drupal-created web site's main page.

My next task was to try to push the web site live, onto my hosted web server. I had to learn how to create a MySQL database on the hosting company, which was easy to do but took a couple of hours to show up. I also wanted ssh access to my site, which apparently caused my hosting company to move my hosted environment to a different server; that also took a few hours to get going, but was relatively painless. I tried to connect to it after a few hours, and couldn't; I found out that I needed to create a new password for the ssh service to work (makes sense, no problem).

Once I did all that, a few hours later I was able to get to the site. Here were the basic steps I took:

- I took my whole web site's "htdocs" directory tree and made a tarball of it:

tar cvf website.tar ./htdocs

This is where my images, PHP code for Drupal + modules, and all my other content sits, at least the content that doesn't get stored directly into the database. (e.g., PostScript documentation that I store on the site for public download)

- I FTPd the tarball over to my hosting provider, just put it somewhere for the time being.

- I took a snapshot of my Drupal database using "mysqldump":

mysqldump -u myusername -pmypassword mydatabasename > databasename.sql

(note: no space between the "-p" and the beginning of the password string. Not sure why that was the case, when there is a space between the "-u" and the beginning of the username string.)

- I FTPd the databasename.sql file to my hosting provider as well.

- I logged into my hosting provider's site, went into the administration interface for it, and asked it to create a new MySQL 5.0 database. I gave the database the same name as I gave when I set up Drupal on my local site. I picked a username and password, then it was ready to go. I noted the hostname where that DB sits, because I need to use that later.

- I used ssh to get into my site. Once there, I unpacked the htdocs tarball:

tar xvf htdocs.tar

- I moved the htdocs directory to be a peer of my existing html directory (the top of the html tree for my existing web site; I'm going to replace that html tree with my new Drupal-based html tree). Now, typing "ls" I see the following

htdocs html

- I went into htdocs/sites/default/files/ and edited the "settings.php" file to make sure the setting for connecting to the database is correct. I needed to update the username, password, and hostname to make sure they all correctly use the production site's values. The line looks something like this:

$db_url = 'mysqli://user:password@nameofdbhostname.com/nameofdb';

- I moved the original html directory out of the way

mv html html.orig

- I moved the Drupal-based htdocs document tree into place

mv htdocs html

- I was then ready to test by going here: http://www.transcode.com/

The Drupal-based content showed up like a charm. Voila!

My first live site push with Drupal worked, no problem.

Next, I'll need to learn how to do site updates: I intend to do more web site development via Drupal on my local machine, using my test/development environment (using VirtualBox to run OpenSolaris as a guest OS, so that my whole environment sits in a single .vdi file that I can put on a USB stick and take and use anywhere I want to go, or copy it onto a DVD or anywhere, really). Anyway, once I make more improvements to my web site, I'll want to push them live, too, so I need to learn how to update an existing live site. I'm hoping that will be pretty easy.

Comments

The site production is really

The site production is really good. They would love to see this thing working for them. - Aaron Kocourek

Being a php developer, I have

Being a php developer, I have used many content management systems like wordpress, joomla etc. But I am new to drupal. I just have started a drupal project and almost completed the designing process in my localhost.I wanted to know more about www.datanumen.com too. Now I am having confusion in making it live. That’s why I searched in the internet and I reached this post. I have read your description about how you pushed the drupal website to host live. I am going to follow the steps that you shared. Hope this will work for me too.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.