Skip to content

Problem: migration from boltdb to postgresql crashes on user creation - semaphore-2.18.2 #3873

@helioloureiro

Description

@helioloureiro

Issue

When I attempt to migrate to postgres, it gets and error:

# ./semaphore-2.18.2 migrate --from-boltdb /var/lib/semaphore/database.boltdb --config /etc/semaphore/config-postgres.json
Postgres semaphore_user@localhost semaphore
File is too big  11936063488
Starting migration...
Exporting User                                 100%
Exporting Project                              100%
Exporting Task                                 100%
Exporting Event                                100%
Exporting TaskOutput                           100%
Exporting Integration                          100%
Exporting Option                               100%
Exporting Runner                               100%
Exporting AccessKey                            100%
Exporting Environment                          100%
Exporting Repository                           100%
Exporting View                                 100%
Exporting IntegrationAlias                     100%
Exporting Template                             100%
Exporting TemplateVault                        100%
Exporting TemplateRole                         100%
Exporting SecretStorage                        100%
Exporting Inventory                            100%
Exporting Schedule                             100%
Exporting ProjectUser                          100%
Exporting IntegrationMatcher                   100%
Exporting Role                                 100%
Exporting IntegrationExtractValue              100%
Importing Project                              100%
Importing SecretStorage                        100%
Importing User                                 0%
Migration failed: failed to import User: pq: duplicate key value violates unique constraint "user_username_key" (23505)

The migration configuration:

{
  "bolt": {
    "host": "/var/lib/semaphore/database.boltdb"
  },
  "dialect": "postgres",
  "cookie_hash": "[redacted]",
  "cookie_encryption": "[redacted]",
  "access_key_encryption": "[redacted]",
  "web_host": "https://semaphore.[redacted]",
  "postgres": {
          "host": "localhost",
          "name": "semaphore",
          "user": "semaphore_user",
          "pass": "[redacted]"
  }
}

In the past I installed admin and my own account helio with the same email. But it has been changed. I even tried to delete user admin, but I couldn't pass the error.

Also the database is quite large, 11 GB at the current time.

Impact

Other

Installation method

Binary

Database

BoltDB

Browser

Chrome

Semaphore Version

2.18.2-db3ac46-1778154092

Ansible Version

Logs & errors

No response

Manual installation - system information

No response

Configuration

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions