nuxsmin / sysPass

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

Migrating from normal installation to docker container #1877

Open adocampo opened 1 year ago

adocampo commented 1 year ago

sysPass Version 3.2.11

Describe the question I'm migrating all my services from legacy virtual machines to docker containers. I'm facing issues with syspass as I'm not able to connect to the external database (which I want to keep in a VM at least as for now) with the installer.

I saw there is no environment variable to specify an external MySQL database on the Dockerfile, so I just removed all the db settings on that Dockerfile and tried to run the container just without it, and specify my external database on the installation wizard.

As I was afraid to break something, I'd created a second blank database syspass2 with the very same credentials and granted permissions, but I don't know why, I wasn't able to complete the installation wizard, yet I could reach the database host and port, and double-checked the credentials.

What I'd tried first was to copy the config.xml file from production syspass to the docker version, but it gave a blank screen saying Template does not contain files. My bet was because my production syspass instance has a path with all lower case while docker has the directory syspass as "sysPass" (instead of "syspass"), I did a grep, and it was shown on so many places I desisted to follow that way.

So I did a mysqldump from syspass database and restored into syspass2 database, modified config.xml to point to that database, and also changed the "Installed" parameter on config.xml so now the login screen appears, but I'm not able to login.

I also have LDAP (AD) configured, so I also copied the settings from the syspass VM instance to the docker instance config.xml and I tried with an LDAP user, entered the credentials and it says Your previous password is needed and a screen like this appears image

So, I'm really having a bad time migrating syspass, I would appreciate any advice

schieck0 commented 1 year ago

Same problem migrating from 3.1 to 3.2.11-docker. My problems are:

Nebucatnetzer commented 1 year ago

I used the following docker-compose.yml successfully:

version: '3'
services:
  syspass:
    container_name: syspass
    image: syspass/syspass:3.2.11-php7.4
    restart: unless-stopped
    ports:
      - 80:80
    volumes:
      - SOME_PATH/config:/var/www/html/sysPass/app/config
      - SOME_PATH/backup:/var/www/html/sysPass/app/backup
    environment:
      - USE_SSL=no
      - COMPOSER_EXTENSIONS=syspass/plugin-authenticator:^v2.2
    extra_hosts:
      - "host.docker.internal:host-gateway"
    logging:
      driver: journald
      options:
        tag: syspass

The value for dbHost is set to host.docker.internal because I have MariaDB running natively on the same server and not in a container. To migrate the DB I used the mariabackup tool.