Docker installation on Synology Diskstation

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
lukasspy
Posts: 1
Joined: Fri Aug 16, 2019 3:53 pm

Docker installation on Synology Diskstation

Post by lukasspy »

Hi there,

the Synology Diskstation has a Docker app. I pulled the official dockerfile. Starting it up works just fine, but with SQLlite.
So I added the variables for mysql. I created the database, user, password. mysql is provided by MariaDB10 on the Diskstation.
The port is 3307 and the socket is /run/mysqld/mysqld10.sock or /run/mysqld/mysqld.sock
So my envirenment variables are:

MAYAN_DATABASE_ENGINE = django.db.backends.mysql
MAYAN_DATABASE_NAME = mayan
MAYAN_DATABASE_USER = mayan
MAYAN_DATABASE_PASSWORD = password
MAYAN_DATABASE_HOST = localhost
MAYAN_DATABASE_PORT = 3307

When I start up the container with the message.
django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysqld.sock\' (2 "No such file or directory")')

=> i suppose that this is because the socket is located at /run/mysqld/mysqld.sock and not /var/run/mysqld/mysqld.sock ?!?!?!

when I try to use 127.0.0.1 instead of localhost I get the following message
django.db.utils.OperationalError: (2003, 'Can\'t connect to MySQL server on \'127.0.0.1\' (111 "Connection refused")')

I hope anyone can help me here.
Is there a way to add the socket as a variable MAYAN_DATABASE_SOCKET or something like that?

Please help me :-)

Thanks in advance

(I read the other question about the synology diskstation. I think it is the same problem, but I hope that anyone can help me, since I added some more information about the errors .. )

nate7475
Posts: 3
Joined: Fri Aug 23, 2019 11:30 pm

Re: Docker installation on Synology Diskstation

Post by nate7475 »

A socket is just the term for ip + port

So,
ip 192.168.1.10
port 3307
socket 192.168.1.10:3307

What your error message is saying is that it's looking at the ip you listed and the port, and it's not there. What you can do is go to your database container and see what port it's listening on as you'll want to double check that it's actually 3307.

Jagosix
Posts: 4
Joined: Fri Mar 06, 2020 3:51 pm

Re: Docker installation on Synology Diskstation

Post by Jagosix »

Hello. My 1st post here. Kool
Anyways.. After painstaking hours of trials an error with Synology and Docker for Mayan-edms installation. I've finally got a great way to get you or any one else going.

Mayan-edms installation on Synology

1st off install docker before ANYTHING ELSE on Synology
If not, then you might run into some errors regarding port 80.
If so, then you must change the port to 8080. I will try to explain.

Log into Synology. then install Docker. After that goto Control Panel
click the Advance Mode. Open Terminal & SNMP. Check Enable Telnet service. Check Enable SSH service.
Then click Apply and close.

Now goto your computer (PC, Laptop). Goto your command line or terminal screen and ssh into your Synology system.
Like this ssh username@ipaddress. Example. username@192.168.2.36. It will ask for your admin password.
Once you log in , check the sysem by typing uname -r And you should get something like this.

Linux Jagology 4.4.59+ #24922 SMP PREEMPT Tue Jan 14 15:19:49 CST 2020 x86_64 GNU/Linux synology_apollolake_918+

Now a certain directory structure must be done properly in order for this to work correctly.

Type in this in order to see where you are. ls
Now type in cd / in order to get to the root system. Be careful in there.
Now type in ls you should see something like this.

bin dev etc.defaults lib lost+found opt run tmp var volumeUSB1
boot docker-volumes get-mayan-edms.sh lib32 mayan-edms proc sbin tmpRoot var.defaults
config etc initrd lib64 mnt root sys usr volume1


If So, then you're in the right place. Now on to creating the directories.
You must create this structure like so


/docker-volumes/mayan-edms/postgres . This is for the POSTGRES database.
/docker-volumes/mayan-edms/redis . This is for redis.
/docker-volumes/mayan-edms/media . The mayan-edms storage for files , ..very important.

If you know how to create directories/folders in Linux, then you can move on. IF not this is what you do.

sudo mkdir /docker-volumes/
sudo mkdir /docker-volumes/postgres
sudo mkdir /docker-volumes/redis
sudo mkdir /docker-volumes/media

Please note you must do EVERYTHING IN SUDO or ROOT.

After that must then run these files in this order.

sudo docker pull mayanedms/mayanedms:3.3.15
sudo docker pull postgres:9.6-alpine
sudo docker pull redis:5.0-alpine

sudo curl -fsSL get.mayan-edms.com -o get-mayan-edms.sh
sudo sh get-mayan-edms.sh

Everything should run without any errors. If you get a port error 80 then you should change the port address.

To check and see what's using port 80 type this in sudo netstat -tlnp

It will give you a list of all the ports in use and by what program.

It can be changed by editing the get-mayan-edms.sh file. Again make sure you're root or sudo.
Once that's done run the sudo sh get-mayan-edms.sh command again it you should be fine.

You can then manage the docker images and containers from within the Synology Docker app.

Have fun. :)

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Docker installation on Synology Diskstation

Post by rssfed23 »

Not sure
nate7475 wrote:
Sun Aug 25, 2019 10:46 pm
A socket is just the term for ip + port

So,
ip 192.168.1.10
port 3307
socket 192.168.1.10:3307

What your error message is saying is that it's looking at the ip you listed and the port, and it's not there. What you can do is go to your database container and see what port it's listening on as you'll want to double check that it's actually 3307.
I'm sorry but this is incorrect for what lukasspy is trying to do. lukasspy is trying to expose mysql via a linux socket on the filesystem, nothing to do with IPs/Ports.

lukasspy, you need to pass the mysql socket into the Mayan container if you want it to work that way. I don't actually know if you can use unix sockets in that way via docker but assume so as people pass the docker socket into containers all the time!.
Use the -v option when starting the mayan container to bring /run/mysqld/mysqld10.sock into the container, and then ensure in the environment variables you're setting it to use a socket.
I actually have never tried this before so wouldn't know the right environment variable to pass in, but where your passing localhost it's trying to do a tcp connection to mysql rather than use the unix socket so it'll never talk to it.

I strongly recommend following the guidance by Jagosix. I don't have a synology to test on, but it looks more likely to work from a skim of it!
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

Post Reply