﻿---
path: faq/docker/migration-old-docker-to-7.mdx
title: Migrating from the legacy Docker build (Passwork 6) to the current build and Passwork 7
slug: migration-old-docker-to-7
description: >-
  Step-by-step migration from the /server Docker build (Passwork 6) to the
  current Docker build and Passwork 7: backup, update to 6.5, initial data
  migration, configuration conversion, and database restore.
keywords:
  - Passwork
  - Docker
  - migration
  - Passwork 7
  - update
  - server
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Backup

1. Copy the `config.ini` configuration file (full path `/server/sites/prod/app/config/config.ini`) to a directory **outside** `/server`.
2. Create a database backup.

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="no-auth" label="Without authorization">

```bash
cd /server/docker-compose
docker-compose exec -T db sh -c 'mongodump --archive' > "./before65.dump"
```

  </TabItem>
  <TabItem className="tab-item-container" value="with-auth" label="With authorization">

```bash
cd /server/docker-compose
docker-compose exec -T db sh -c 'mongodump --archive --authenticationDatabase admin --username=your-admin --password=your-password' > "./before65.dump"
```

  </TabItem>
</Tabs>

3. If you are using a virtual machine, take a snapshot of it before the update.

## Updating to Passwork 6.5

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```bash
cd /server/sites/prod/
git pull
git checkout v6
```

  </TabItem>
</Tabs>

## Initial data migration in the interface

1. Open **Settings and users** → **Migration to Passwork 7:**

<ImageComponent
  src={'/img/assets/migration-to-passwork-7-initial-data-migration-3-w9i8uth2.png'}
  alt="The migration to Passwork 7 section"
  format='regular'
/>

2. Start the migration in the Passwork web interface and wait for it to finish:

<ImageComponent
  src={'/img/assets/migration-to-passwork-7-initial-data-migration-4-w9i8uth2.png'}
  alt="Starting the migration in the web interface"
  format='regular'
/>

## Preparing to move to the updated Docker build

1. Create a directory and change into it:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```bash
mkdir /server/migr_dir && cd /server/migr_dir
```

  </TabItem>
</Tabs>

2. Create a database backup:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```bash
cd /server/docker-compose
docker-compose exec -T db sh -c 'mongodump --archive' > "/server/migr_dir/p65.dump"
```

  </TabItem>
</Tabs>

3. Convert the version 6 configuration file into a version 7 configuration and a key file:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```bash
cd /server/migr_dir
wget https://repos.passwork.pro/repository/linux/scripts/config_convert.sh
chmod +x config_convert.sh
./config_convert.sh -i "/server/sites/prod/app/config/config.ini" -o "./"
rm config_convert.sh
```

  </TabItem>
</Tabs>

Example of the directory contents after the conversion:

<ImageComponent
  src={'/img/assets/faq-docker-migration-old-docker-to-7-1.png'}
  alt="Contents of migr_dir after the conversion"
  format='regular'
/>

4. If you use certificates, additionally:
   - Copy the SSL certificate and key: `(shopt -s nullglob; cp -f /server/conf/ssl/*.{crt,pem,key} .)`
   - Copy the LDAPS CA certificate: `(shopt -s nullglob; cp -f /server/conf/php8/*.{crt,pem} .)`

:::warning
We recommend performing the migration on a **new server**: it means less downtime, a clean installation, and the ability to roll back.

When migrating on the same server:
- The current Docker build requires Docker 18.06.0 and docker compose (instead of docker-compose).
- Choose an installation path **outside** **/server**
- Stop the current installation: **cd /server/docker-compose && docker-compose down nginx**.
:::

## Installing the current Docker build and Passwork 7

1. Confirm the migration in the Passwork [Customer Portal](https://portal.passwork.pro):

<ImageComponent
  src={'/img/assets/migration-to-passwork-7-migration-confirmation-on-customer-portal-2-w9i8uth2.png'}
  alt="Confirming the migration in the Customer Portal"
  format='regular'
/>

2. Install the current Docker build **without** going through the setup wizard — follow the [installation instructions](/standard-installation/linux/online-installation) up to the "Setup wizard" step.

:::danger
Do not open the web interface and do not run the setup. Otherwise the migration will be considered already completed and will not start, so as not to overwrite the data.
:::

3. Copy `config.env` and `encryption_key` from the `migr_dir` directory into `/<passwork>/conf/keys/` of the new installation.
4. If necessary, copy from `migr_dir`:
   - The SSL certificate to `/<passwork>/conf/ssl/fullchain.pem`
   - The SSL key to `/<passwork>/conf/ssl/privkey.pem`
   - The root certificate for LDAPS to `/<passwork>/conf/custom_ca/`
5. Create the `/<passwork>/backup` directory and move the `p65.dump` dump into it.
6. Restore the database from the backup: `./db-restore.sh p65.dump`
7. Apply the changes: `docker compose down && docker compose up -d`
8. Wait about a minute for the containers to start completely.
9. Start the migration:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```bash
docker compose exec -T php-fpm sh -c "cd /server/www && yes | php -d memory_limit=-1 bin/console database:v6:migration"
```

  </TabItem>
</Tabs>

10. After a successful migration, open `/<passwork>/conf/keys/config.env` in an editor:
    - Make sure `APP_URL` contains the final DNS address of the Passwork server.
    - Remove the block that was only used for the migration:

<ImageComponent
  src={'/img/assets/faq-docker-migration-old-docker-to-7-2.png'}
  alt="The block to remove from config.env after the migration"
  format='regular'
/>
