How to push sedans

So, yer out of gas and have to push huh ?

All kidding aside, here' s how I push drupal and gallery2 from dev to a production host.

localhost
dump drupal DB with backup_migrate module
### location: /var/www/"websitedirectory"/drupal/sites/default/files/backup_migrate/manual
export gallery2 DB w phpmyadmin
### note: backup function in gallery2 produced an xml dump that phpmyadmin import didn't like

### copy web root to remote host
scp -rp /var/www "remotehost":/var/

### copy apache conf if changed
scp -rp /etc/apache2 "remotehost":/etc/apache2

### copy drupal DB to remotehost
scp -rp /home/"localuser"/"websitename"*.sql "remotehost":/home/"localuser"

### copy gallery2 DB to remotehost
scp -rp /home/"localuser"/gallery2*.sql "remotehost":/home/"localuser"

remotehost

set permissions on files and dirs

### on apache config

chown "adminuser":"httpd-user" /etc/apache2 -R ## aka the root user and the httpd run-user
find /etc/apache2/. -exec chmod u=rwx,g=rx,o= {} \;

### on web root

chown www-data:www-data /var/www -R
find /var/www/. -type d -exec chmod u=rwx,g=rx,o= {} \;
find /var/www/. -type f -exec chmod u=rw,g=r,o= {} \;
find /var/www/"websitedirectory"/drupal/sites/default/. -type d -name files -exec chmod ug=rwx,o= {} \;

### on gallery2 data

find /var/www/"websitedirectory"/g2data/. -exec chmod u=rwx,g=rwx,o= {} \;

### Lock .htaccess files

find /var/www/. -type f -name .htaccess -exec chmod u=r,g=r,o= {} \;

NOTE: find other files for exclusive permisions INCOMPLETE

administer drupal and gallery2 DB

### drop gallery2 and drupal DB with phpmyadmin

### create new drupal DB

mysqladmin -u root -p create drupal

### create drupal user if necessary

mysql -u root -p

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'drupalpass';
mysql> FLUSH PRIVILEGES;

### import drupal DB with phpmyadmin

###create new gallery2 DB

mysqladmin -u root -p create gallery2

### create gallery2 user if necessary

mysql -u root -p

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON gallery.* TO 'galleryuser'@'localhost' IDENTIFIED BY 'gallerypass';
mysql> FLUSH PRIVILEGES;

### Import gallery2 DB with phpmyadmin

note: make DB dumps readable

edit config.php in gallery2 to change root password

run permissions script ### I keep it secret for now until I know it's solid.

James Horvath Gooey Website