Merge pull request #673 from Bonitasoft-Community/master

Add explanation to migrate Bonita BPM in 7.3.x
This commit is contained in:
Tianon Gravi 2016-08-25 12:30:18 -07:00 committed by GitHub
commit 3d16b2afaa
1 changed files with 93 additions and 39 deletions

View File

@ -101,47 +101,49 @@ $ chcon -Rt svirt_sandbox_file_t /my/own/datadir
## Migrate from an earlier version of Bonita BPM ## Migrate from an earlier version of Bonita BPM
1. Stop the container to perform a backup - Stop the container to perform a backup
```console ```console
$ docker stop bonita_7.0.0_postgres $ docker stop bonita_7.2.3_postgres
``` ```
2. Check where your data are stored - For containers < 7.3.0 :
```console - Check where your data are stored
$ docker inspect bonita_7.0.0_postgres
[...]
"Mounts": [
{
"Source": "/home/user/Documents/Docker/Volumes/bonita_7.0.0_postgres",
"Destination": "/opt/bonita",
"Mode": "",
"RW": true
}
],
[...]
```
3. Copy data from the filesystem ```console
$ docker inspect bonita_7.2.3_postgres
[...]
"Mounts": [
{
"Source": "/home/user/Documents/Docker/Volumes/bonita_7.2.3_postgres",
"Destination": "/opt/bonita",
"Mode": "",
"RW": true
}
],
[...]
```
cp -r bonita_7.0.0_postgres bonita_7.0.3_postgres - Copy data from the filesystem
4. Retrieve the DB container IP cp -r bonita_7.2.3_postgres bonita_migration
- Retrieve the DB container IP
```console ```console
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' mydbpostgres $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' mydbpostgres
172.17.0.26 172.17.0.26
``` ```
5. Dump the database - Dump the database
export PGPASSWORD=mysecretpassword export PGPASSWORD=mysecretpassword
pg_dump -O -x -h 172.17.0.26 -U postgres bonitadb > /tmp/bonitadb.sql pg_dump -O -x -h 172.17.0.26 -U postgres bonitadb > /tmp/bonitadb.sql
Note that businessdb won't be updated with the migration tool but you may want to also backup/move it. Note that businessdb won't be updated with the migration tool but you may want to also backup/move it.
6. Load the dump - Load the dump
export PGPASSWORD=mysecretpassword export PGPASSWORD=mysecretpassword
psql -U postgres -h 172.17.0.26 -d postgres -c "CREATE USER newbonitauser WITH PASSWORD 'newbonitapass';" psql -U postgres -h 172.17.0.26 -d postgres -c "CREATE USER newbonitauser WITH PASSWORD 'newbonitapass';"
@ -149,26 +151,38 @@ $ chcon -Rt svirt_sandbox_file_t /my/own/datadir
export PGPASSWORD=newbonitapass export PGPASSWORD=newbonitapass
cat /tmp/bonitadb.sql | psql -U newbonitauser -h 172.17.0.26 newbonitadb cat /tmp/bonitadb.sql | psql -U newbonitauser -h 172.17.0.26 newbonitadb
7. Retrieve the last migration tool and the target version of the Bonita bundle - Retrieve the last migration tool
cd bonita_7.0.3_postgres - If you migrate to a version < 7.3.0
wget http://download.forge.ow2.org/bonita/bonita-migration-distrib-2.2.0.zip
wget http://download.forge.ow2.org/bonita/BonitaBPMCommunity-7.0.3-Tomcat-7.0.55.zip
unzip bonita-migration-distrib-2.2.0.zip -d bonita-migration-distrib-2.2.0
unzip BonitaBPMCommunity-7.0.3-Tomcat-7.0.55.zip
8. Move the previous Home into the new bundle - get also the target version of the Bonita bundle
mv BonitaBPMCommunity-7.0.3-Tomcat-7.0.55/bonita/ BonitaBPMCommunity-7.0.3-Tomcat-7.0.55/bonita.orig ```console
cp -r BonitaBPMCommunity-7.0.0-Tomcat-7.0.55/bonita/ BonitaBPMCommunity-7.0.3-Tomcat-7.0.55/bonita/ cd bonita_migration
wget http://download.forge.ow2.org/bonita/bonita-migration-distrib-2.15.0.zip
wget http://download.forge.ow2.org/bonita/BonitaBPMCommunity-7.2.4-Tomcat-7.0.67.zip
unzip bonita-migration-distrib-2.15.0.zip
unzip BonitaBPMCommunity-7.2.4-Tomcat-7.0.67.zip
```
9. Configure the migration tool - Move the previous Home into the new bundle
cd bonita-migration-distrib-2.2.0/ ```console
mv BonitaBPMCommunity-7.2.4-Tomcat-7.0.67/bonita/ BonitaBPMCommunity-7.2.4-Tomcat-7.0.67/bonita.orig
cp -r BonitaBPMCommunity-7.2.3-Tomcat-7.0.67/bonita/ BonitaBPMCommunity-7.2.4-Tomcat-7.0.67/bonita/
```
add the jdbc driver - If you migrate to a version >= 7.3.0
cp ../BonitaBPMCommunity-7.0.0-Tomcat-7.0.55/lib/bonita/postgresql-9.3-1102.jdbc41.jar lib/ ```console
cd bonita_migration
wget http://download.forge.ow2.org/bonita/bonita-migration-distrib-2.15.0.zip
unzip bonita-migration-distrib-2.15.0.zip
```
- Configure the migration tool
cd bonita-migration-distrib-2.15.0
edit the migration tool config to point towards the copy of bonita home and db edit the migration tool config to point towards the copy of bonita home and db
@ -176,21 +190,61 @@ $ chcon -Rt svirt_sandbox_file_t /my/own/datadir
For example : For example :
bonita.home=/home/user/Documents/Docker/Volumes/bonita_7.0.3_postgres/BonitaBPMCommunity-7.0.3-Tomcat-7.0.55/bonita
db.vendor=postgres db.vendor=postgres
db.url=jdbc:postgresql://172.17.0.26:5432/newbonitadb db.url=jdbc:postgresql://172.17.0.26:5432/newbonitadb
db.driverClass=org.postgresql.Driver db.driverClass=org.postgresql.Driver
db.user=newbonitauser db.user=newbonitauser
db.password=newbonitapass db.password=newbonitapass
# location of the bonita home (only useful when migration from version before 7.3.0)
bonita.home=/home/user/Documents/Docker/Volumes/bonita_migration/BonitaBPMCommunity-7.2.3-Tomcat-7.0.67/bonita
10. Launch the migration - Launch the migration
./migration.sh cd bin
./bonita-migration-distrib
11. Launch the new container pointing towards the copy of DB and filesystem - Launch the new container pointing towards the copy of DB and filesystem
- If < 7.3.0
```console ```console
$ docker run --name=bonita_7.0.3_postgres --link mydbpostgres:postgres -e "DB_NAME=newbonitadb" -e "DB_USER=newbonitauser" -e "DB_PASS=newbonitapass" -v "$PWD"/bonita_7.0.3_postgres:/opt/bonita/ -d -p 8081:8080 bonita:7.0.3 $ docker run --name=bonita_7.2.4_postgres --link mydbpostgres:postgres -e "DB_NAME=newbonitadb" -e "DB_USER=newbonitauser" -e "DB_PASS=newbonitapass" -v "$PWD"/bonita_migration:/opt/bonita/ -d -p 8081:8080 bonita:7.2.4
```
- If >= 7.3.0
```console
$ docker run --name=bonita_7.3.0_postgres --link mydbpostgres:postgres -e "DB_NAME=newbonitadb" -e "DB_USER=newbonitauser" -e "DB_PASS=newbonitapass" -d -p 8081:8080 bonita:7.3.0
```
- Reapply specific configuration if needed, for example with a version >= 7.3.0 :
```console
$ docker exec -ti bonita_7.3.0_postgres /bin/bash
```
```console
$ cd /opt/bonita/BonitaBPMCommunity-7.3.0-Tomcat-7.0.67/setup
$ ./setup.sh pull
$ TENANT_LOGIN=tech_user
$ TENANT_PASSWORD=secret
$ PLATFORM_LOGIN=pfadmin
$ PLATFORM_PASSWORD=pfsecret
$ sed -e 's/^#userName\s*=.*/'"userName=${TENANT_LOGIN}"'/' \
-e 's/^#userPassword\s*=.*/'"userPassword=${TENANT_PASSWORD}"'/' \
-i platform_conf/current/tenants/1/tenant_engine/bonita-tenant-community-custom.properties
$ sed -e 's/^platform.tenant.default.username\s*=.*/'"platform.tenant.default.username=${TENANT_LOGIN}"'/' \
-e 's/^platform.tenant.default.password\s*=.*/'"platform.tenant.default.password=${TENANT_PASSWORD}"'/' \
-i platform_conf/current/platform_portal/platform-tenant-config.properties
$ sed -e 's/^#platformAdminUsername\s*=.*/'"platformAdminUsername=${PLATFORM_LOGIN}"'/' \
-e 's/^#platformAdminPassword\s*=.*/'"platformAdminPassword=${PLATFORM_PASSWORD}"'/' \
-i platform_conf/current/platform_engine/bonita-platform-community-custom.properties
$ sed -i -e 's/^#GET|/GET|/' -e 's/^#POST|/POST|/' -e 's/^#PUT|/PUT|/' -e 's/^#DELETE|/DELETE|/' -i platform_conf/current/tenants/1/tenant_portal/dynamic-permissions-checks.properties
$ ./setup.sh push
```
```console
$ docker restart bonita_7.3.0_postgres
``` ```
For more details regarding Bonita migration, see the [documentation](http://documentation.bonitasoft.com/migrate-earlier-version-bonita-bpm-0). For more details regarding Bonita migration, see the [documentation](http://documentation.bonitasoft.com/migrate-earlier-version-bonita-bpm-0).