Rabbit-Company / Passky-Server

Server for Passky (password manager)
https://passky.org
GNU General Public License v3.0
166 stars 22 forks source link

Upgrade to v7.1.0 makes my passky unavailable #17

Closed dlazzy closed 1 year ago

dlazzy commented 1 year ago

Since I've upgraded my passky server to 7.1.0 it's not working anymore. I don't remember the previous version I was using.

Steps to upgrade :

sudo docker-compose pull
sudo docker-compose up -d

This is the logs from Docker (using docker logs container_id) :

2022-11-08 07:36:10+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.
2022-11-08 07:36:11+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-11-08 07:36:11+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.
2022-11-08 07:36:11+00:00 [Note] [Entrypoint]: MariaDB upgrade (mariadb-upgrade) required, but skipped due to $MARIADB_AUTO_UPGRADE setting
2022-11-08  7:36:11 0 [Note] mariadbd (server 10.8.3-MariaDB-1:10.8.3+maria~jammy) starting as process 17 ...
2022-11-08  7:36:11 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-11-08  7:36:11 0 [Note] InnoDB: Number of transaction pools: 1
2022-11-08  7:36:11 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-11-08  7:36:11 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-11-08  7:36:11 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2022-11-08  7:36:11 0 [Note] InnoDB: Completed initialization of buffer pool
2022-11-08  7:36:11 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2022-11-08  7:36:11 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.7.3.
2022-11-08  7:36:11 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-11-08  7:36:11 0 [Note] InnoDB: Starting shutdown...
2022-11-08  7:36:11 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-11-08  7:36:11 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-11-08  7:36:11 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-11-08  7:36:11 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-11-08  7:36:11 0 [ERROR] Aborting

Distribution details :

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy

Thank you for the help, my passwords are unavailable for now.

zigazajc007 commented 1 year ago

Hello,

Passky Server will always use the latest MariaDB docker image and when you are executing sudo docker-compose pull command it will switch to the newest MariaDB image.

If you don't have a backup of your database, I would suggest you to switch back to MariaDB 10.7.3 and perform a backup first.

From your logs it seems that MariaDB needs to perform an upgrade, but it doesn't because the MARIADB_AUTO_UPGRADE variable is not set.

To set MARIADB_AUTO_UPGRADE variable add it to docker-compose.yml file.

  passky-database:
    container_name: passky-database
    image: 'rabbitcompany/passky-database:latest'
    restart: unless-stopped
    environment:
      #
      # Change environment variables in .env file
      # You can also run an installer.sh that would auto generate .env file
      # or run installerGUI.sh for graphical configuration.
      #
      # Database
      - MYSQL_DATABASE
      - MYSQL_USER
      - MYSQL_PASSWORD
      - MYSQL_ROOT_PASSWORD
      # Backup
      - BACKUP_ENABLED
      - BACKUP_HOST
      - BACKUP_PORT
      - BACKUP_USER
      - BACKUP_PASSWORD
      - BACKUP_LOCATION
      - MARIADB_AUTO_UPGRADE=unquestionably
    volumes:
      - /passky:/var/lib/mysql
    networks:
      - passky

If upgrade will work, I will include this variable in docker-compose.yml file by default.

dlazzy commented 1 year ago

Thank you for your answer.

Unfortunately this does not work, after adding - MARIADB_AUTO_UPGRADE=unquestionably into the docker-compose.yml file and run again docker-compose pull && docker-compose up -d the database container is in restarting loop.

2022-11-08 09:25:25+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.
2022-11-08 09:25:25+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-11-08 09:25:25+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.3+maria~jammy started.
2022-11-08 09:25:26+00:00 [Note] [Entrypoint]: Starting temporary server
2022-11-08 09:25:26+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-11-08  9:25:26 0 [Note] mariadbd (server 10.8.3-MariaDB-1:10.8.3+maria~jammy) starting as process 60 ...
2022-11-08  9:25:26 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-11-08  9:25:26 0 [Note] InnoDB: Number of transaction pools: 1
2022-11-08  9:25:26 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-11-08  9:25:26 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-11-08  9:25:26 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2022-11-08  9:25:26 0 [Note] InnoDB: Completed initialization of buffer pool
2022-11-08  9:25:26 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2022-11-08  9:25:26 0 [ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.7.3.
2022-11-08  9:25:26 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-11-08  9:25:26 0 [Note] InnoDB: Starting shutdown...
2022-11-08  9:25:26 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-11-08  9:25:26 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-11-08  9:25:26 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-11-08  9:25:26 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-11-08  9:25:26 0 [ERROR] Aborting

I did not understand how to downgrade to MariaDB 10.7.3 ? I've looked here without success https://hub.docker.com/r/rabbitcompany/passky-database/tags

Thank you for your help.

zigazajc007 commented 1 year ago

In this case I would suggest you to download all files and build docker container from a source code.

  1. Download the project (wget https://github.com/Rabbit-Company/Passky-Server/archive/refs/heads/main.zip)
  2. Extract it (unzip main.zip)
  3. Navigate to the folder (cd Passky-Server-main)

Now in a folder called database you will see a file called Dockerfile. So if you open this file you will see in the first line:

 FROM mariadb:latest

Change this to:

 FROM mariadb:10.7.3

Now you can navigate back to Passky-Server-main folder and execute:

sudo docker-compose -f docker-compose-build-from-source.yml up -d

I won't use latest tag anymore to avoid this problem.

dlazzy commented 1 year ago

It seems to start the container now. Unless I don't have previous password.

But the main problem is that I can't sign in or sign up. The Android application / Chrome extension show me "Something went wrong while connecting to the database!"

This is the logs from the passky api container :

Starting periodic command scheduler: cron.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message
[Tue Nov 08 10:08:49.037014 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.1.12 configured -- resuming normal operations
[Tue Nov 08 10:08:49.037117 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.21.0.1 - - [08/Nov/2022:10:09:00 +0000] "OPTIONS /?action=getToken HTTP/1.0" 200 710 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
172.21.0.1 - dlazzy [08/Nov/2022:10:09:00 +0000] "POST /?action=getToken HTTP/1.0" 200 756 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
172.21.0.1 - dlazzy [08/Nov/2022:10:09:26 +0000] "POST /?action=getToken HTTP/1.0" 200 756 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
172.21.0.1 - dlazzy [08/Nov/2022:10:09:30 +0000] "POST /?action=getToken HTTP/1.0" 200 756 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
172.21.0.1 - - [08/Nov/2022:10:11:50 +0000] "OPTIONS /?action=getToken HTTP/1.0" 200 710 "-" "Mozilla/5.0 (Linux; Android 11; SM-A405FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36"
172.21.0.1 - dlazzy [08/Nov/2022:10:11:50 +0000] "POST /?action=getToken HTTP/1.0" 200 756 "-" "Mozilla/5.0 (Linux; Android 11; SM-A405FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36"
172.21.0.1 - - [08/Nov/2022:10:12:20 +0000] "OPTIONS /?action=createAccount HTTP/1.0" 200 710 "-" "Mozilla/5.0 (Linux; Android 11; SM-A405FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36"
172.21.0.1 - dlazzy [08/Nov/2022:10:12:20 +0000] "POST /?action=createAccount HTTP/1.0" 200 756 "-" "Mozilla/5.0 (Linux; Android 11; SM-A405FN) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36"

And logs from the database container :

2022-11-08 10:08:48+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.3+maria~focal started.
2022-11-08 10:08:50+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-11-08 10:08:51+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.3+maria~focal started.
2022-11-08 10:08:51+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2022-11-08 10:08:51 0 [Note] mariadbd (server 10.7.3-MariaDB-1:10.7.3+maria~focal) starting as process 17 ...
2022-11-08 10:08:51 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-11-08 10:08:51 0 [Note] InnoDB: Number of transaction pools: 1
2022-11-08 10:08:51 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-11-08 10:08:51 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-11-08 10:08:51 0 [Note] InnoDB: Using Linux native AIO
2022-11-08 10:08:51 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-11-08 10:08:51 0 [Note] InnoDB: Completed initialization of buffer pool
2022-11-08 10:08:51 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=49574,49574
2022-11-08 10:08:52 0 [Note] InnoDB: Starting final batch to recover  16 pages from redo log.
2022-11-08 10:08:52 0 [Note] InnoDB: 128 rollback segments are active.
2022-11-08 10:08:52 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2022-11-08 10:08:52 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-11-08 10:08:52 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-11-08 10:08:52 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-11-08 10:08:52 0 [Note] InnoDB: 10.7.3 started; log sequence number 183680; transaction id 304
2022-11-08 10:08:52 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-11-08 10:08:52 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-11-08 10:08:52 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-11-08 10:08:52 0 [Note] InnoDB: Buffer pool(s) load completed at 221108 10:08:52
2022-11-08 10:08:52 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-11-08 10:08:52 0 [Note] Server socket created on IP: '::'.
2022-11-08 10:08:52 0 [Note] mariadbd: ready for connections.
Version: '10.7.3-MariaDB-1:10.7.3+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution

Correct version now!

It is running through a reverse proxy using Nginx. Which was working perfectly before. Here is the vhost :

server {
    server_name my_domain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
    }

    access_log /var/log/nginx/pass_access.log;
    error_log /var/log/nginx/pass_error.log;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/my_domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/my_domain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = my_domain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name my_domain.com;
    listen 80;
    return 404; # managed by Certbot
}
zigazajc007 commented 1 year ago

You also need to copy .env file from the previous passky server to the new one (the one built from source code).

.env file contains database name, username, passwords... that are needed in order to connect to the database.

dlazzy commented 1 year ago

You also need to copy .env file from the previous passky server to the new one (the one built from source code).

.env file contains database name, username, passwords... that are needed in order to connect to the database.

Oops I've forgot this file! :face_exhaling:

It's working now, thank you very much. I'll keep the method to build container from source code.

Closing the issue now.

zigazajc007 commented 1 year ago

Hello,

I have performed some tests and you can use mariadb:10.7 image. This will always use the latest image from 10.7 series. Current latest version in 10.7 series is 10.7.6 which works great with your database created in 10.7.3.

After some tests I didn't found any breaking change in the same series, so you can use mariadb:10.7 image and if you ever encounter the same compatibility issue, please create new bug report or respond to this one.