Difference between revisions of "CentOS 7.x update lightsail redmine instance"
m |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x ticketing]] > [[CentOS 7.x redmine |Redmine]] > [[CentOS 7.x update lightsail redmine instance]] | [[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x ticketing]] > [[CentOS 7.x redmine |Redmine]] > [[CentOS 7.x update lightsail redmine instance]] | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x Setup lightsail instances]] > [[CentOS 7.x update lightsail redmine instance]] | |||
Steps for updating redmine instance by creating a new instance and terminating old one are: | Steps for updating redmine instance by creating a new instance and terminating old one are: | ||
Line 176: | Line 175: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x ticketing]] > [[CentOS 7.x redmine |Redmine]] > [[CentOS 7.x update lightsail redmine instance]] | [[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x ticketing]] > [[CentOS 7.x redmine |Redmine]] > [[CentOS 7.x update lightsail redmine instance]] | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x Setup lightsail instances]] > [[CentOS 7.x update lightsail redmine instance]] |
Latest revision as of 16:22, 28 August 2022
Home > CentOS > CentOS 7.x > DevOps > CentOS 7.x ticketing > Redmine > CentOS 7.x update lightsail redmine instance
Home > CentOS > CentOS 7.x > CentOS 7.x Setup lightsail instances > CentOS 7.x update lightsail redmine instance
Steps for updating redmine instance by creating a new instance and terminating old one are: Note that it is also possible to update redmine within same instance using similar steps. For example refer in-place update of owncloud described at CentOS 7.x Update lightsail owncloud instance in-place
For updating redmine use:
- Create a new machine for newer version of redmine
- Install required packages
- yum -y install vim epel-release wget
- yum -y install perl-Data-Dumper byobu
- Copy self admin station public key as authorized for root user of new instance
- Download new version of redmine from https://bitnami.com/stack/redmine/installer
- 'chmod +x' downloaded file.
- If required add appropriate swap by referring CentOS 7.x adding swap space using file
- Install new redmine with following values
- Language
- English (Default)
- Subversion
- Yes (Default)
- PhpMyAdmin
- Yes (Default)
- Git
- Yes (Default)
- Folder
- /opt/redmine-<version> (Default)
- Username
- admin
- Email address
- saurabh [at] sbarjatiya.com
- Login user
- admin
- Password
- Something very simple (It is overwritten by old redmine admin password during database restore anyway)
- Data language
- English (Default)
- Email support
- : Y (Custom, saurabh [at] sbarjatiya.com, secret, mail.sbarjatiya.com, 587, TLS)
- Continue redmine bitnami installation
- Login into older redmine server and go to '/opt/redmine-<version>'. Execute './ctlscript.sh stop apache'. For extra safety you can stop access to ports 80, 443 of old redmine via firewall.
- If mysql is not running start it using './ctlscript.sh start mysql'
- On old server go to location '/opt/redmine-<version>/apps/redmine/htdocs/config'. Open database.yml and note production database details.
- Take MySQL database backup of old redmine using
- cd /root
- /opt/redmine-<version>/mysql/bin/mysqldump -u bitnami -p<old-server-password> bitnami_redmine > bitnami_redmine.sql
- In /etc/hosts of old server add entry for new-<fqdn> pointing to new servers private IP
- If required generate root ssh-key pair on old server. Copy old server root public key on new server as authorized
- Copy MySQL database dump to new server /root
- On new server go to location '/opt/redmine-<version>/apps/redmine/htdocs/config'. Open database.yml and note production database details.
- Restore MySQL database on new redmine using
- cd /root
- /opt/redmine-<version>/mysql/bin/mysql -u bitnami -p<new-server-password> bitnami_redmine < bitnami_redmine.sql
- Copy files from '/opt/redmine-<version>/apps/redmine/htdocs/files' of old server to new server
- rsync -a /opt/redmine-<old-version>/apps/redmine/htdocs/files/ root@new-<fqdn>:/opt/redmine-<new-version>/apps/redmine/htdocs/files/
- Same for /opt/redmine-<version>/apps/redmine/htdocs/plugins after validating that plugins are compatible with new version
- rsync -a /opt/redmine-<old-version>/apps/redmine/htdocs/plugins/ root@new-<fqdn>:/opt/redmine-<new-version>/apps/redmine/htdocs/plugins/
- On new server migrate database to new version using:
- cd /opt/redmine-<version>
- ./use_redmine
- cd /opt/redmine-<version>/apps/redmine/htdocs
- sudo /opt/redmine-<version>/ruby/bin/ruby bin/rake db:migrate RAILS_ENV=production
- Optionally import plugins if copied and compatible using:
- sudo /opt/redmine-<version>/ruby/bin/ruby bin/rake redmine:plugins RAILS_ENV=production
- Clear cache
- sudo /opt/redmine-<version>/ruby/bin/ruby bin/rake tmp:clear
- Restart redmine
- /opt/redmine-<version>/ctrlscript.sh restart
- Copy '/opt/redmine-<version>/apache2/htdocs/index.html' to new server at similar location
- Allow access to port 80 and 443 of new redmine server
- Access new server and test. Note that admin password of old-server would work and not the password typed during installation
- Search for issues with any file. Try to access files uploaded on any issue and check that uploaded files are accessible
- Setup fail2ban using CentOS 7.x fail2ban including firewalld using CentOS 7.x Basic firewalld configuration
- Set correct time zone CentOS 7.x Change system timezone
- Configure system to store history date time using Storing date / time along with commands in history
- Stop old instance or server
- Associate public IP or old instance with new instance or Update DNS to point to static IP of new instance
- Generate SSL certificate using:
- /opt/redmine-4.1.1-4/bncert-tool #Update tool if prompted and re-run
- Inputs for update are: Domain list - <fqdn>, No www.<fqdn> domain, Enable HTTPS redirection - Yes, Agree to multiple changes, Email address - saurabh [at] sbarjatiya.com, Agree to Let's encrypt agreement
- Refer - https://docs.bitnami.com/general/how-to/understand-bncert/
- Update crontab using 'crontab -e and set first value between 3 and 6, second value between 10 and 50. Set last * to 0 so that certificate checks happen only weekly on Sundays.
- Access site using https://<fqdn> and validate
- Configure backups to happen from new server
- Install packages
- yum -y install bzip2
- Edit /etc/rsnapshot.conf private IP in backup server
- Copy backup server SSH keys as authorized on new redmine server
- ssh from backup server to new redmine server and test
- Create /opt/take-database-backup.sh on redmine server with following contents
- /opt/redmine-<ver>/mysql/bin/mysqldump -u bitnami -p<password> bitnami_redmine | bzip2 > /opt/bitnami_redmine.sql.bz2
- Validate name of script take-database-backup.sh in /etc/rsnapshot.conf of backup server
- chmod +x /opt/take-database-backup.sh
- /opt/take-database-backup.sh #Ignore some of the errors shown
- bunzip2 the dump and validate it is proper
- rsnapshot hourly #Validate
- Install packages
- Configure logwatch
- yum -y install logwatch
- Set correct hostname. Reconnect if required
- vim /etc/logwatch/conf/logwatch.conf
- MailTo = saurabh [at] sbarjatiya.com
- MailFrom = saurabh [at] sbarjatiya.com
- Edit /etc/aliases and set root: saurabh [at] sbarjatiya.com
- Edit /etc/postfix/main.cf
- myhostname = redmine.sbarjatiya.com
- mydomain = sbarjatiya.com
- myorigin = $myhostname
- inet_interfaces = all
- inet_protocols = ipv4
- relayhost = mail.sbarjatiya.com
- Ensure public IP of redmine.sbarjatiya.com is part of mynetworks on mail.sbarjatiya.com
- Run newaliases
- systemctl restart postfix
- /etc/cron.daily/0logwatch #Test
- Reset MySQL root password and grant process privilege to bitnami user
- Create file /tmp/mysql-init with contents:
- ALTER USER 'root'@'localhost' IDENTIFIED BY '<new-root-password>';
- FLUSH PRIVILEGES;
- Stop services '/opt/redmine-<version>/ctlscript.sh stop'
- Start mysql with following command
- cd /opt/redmine-<version>
- ./use_redmine
- sudo $PWD/mysql/bin/mysqld_safe --pid-file=$PWD/mysql/data/mysqld.pid --datadir=$PWD/mysql/data --init-file=/tmp/mysql-init 2> /dev/null &
- Try to login with root user using:
- mysql/bin/mysql -u root -p
- Check existing GRANTs for bitnami using:
- show grants for bitnami@'localhost';
- Example output could be
- +----------------------------------------------------------------------+
- | Grants for bitnami@localhost |
- +----------------------------------------------------------------------+
- | GRANT USAGE ON *.* TO 'bitnami'@'localhost' |
- | GRANT ALL PRIVILEGES ON `bitnami_redmine`.* TO 'bitnami'@'localhost' |
- +----------------------------------------------------------------------+
- Add process to existing list of GRANTS
- GRANT USAGE,PROCESS ON *.* TO 'bitnami'@'localhost';
- FLUSH PRIVILEGES;
- \q
- Try to take fresh backup via /opt/take_mysql_backup.sh file and see that no warnings or errors are generated.
- Create file /tmp/mysql-init with contents:
- Delete old instance
Refer:
- https://docs.bitnami.com/installer/apps/redmine/administration/upgrade/
- https://dan.langille.org/2020/07/21/mysqldump-error-access-denied-you-need-at-least-one-of-the-process-privileges-for-this-operation-when-trying-to-dump-tablespaces/
Home > CentOS > CentOS 7.x > DevOps > CentOS 7.x ticketing > Redmine > CentOS 7.x update lightsail redmine instance
Home > CentOS > CentOS 7.x > CentOS 7.x Setup lightsail instances > CentOS 7.x update lightsail redmine instance