Database in Docker seems to be empty

Thanks, yes that achieves what I want.

Something that confuses me when I do a Quote or an Invoice:

When I create a product with the tax for the product set to none, and then I add the product to say an Invoice, the tax still appears by default. I have to set the tax rate to none in the Invoice form … is this mean’t to happen?

Ii’ll take a look this weekend

Hi @UnderDog did you get a chance to look at this? Thanks.

Also, is it normal when installing Invoiceplane, that it increases the OS size by about 6G, seems to install heaps of packages … (I had to do a re-install of the OS, as I broke my server) I also got the following error when I tried to get into my Invoiceplane webpage i.e port 8085. The invoiceplane folder was on a completely different drive than my OS, so should not have been affected by my OS re-install.

Screenshot 2023-08-01 at 8.49.00 AM

1 Like

Your database is missing one of the most important tables. Check the database, to see if any tables exist

Also, is it normal when installing Invoiceplane, that it increases the OS size by about 6G

I wouldn’t know about the OS beging grown 6GB. I install InvoicePlane every weekend (on Debian) and don’t encounter that problem

seems to install heaps of packages

My interpretation of ‘packages’ is the packages in composer json
There’s very few in there.
If you think of packages as node/json packages, then they’re in package.json. they’re only needed to compile css and js, but we can talk about that another time

I wouldn’t know about the OS beging grown 6GB. I install InvoicePlane every weekend (on Debian) and don’t encounter that problem

I am using Casaos, which is a cut down debian server install. It installs at approx 9GB, when I installed ran Invoiceplane on the newly installed OS, it downloaded approx 200 debian packages, adding 6G to the OS, obviously dependancies it needed, it also compiled lots of programs as well.

Your database is missing one of the most important tables. Check the database, to see if any tables exist

I don’t know anything about databases, I don’t even know how to get into phpmyadmin, as the usual username passwords don’t work. What should they be?

By the way, what should the owner/permissions be on all files in ip directory? Just in case they changed …

Will I have to redo the whole thing from scratch? Or, is there a way to fix the database?

Here is the startup, note there is a couple of warnings:

[+] Running 5/5
 ✔ Network ip_invoiceplane         Created                                                                                                                                                                   0.2s 
 ✔ Container invoiceplane-db       Created                                                                                                                                                                   0.2s 
 ✔ Container invoiceplane-php      Created                                                                                                                                                                   0.1s 
 ✔ Container invoiceplane-dbadmin  Created                                                                                                                                                                   0.2s 
 ✔ Container invoiceplane-nginx    Created                                                                                                                                                                   0.1s 
Attaching to invoiceplane-db, invoiceplane-dbadmin, invoiceplane-nginx, invoiceplane-php
invoiceplane-db       | 2023-08-02 08:25:45+12:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.4+maria~ubu2204 started.
invoiceplane-db       | 2023-08-02 08:25:46+12:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
invoiceplane-db       | 2023-08-02 08:25:46+12:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.4+maria~ubu2204 started.
invoiceplane-db       | 2023-08-02 08:25:47+12:00 [Note] [Entrypoint]: MariaDB upgrade not required
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] Starting MariaDB 10.11.4-MariaDB-1:10.11.4+maria~ubu2204 source revision 4e2b93dffef2414a11ca5edc8d215f57ee5010e5 as process 1
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Number of transaction pools: 1
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
invoiceplane-db       | 2023-08-02  8:25:47 0 [Warning] mysqld: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)
invoiceplane-db       | 2023-08-02  8:25:47 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Completed initialization of buffer pool
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
invoiceplane-dbadmin  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.16. Set the 'ServerName' directive globally to suppress this message
invoiceplane-dbadmin  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.16. Set the 'ServerName' directive globally to suppress this message
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: 128 rollback segments are active.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: log sequence number 47030; transaction id 16
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] Plugin 'FEEDBACK' is disabled.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
invoiceplane-db       | 2023-08-02  8:25:47 0 [Warning] 'default-authentication-plugin' is MySQL 5.6 / 5.7 compatible option. To be implemented in later versions.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] InnoDB: Buffer pool(s) load completed at 230802  8:25:47
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] Server socket created on IP: '0.0.0.0'.
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] Server socket created on IP: '::'.
invoiceplane-php      | [02-Aug-2023 08:25:47] NOTICE: fpm is running, pid 1
invoiceplane-php      | [02-Aug-2023 08:25:47] NOTICE: ready to handle connections
invoiceplane-db       | 2023-08-02  8:25:47 0 [Note] mysqld: ready for connections.
invoiceplane-db       | Version: '10.11.4-MariaDB-1:10.11.4+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
invoiceplane-nginx    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
invoiceplane-nginx    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
invoiceplane-nginx    | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
invoiceplane-dbadmin  | [Tue Aug 01 20:25:47.872480 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.2.8 configured -- resuming normal operations
invoiceplane-dbadmin  | [Tue Aug 01 20:25:47.872599 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
invoiceplane-nginx    | /docker-entrypoint.sh: Configuration complete; ready for start up

So you did a docker install, which is awesome, but that explains that 6GB usage.
Check the command docker images, it should give you the used size per image.
There are a couple of other docker commands which will remove some of the intermediary images (remove-dangling=true)
Google for “docker remove unused images” (something like that)

Getting to your phpmyadmin: Go to http://localhost:8081, it will get you there.
username and password are in the file called docker-compose.yml:

- MYSQL_USER=ipdevdb
- MYSQL_PASSWORD=ipdevdb
- MYSQL_ROOT_PASSWORD=ipdevdb

You do not have to do anything from scratch

File permissions: 755 for directories, 644 for files, but i wouldn’t touch it yet.
Just howler if you get permissions troubles

I only see 2.5G in image sizes for all ip-* images
There are no dangling images docker image prune, doing a docker system prune -a got me back 1G

File permissions: 755 for directories, 644 for files, but i wouldn’t touch it yet.

What about owner, should all files be myuser:myuser?

I tried those login details previously does not work . I am at a loss of how to fix this @UnderDog

phpmyadmin:
try root/root to log in to phpmyadmin

file ownership:
It’s purely that the files work on the docker system. During creation of the docker containers the user with id=1000 (which is hopefully your user on your debian system) gets attached to the user in the container

What about owner, should all files be myuser:myuser

Yes, during creation of the docker containers the chown command is performed inside those containers.

Personally i wouldn’t touch the file permissions and chown part. All files have the proper permissions at this moment.

Focus on logging in in phpmyadmin.

Let me be clear on how far i can go with supporting you witn your problem:

  • docker-compose up should work flawlessly
  • I can explain things that are done in the Dockerfiles
  • I can help you try and log in to phpmyadmin

After you run chown, chmod, things like that on any part of your system or inside containers, i cannot help you.

About your database:
There is a chance, thag when you do docker-compose down -v that the database that you had gets lost.
As soon as you log into your phpmyadmin and get your InvoicePlane up and running again, just make a backup of your database

root/root does not work. Nor does user=root/pass=ipdevdb

Yes, id=1000

What is the preferred way to backup the database (when I get it going)?

What is the preferred way to backup the database

For your situation the best way is via phpmyadmin to “export” thr database.

First you have to get into phpmyadmin:
docker-compose exec db bash
It will get you inside the mariadb container

mysql -uroot (enter, enter). What happens when you do that?

I get the following:

sudo docker compose exec db bash
[sudo] password for casaos: 
root@6d951ca49ffd:/# 
root@6d951ca49ffd:/# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@6d951ca49ffd:/# 

perfect!
You’re almost there.
So … still in that db container:

mysql -uroot -p (enter)
Now you’ll have to try a couple of passwords:

  • root
  • ipdevdb
    If both don’t work, i need to see your docker-compose.yml
    I’m aware that you’ve tried the passwords before, but right now you’re in the db container and you’re not trying it through phpmyadmin.

I’m interested in the results

ipdevdb worked, I am in the database, what next?
MariaDB [(none)]>

what next

Now the tricky part:
back to phpmyadmin and try in with those credentials that worked.

If they still don’t work, i need to see your docker-compose.yml file

Hi, that password did not work in phpmyadmin. Here is the docker-compose.yml:

version: "3"

networks:
  invoiceplane:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.25.0.0/17

volumes:
  invoiceplane-db:
    driver: "local"
  nginx_logs:
    driver: "local"

services:
  # --- PHP 8.1
  php:
    container_name: "invoiceplane-php"
    build:
      context: ./resources/docker/php-fpm
      args:
        - PUID=1000
        - PGID=1000
        - TZ=Pacific/Auckland
    links:
      - db
    expose:
      - "9000"
    dns: 8.8.8.8
    depends_on:
      - db
    networks:
      invoiceplane:
        ipv4_address: 172.25.0.11
    volumes:
      - .:/var/www/projects/invoiceplane:delegated
      - ./resources/docker/php-fpm/php-dev.ini:/usr/local/etc/php/php.ini

  # --- nginx 1.23
  nginx:
    container_name: "invoiceplane-nginx"
    build:
      context: ./resources/docker/nginx
    links:
      - php
    ports:
      - "8085:80"
    dns: 8.8.8.8
    depends_on:
      - php
    networks:
      invoiceplane:
        ipv4_address: 172.25.0.12
    volumes:
      - .:/var/www/projects/invoiceplane:delegated
      - nginx_logs:/var/log/nginx
      - ./resources/docker/nginx/invoiceplane.conf:/etc/nginx/conf.d/invoiceplane.conf:ro

  # --- MariaDB 10.9
  db:
    container_name: "invoiceplane-db"
    build:
      context: ./resources/docker/mariadb
    environment:
      - MARIADB_ROOT_PASSWORD=ipdevdb
      - MARIADB_USER=ipdevdb
      - MARIADB_PASSWORD=ipdevdb
      - MARIADB_DATABASE=invoiceplane_db
      - TZ=Pacific/Auckland
    ports:
      - "3306:3306"
    networks:
      invoiceplane:
        ipv4_address: 172.25.0.13
    volumes:
      - "invoiceplane-db:/var/lib/mysql"

  phpmyadmin:
    container_name: "invoiceplane-dbadmin"
    build:
      context: ./resources/docker/phpmyadmin
    environment:
      - PMA_HOST=invoiceplane-db
      - PMA_USER=root
      - PMA_PASSWORD=ipdevdb
      - PMA_ROOT_PASSWORD=ipdevdb
      - MYSQL_DATABASE=invoiceplane_db
      - MYSQL_USER=ipdevdb
      - MYSQL_PASSWORD=ipdevdb
      - MYSQL_ROOT_PASSWORD=ipdevdb
      - MAX_EXECUTION_TIME=600
      - MEMORY_LIMIT=256M
      - UPLOAD_LIMIT=2G
    depends_on:
      - db
    links:
      - db
    restart: always
    volumes:
      - ./resources/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
      - ./resources/docker/databases:/var/www/html/tmp/upload_databases
    ports:
      - "8081:80"
    networks:
      invoiceplane:
        ipv4_address: 172.25.0.16

@UnderDog You around for comment? Thanks.

Interesting thing: I did a status command inside the database via the shell, and it does not seem to know the name of the current database.

MariaDB [(none)]> status;
--------------
mysql  Ver 15.1 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

Connection id:		13
Current database:	
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.11.4-MariaDB-1:10.11.4+maria~ubu2204 mariadb.org binary distribution
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb3
Conn.  characterset:	utf8mb3
UNIX socket:		/run/mysqld/mysqld.sock
Uptime:			1 day 2 hours 58 min 9 sec
1 Like

it does not seem to know the name of the current database

It looks like we’re looking at 2 different instances of MariaDB, but that’s strange, because then there would have been a conflict with port numbers.

In your MySQL console, type show databases. Let’s see if there are any.

Also open up resources/docker/phpmyadmin/config.user.inc.php and look at the ‘host’. Is it set to localhost?

MariaDB [(none)]> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| invoiceplane_db    |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.087 sec)

Yes $cfg['Servers'][$i]['host'] = 'localhost';

1 Like

So - MARIADB_DATABASE=invoiceplane_db results in | invoiceplane_db |, which is awesome.

Change the setting in configmuser.inc.php to $cfg['Servers'][$i]['host'] = 'db'; (not `invoiceplane-db, yet), it’s the service name you need, not the container name

This: - "invoiceplane-db:/var/lib/mysql", let’s change that.
Pick a location, let’s say inside the invoiceplane directory, for example ‘database’:
- "./database:/var/lib/mysql"

Then docker-compose down -v and docker-compose up or docker-compose up -d

The ‘invoiceplane_db’ database is still empty, like it was with your error message.
In order to fill it, you have to change the config (and basically re-install):
DISABLE_SETUP=false and SETUP_COMPLETED=false

If you then go to /setup it will let you run through a new setup.
The data should stay in the ‘database’ directory, even after you do docker-compose down -v (-v removes volumes)

ok, so I changed the localhost to db right, I have done that, now what?
restart containers?

Ok, I see you added more. So I go through all those steps including the setup, but won’t it trash my original database?