Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Moving to MySQL
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 -- instead of using the MySQL installer, consider following this guide, being sure to do your installs with the latest versions.
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
RAILS_ENV=production rake chore:cleanup_missing_manifests RAILS_ENV=production rake chore:cleanup_old_managed_install_reports RAILS_ENV=production rake chore:cleanup_system_profiles RAILS_ENV=production rake chore:destroy_stale_item_records RAILS_ENV=production rake chore:validate_models #This is important because the MySQL migrations require you to have completely valid entries sqlite3 <database_name> vacuum
- Pull the latest changes from MunkiServer, then apply Trey's branch, finally, get all the gems
git checkout master git pull origin master (or jnraine if you have your own fork) bundle install
- Create a the production database in MySQL
# Connect to MySQL mysql -u <your user> -p # Create database for Munkiserver mysql> CREATE DATABASE <database_name> CHARACTER SET utf8 COLLATE utf8_general_ci;
- Edit your config/database.yml and replace the existing production section with something like this:
production: adapter: mysql2 encoding: utf8 host: localhost # Or the FQDN of your external MySQL Server database: <database_name> pool: 5 username: <db username> password: <db password>
This Rails Guide might help.
- IMPORANT! Apply the latest migrations to the MySQL database. This must be done before moving the data to MySQL since the migration removes default values from the schema not allowed in MySQL.
RAILS_ENV=production rake db:migrate
- Increase your MySQL Server's
max_allowed_packetto at least
- 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
- Start webserver and cross your fingers. If you run into problems email email@example.com