Connecting to Mariadb in an adjacent container on Synology Container Manager

Currently reading
Connecting to Mariadb in an adjacent container on Synology Container Manager

14
0
NAS
DS220+
Operating system
  1. Windows
Mobile operating system
  1. iOS
Last edited:
Hello:

I am using Synology Container Manager. I have two containers only. One with ProjectSend and one with Mariadb. Both containers are up and running (according to Container Manager).

When first accessing ProjectSend from Firefox, you have to connect ProjectSend to its database. There is a CHECK button and once things pass muster you can move on and start using ProjectSend. Trouble is I can not get it to connect.

The ProjectSend's "Database Configuration" GUI checks the Host, Database name, Username, and Password. None of these are confirming. I am trying to get all green checks.

project_send_db_config.jpg


Using SSH from another PC, I have accessed the Synology, and then the Container, and then MariaDB itself. I can interact with Mariadb using SSH. With my limited knowledge and lots of web research I have queried some things. It seems my user accounts (two of them: root and another one) are there and they are both marked as % which I interpret to mean these users, if password is correct, can come into Mariadb from anywhere.

I have also included in my compose file the following command:--default-authentication-plugin=mysql_native_password
in order to tell MariaDB to accept a SHA1 password which is apparently what's required by ProjectSend. I also executed this command directly by SSH while logged in as root to the database. (Not sure about this detail, to be honest).

From the red check marks it would seem that ProjectSend can't even find the host, much less authenticate. I have tried various things for the host field, including

localhost
the Mariadb container's IP
MariaDB
mariadb
db
mariadb-projectsend
all of the above with the :3306 port attached, just for grins.


Synology Container Manager has created a network called "projectsend_default" and both containers are included in this "network" which is using 172.17.X.X.

Both images used for container creation were the "latest" from the image registry and both appeared to install without issue (Error code=0).

I have stopped and started the containers. I also tried starting MariaDB first and waiting a few minutes then started ProjectSend.

Does anyone have some ideas why ProjectSend inside its container can't see MariaDB in the adjacent container?

Many thanks in advance.

______________________________________
For reference, the compose file:


Code:
version: "2.1"
services:
  projectsend:
    image: linuxserver/projectsend
    container_name: projectsend
    environment:
      - PUID=998
      - PGID=100
      - TZ=America/Denver
      - MAX_UPLOAD=5000
    volumes:
      - /volume1/docker/projectsend/config:/config #Config Volume Goes Here
      - /volume1/docker/projectsend:/data #File Storage Volume Goes Here
    ports:
      - 8010:80
    restart: unless-stopped
  db:
    image: mariadb
    container_name: mariadb-projectsend
    environment:
      MYSQL_ROOT_PASSWORD: xxxxx
      MYSQL_DATABASE: projectsend
      MYSQL_USER: user
      MYSQL_PASSWORD: xxxxx
      TZ: America/Denver
    volumes:
      - /volume1/docker/projectsend/mariadb:/var/lib/mysql #Database Volume Goes Here
    ports:
      - "3306:3306"
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
 
Last edited:
Use the compose examples from linuxserver.io, then move on to customize as you like once functionality is proven.

I presume this is run through a single Container Manager “Project”, and not separate projects.

When posting compose files, use the code blocks so that proper indenting is preserved. I cannot tell from your post whether your compose file is functional.
 
Thank you for your thoughts.

Yes indeed it is one project that created two containers. The compose text was indented properly and I started with a working example. Both containers installed without issue (error code=0) and they are running. I can go into MariaDB via SSH and it's running and working. ProjectSend can not attach to Mariadb is all.

I will see if I can find a way to post the indented file. When I edit it above, it IS indented. But when I save, it isn't indented.
 
To be honest, I didn't even know what ProjectSend is (looks interesting though) but searching on it I found that in some examples they use the name of the service instead of the IP.
Try inserting db instead of the database container IP.
 
Thank for your formatting it properly!

User defined networks, like those created by docker compose, have built-in dns-based service discovery. You can either use the service name db or container name mariadb-projectsend as hostname when accessing the database container from the projectsend container.

The username must be the value of MYSQL_USER from the db container.
The password must bethe value of MYSQL_PASSWORD from the db container.
 
I will see if I can find a way to post the indented file. When I edit it above, it IS indented. But when I save, it isn't indented.
 
Last edited:
Thank for your formatting it properly!

User defined networks, like those created by docker compose, have built-in dns-based service discovery. You can either use the service name db or container name mariadb-projectsend as hostname when accessing the database container from the projectsend container.

The username must be the value of MYSQL_USER from the db container.
The password must bethe value of MYSQL_PASSWORD from the db container.
I was previously trying user root and the root password. I also tried your suggestion of using the values for... MYSQL_USER and MYSQL_PASSWORD but that didn't work either. For the host, I forgot to mention I had also tried db and db:3306.

I saw a YT vid where YouTuber DB Tech had a similar issue and it was some kind of time zone problem that was solved by restarting his containers. As mentioned above I have tried restarting my containers various ways with no luck.

Inside the ProjectSend log upon startup I do get 3 errors and perhaps this would suggest something. Maybe whatever is causing these errors is also causing my db connection problem.

2023/12/14 12:25:59stdout[ls.io-init] done.
2023/12/14 12:25:59stderrmv: cannot stat '/app/www/public/templates/pinboxes/lang': No such file or directory
2023/12/14 12:25:59stderrmv: cannot stat '/app/www/public/templates/gallery/lang': No such file or directory
2023/12/14 12:25:59stdout[custom-init] No custom files found, skipping...
2023/12/14 12:25:58stderrmv: cannot stat '/app/www/public/templates/default/lang': No such file or directory
2023/12/14 12:25:58stdoutusing keys found in /config/keys
 
Last edited:
Is this related...

0mlhUuS.png


So this ???

Code:
version: "2.1"
services:
  projectsend:
    image: lscr.io/linuxserver/projectsend:r1053-ls27
    container_name: projectsend
    depends_on:
      - mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - MAX_UPLOAD=5000
      - DB_HOST=mariadb
      - DB_USER=CHANGEME
      - DB_PASS=CHANGEMEPASSWORD
      - DB_NAME=projectsend
      - DB_PORT=3306
    volumes:
      - <path to data>:/config
      - <path to data>:/data
    ports:
      - 8088:80
    restart: unless-stopped
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=CHANGEME_ROOT_ACCESS_PASSWORD
      - TZ=Europe/London
      - MYSQL_DATABASE=projectsend #optional
      - MYSQL_USER=CHANGEME #optional
      - MYSQL_PASSWORD=CHANGEME #optional
    volumes:
      - <path to data>:/config
    ports:
      - 3306:3306
    restart: unless-stopped
 
Is this related...

0mlhUuS.png


So this ???

Code:
---
version: "2.1"
services:
  projectsend:
    image: lscr.io/linuxserver/projectsend:r1053-ls27
    container_name: projectsend
    depends_on:
      - mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - MAX_UPLOAD=5000
      - DB_HOST=mariadb
      - DB_USER=CHANGEME
      - DB_PASS=CHANGEMEPASSWORD
      - DB_NAME=projectsend
      - DB_PORT=3306
    volumes:
      - <path to data>:/config
      - <path to data>:/data
    ports:
      - 8088:80
    restart: unless-stopped
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=CHANGEME_ROOT_ACCESS_PASSWORD
      - TZ=Europe/London
      - MYSQL_DATABASE=projectsend #optional
      - MYSQL_USER=CHANGEME #optional
      - MYSQL_PASSWORD=CHANGEME #optional
      #- REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql #optional
    volumes:
      - <path to data>:/config
    ports:
      - 3306:3306
    restart: unless-stopped

Hmmm. I do not believe that is related. MSSQL is Microsoft SQL. As I understand it MariaDB is a open source fork off the original SQL (owned by Oracle now). I think MSSQL is another database type entirely.
 
- DB_HOST=mariadb - DB_USER=CHANGEME - DB_PASS=CHANGEMEPASSWORD - DB_NAME=projectsend - DB_PORT=3306
This is what immediately hits the eye!

If the environment variables do what they look like, they should pre-setup the database connection.

Note: one the database is created, configuration changes to the compose file environment variables on the MariaDB container won't be propagated to the database.
 
Last edited:
I just looked at the Github project: GitHub - linuxserver/docker-projectsend

There is no evidence that DB_ variables are used. Heck, the database configuration is nowhere mentioned in the description, except the comment about mssql not being supported anymore.

The projectsend documentation does not mention the variables either. I think it's safe to say they have no effect, and the configuration is meant to be done using the ui.

I was previously trying user root and the root password. I also tried your suggestion of using the values for... MYSQL_USER and MYSQL_PASSWORD but that didn't work either. For the host, I forgot to mention I had also tried db and db:3306.
It should have worked. You might want to stop the compose project, cleanup the host folders you bind to the container paths and start from scratch
-- post merged: --

I just tested it, and of course it works like a charm:

Code:
version: "2.1"
services:
  projectsend:
    image: linuxserver/projectsend
    container_name: projectsend
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Berlin
      - MAX_UPLOAD=5000
    volumes:
      - /volume1/docker/projectsend/config:/config 
      - /volume1/docker/projectsend/data:/data
    ports:
      - 8010:80
    restart: unless-stopped
  db:
    image: mariadb
    container_name: mariadb-projectsend
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: projectsend
      MYSQL_USER: projectsend
      MYSQL_PASSWORD: projectsend
      TZ: Europe/Berlin
    volumes:
      - /volume1/docker/projectsend/mariadb:/var/lib/mysql #Database Volume Goes Here
    ports:
      - "3306:3306"
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
 
Last edited:
I'm curious as to its source, as it seems there is no linkage between your containers.
My source for it was a YouTube video here:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

View: https://youtu.be/ohkpCf9DrCI?si=ZV8yY6sh6brEbr-v

Please note that this YouTuber is not using Container Manager which was introduced after the video's publishing. I still found it generally helpful.
-- post merged: --

I just looked at the Github project: GitHub - linuxserver/docker-projectsend

There is no evidence that DB_ variables are used. Heck, the database configuration is nowhere mentioned in the description, except the comment about mssql not being supported anymore.

The projectsend documentation does not mention the variables either. I think it's safe to say they have no effect, and the configuration is meant to be done using the ui.


It should have worked. You might want to stop the compose project, cleanup the host folders you bind to the container paths and start from scratch
-- post merged: --

I just tested it, and of course it works like a charm:

Code:
version: "2.1"
services:
  projectsend:
    image: linuxserver/projectsend
    container_name: projectsend
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Berlin
      - MAX_UPLOAD=5000
    volumes:
      - /volume1/docker/projectsend/config:/config
      - /volume1/docker/projectsend/data:/data
    ports:
      - 8010:80
    restart: unless-stopped
  db:
    image: mariadb
    container_name: mariadb-projectsend
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: projectsend
      MYSQL_USER: projectsend
      MYSQL_PASSWORD: projectsend
      TZ: Europe/Berlin
    volumes:
      - /volume1/docker/projectsend/mariadb:/var/lib/mysql #Database Volume Goes Here
    ports:
      - "3306:3306"
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
Thank you for this, @one-eyed-king. Very helpful. I have already started from scratch once before and am certainly willing to do it again. I will try it. Are you using Container Manager on Synology? (I just want to know in case CM is introducing some unique issue on my end.)

You are correct that some of the variables are set by ProjectSend in a GUI that pops up when you first enter ProjectSend. The reason I asked @Telos where he found his compose script (he didn't answer where) is that I had not seen those "DB_" variables before and I was looking to learn something about them. Might it be that those DB_ variables are created by ProjectSend's start-up GUI? Maybe someone who knew that to be true set them in their compose file in advance?

Examining your compose script, I am looking for any difference that jumps out to me between yours and the one I have been using. I see you changed the PUID and TZ values. Also, you added a data folder under /projectsend that I didn't have. I don't see anything else. I will proceed to delete the project and the associated folders and start from scratch again using your changes and post the results here.
 
My source for it was a YouTube video here:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

View: https://youtu.be/ohkpCf9DrCI?si=ZV8yY6sh6brEbr-v

Please note that this YouTuber is not using Container Manager which was introduced after the video's publishing. I still found it generally helpful.


Another source would be the guide from Marius.
Just tested myself and works OK.

The guide has reference to Portainer but can be used as is in a Container Manager project.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

  • Solved
I haven't thought about it as a file system level cache. If it is, it would make sense that both benefit...
Replies
8
Views
3,902
I'm not sure why I get that 172.17-address or if there's a way to change that...?
Replies
20
Views
6,270
Frustrating indeed. I will read further and try to discover what is all about. Thanks for your sincere...
Replies
20
Views
8,565
I registered and want to post this for the sake of anyone who might come along looking for answers like I...
Replies
10
Views
13,579

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top