IMPORTANT: When restoring, remember to maintain the original permissions for the files and folders. For example, if you originally installed the stack as ‘root‘, make sure that the restored files are owned by ‘root‘.
If you want to restore the database and the database schema does not exist, it is necessary to first follow the steps described below. As a side note, you can find the value for BITNAMI_USER_PASSWORD below in the application configuration file. This depends on the application and you can find this information in the application page itself. $ mysql -u root -p mysql> create database database_name; mysql> grant all privileges on database_name.* to ‘bitnami‘@‘localhost‘ identified by ‘BITNAMI_USER_PASSWORD‘; mysql> flush privileges; mysql> exit; $ mysql -u root -p database_name < backup.sql
NOTE : the steps previously described will only back up the state of your database. Other files that you should take into account when performing a backup are files that have been uploaded to theapplication. These files are stored in the application folder itslef so you can copy this folder to have a backup of your uploaded files.
三、Redmine升级 It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly. You can get more info about how to create a full backup here. Of course, before executing any command, you have to start the bitnami_console script or the shortcut on Windows before typing the following commands. There are two different ways to upgrade your application.
If you want to upgrade the application and all Stack components PHP, Ruby, MySQL, Apache… You can follow the steps described at How to upgrade the full Stack migrating the data? In case you only want to upgrade the application code without modifying any other Stack components. You can find below the steps to upgrade only the Redmine application. In the Redmine case, these are the steps to migrate the database from an old version to a new one. You can launch a new Redmine version instance or download the latest Redmine installer from http://bitnami.com/stack/redmine. Note this guide uses "/opt/bitnami" as the default installation directory, you can use a different one if you have installed it in a different folder. Copy the database backup to the new Bitnami version server. Stop all servers and start only MySQL. Note that the installation directory could be different. This is the default installation directory for Virtual Machines and Cloud images. $ sudo /opt/bitnami/ctlscript.sh stop $ sudo /opt/bitnami/ctlscript.sh start mysql
Remove the previous database and create the new one. You can configure the database user password with a secure password. $ mysql -u root -p Password: **** mysql> drop database bitnami_redmine; mysql> create database bitnami_redmine; mysql> grant all privileges on bitnami_redmine.* to ‘bn_redmine‘@‘localhost‘ identified by ‘DATABASE_PASSWORD‘;
Restore the new database: $ mysql -u root -p bitnami_redmine < backup.sql Edit the Redmine configuration file to update the database user password (the same that you set previously) "/opt/bitnami/apps/redmine/htdocs/config/database.yml" production: adapter: mysql2 database: bitnami_redmine host: localhost username: bn_redmine password: "DATABASE_PASSWORD" encoding: utf8 Migrate the database to the latest version: $ cd /opt/bitnami/apps/redmine/htdocs $ ruby bin/rake db:migrate RAILS_ENV=production Troubleshooting: If you see the following error, go to your database and remove the specified table and run the migrate command again. Mysql::Error: Table ‘changeset_parents‘ already exists: CREATE TABLE `changeset_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE=InnoDB $ mysql -u root -p mysql> use bitnami_redmine; mysql> drop table changeset_parents;
Copy the ""/opt/bitnami/apps/redmine/htdocs/files" folder from the old installation to the new one. If you have installed plugins in the previous version, copy the folders from "vendor/plugins" directory into new installation directory, in "plugins" folder. Check the plugins also support this new version and run the following command $ ruby bin/rake redmine:plugins RAILS_ENV="production"
Finally you should clean the cache and the sessions: $ ruby bin/rake tmp:cache:clear $ ruby bin/rake tmp:sessions:clear
Restart the servers and you can access to your new Redmine. $ sudo /opt/bitnami/ctlscript.sh restart
Troubleshooting: If you upgrade it from a 1.x version and you see something similar to this error creating an issue: MysqlStatement::Error Value for field `value` cannot be NULL INSERT INTO custom_value ... Go to your custom values in the admin panel, try to edit and save them again. That should fix the issue.