nuxsmin / sysPass

Systems Password Manager
https://syspass.org
GNU General Public License v3.0
975 stars 208 forks source link

Upgrade steps for 3.0 #1112

Open deajan opened 5 years ago

deajan commented 5 years ago

Hello,

Since I did twice test sysPass 3.0 (beta and rc3), I wrote a quick upgrade guide. Anywhere I can post that ?

Cheers.

jinyiwoo commented 5 years ago

Hi deajan: I have installed the 3.0 Beta on CentOS 7.3.1611. It is ok for login the sysPass. But there are some errors when create user , copy the password to clipboard etc. Would you can post the guide for rc3 installation or send the guide to my mail: bbobb.wu@gmail.com?

Thanks a lot.

deajan commented 5 years ago

Quick (and dirty) install / upgrade guide for sysPass v3 on CentOS 7: [EDIT 03 Jan 2019]Simplified procedure, works for release 3.0[/EDIT] [EDIT 12 Feb 2019]Added more SELinux context[/EDIT]

Supposes you have a working LAMP stack with PHP7.x Necessary php modules include php-ldap php-mcrypt php-mbstring php-gd php-mysqlnd php-pdo php-json php-xml and php-xdebug if using developpment version without composer option --no-dev These modules may also have prefixes like rh-php70- depending of if you're using a SCL repo for RHEL.

It's also advised to install web apps to /var/www/{app_subdir}/ftp/www for later privilege separation, whereas in this example I use /var/www/{app_subdir}

Get last version of sysPass (see github) yum install unzip -y cd /var/www wget https://github.com/nuxsmin/sysPass/archive/3.0.0.18111901-rc3.zip unzip 3.0.0.18111901-rc3.zip mv sysPass-3.0.0.18111901-rc3/* syspass3

[UPGRADE ONLY STEPS] Create a new database, new user and password so we can keep earlier sysPass v2. launch mysql with mysql and execute the following

CREATE DATABASE syspass3
GRANT ALL PRIVILEGES ON syspass3.* TO 'syspassDB'@'localhost' IDENTIFIED BY 'SomePassword';
FLUSH PRIVILEGES;
exit

Copy elder base to new one

mysqldump syspass2 | mysql syspass3

Copy config files from old syspass (let's say in /var/www/syspass2)

cp /var/www/syspass2/config/{config.xml,key.pem,pubkey.pem} /var/www/syspass3/app/config

Change database settings:

sed -i 's#\(<dbName>\).*\(</dbName>\)#\1syspass3\2#' /var/www/syspass3/app/config/config.xml
sed -i 's#\(<dbPass>\).*\(</dbPass>\)#\1SomePassword\2#' /var/www/syspass3/app/config/config.xml
sed -i 's#\(<dbUser>\).*\(</dbUser>\)#\1syspassDB\2#' /var/www/syspass3/app/config/config.xml

Fetch the upgrade key for first run with grep upgradeKey /var/www/syspass3/app/config/config.xml

[/UPGRADE STEPS]

Install and run composer (will need EPEL install)

yum install epel-release -y
yum install composer -y
cd /var/www/syspass3
php composer install --no-dev

If using rh-php7x from SCL, you may run composer with:

/opt/rh/rh-php70/root/bin/php /usr/bin/composer install --no-dev

Setup directory rights:

chown -R apache:apache /var/www/syspass3
chmod 750 /var/www/syspass3/app/{backup,config}
chmod 640 /var/www/syspass3/app/config/*

Setup SELinux rights:

yum install policycoreutils-python -y
setsebool -P httpd_can_connect_ldap 1
chcon -R -t httpd_sys_rw_content_t /var/www/syspass3/app/{config,backup}
chcon -R -t httpd_sys_rw_content_t /var/www/syspass3/app/cache

Have fun :)

vmario89 commented 5 years ago

if you post it in this thread @nuxsmin can mark is with the Label 'Doc'. This way he won't forget to add it to the official docs later

nuxsmin commented 5 years ago

@vmario89 sure!

Thanks for your contribution @deajan

vmario89 commented 5 years ago

Hi, just some hint to "composer install --no-dev". When i use the switch --no-dev syspass authenticator plugin will be uninstalled automatically. I think the authenticator can be installed normal way by using git repo but using composer it's much more smarter

nuxsmin commented 5 years ago

@vmario89 that's right, and it's so because there isn't any tagged version of the plugin yet, but once tested thoroughly, it will be available without the dev modifier.

vmario89 commented 5 years ago

Hi @deajan and @nuxsmin , i did a test upgrade vom sysPass v2 to v3 this day too and it worked very well except some small point. What i did: i checked out syspass v3 repo on local file system, configured owner and file permissions, made the web server config. After this i put the config.xml from v2 into the folder of v3 and went to the syspass frontend URL. It gave me the dialog to make a new sysPass installation instead of upgrading the existing. I had to enter the /index.php?r=upgrade/index URL manually. I entered all the passwords and db connection and the DB upgrade worked fine.

But i have an issue with the config.xml. I installed v3 rc5 but the config says configVersion>300.18111001</configVersion databaseVersion>300.18111901</databaseVersion

Thats just not correct.

I logged into MariaDB and checked the version from db too. It says | version | 213.17031402

it should be 300.18112601 for all three string values

The table was not updated at all: grafik

But the alter/update/insert/rename statements from ../schemas/*.sql were done properly (tables like Track, ItemPreset) are existent :-(

by the way i was thinking about it would be maybe a good idea to automatically apply maintenance mode when upgrading from v2 to v3