forked from jnraine/munkiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Moving to MySQL
rickychilcott edited this page Mar 8, 2012
·
20 revisions
This document is a work in progress, do not rely on this document to be accurate yet.
-
Stop your web server
-
IMPORTANT Backup your production database and server (if you are really paranoid). YES. Do it!
-
Install MySQL Community Server
-
Before doing the migration, some nice things to do to minimize the amount of data copied over and to speed up the process. This list is in the recommended, but not required order. Feel free to do re-order depending on your needs
rake chore:cleanup_missing_manifests
rake chore:cleanup_old_managed_install_reports
rake chore:cleanup_system_profiles
rake chore:destroy_stale_item_records
rake chore:validate_models #This is important because the MySQL migrations require you to have completely valid entries
sqlite3 DATABASE_NAME vacuum
-
If you ever see an error like this "The database disk image is malformed" while doing any of the above, consider trying this fix
-
Pull the latest changes from MunkiServer, then apply Trey's branch, finally, get all the gems
git checkout master
git pull jnraine
git pull jnraine mysql_support_final master
bundle install
- Create a the production database in MySQL and edit your config/database.yml and replace the existing production section with something like this:
production:
adapter: mysql2
encoding: utf8
database: munkiserver-prod
pool: 5
username: root
password:
socket: /tmp/mysql.sock
This Rails Guide might help.
- Move the data from sqlite3 to MySQL
# Create temporary web service with production sqlite database
taps server sqlite://db/production.sqlite3 munkiserver munkiserver &
# Pull sqlite3 database into mysql
taps pull mysql2://<db username>:<db password>@localhost/<db name> http://munkiserver:munkiserver@localhost:5000
- Apply the latest migrations to the MySQL database
RAILS_ENV=production rake db:migrate
- Start webserver and cross your fingers. If you run into problems email [email protected]