Jump to content
Kru-x

[Support] kru-x - wordpress

188 posts in this topic Last Reply

Recommended Posts

On 5/7/2020 at 2:28 AM, Kru-x said:

So install the MariaDB container with port 3306 (default port numbers for DB's in most cases) if not in use, then in the WordPress container where it says WORDPRESS_DB_HOST: add your "server IP":port eg 192.168.1.100:3306 and then WordPress can talk to the DB container. You also have to add DB_user and Password and if you have not changed it in the MariaDB container you can use "wordpress" as the user and the same for password.

 

Then when clicking on the icon it should direct you to 192.168.1.100:8080 and WordPress can talk to the database in the background and you can continue installation and use it locally.

Ok, I have installed WP and MariaDB multiple times to try and get connection going.  I assume this is the best way to start and then bring NPM along later.  I keep getting "Error establishing a database connection"  I have the following in MariaDB

Host Port 1 :3306

Key1 : 99

Key2 : 100

Key3 : 0

 

And in WP

Container port: 8080

WORDPRESS_DB_HOST: 192.168.13.142:3306

WORDPRESS_DB_USER: 99

WORDPRESS_DB_PASSWORD: 0

 

I've created and recreated the containers multiple times without getting past the database error.  It seems editing the container is no good as that takes me to a http://192.168.13.142:8080/ "Problem with the connection error"

Each time I create a new mariaDB container and WP container, I call it a new name Wordpress2 and store it in a new appdata folder etc...

 

What stupid thing am I doing wrong?

 

Share this post


Link to post
43 minutes ago, tr0910 said:

Ok, I have installed WP and MariaDB multiple times to try and get connection going.  I assume this is the best way to start and then bring NPM along later.  I keep getting "Error establishing a database connection"  I have the following in MariaDB

Host Port 1 :3306

Key1 : 99

Key2 : 100

Key3 : 0

 

And in WP

Container port: 8080

WORDPRESS_DB_HOST: 192.168.13.142:3306

WORDPRESS_DB_USER: 99

WORDPRESS_DB_PASSWORD: 0

 

I've created and recreated the containers multiple times without getting past the database error.  It seems editing the container is no good as that takes me to a http://192.168.13.142:8080/ "Problem with the connection error"

Each time I create a new mariaDB container and WP container, I call it a new name Wordpress2 and store it in a new appdata folder etc...

 

What stupid thing am I doing wrong?

 

WP WORDPRESS_DB_PASSWORD: left blank? 0 in the MB database means no password. Or?

Share this post


Link to post
39 minutes ago, Kru-x said:

WP WORDPRESS_DB_PASSWORD: left blank? 0 in the MB database means no password. Or?

I am just trying to get it to communicate in any way.  Maybe something else is wrong?

 

What is your normal way to get it to work?

Share this post


Link to post
Just now, tr0910 said:

I am just trying to get it to communicate in any way.  Maybe something else is wrong?

 

What is your normal way to get it to work?

So that was not the problem? I think you might get the "Error establishing a database connection" on a wrong password as it is trying to use the root user for the DB. If not mayby try other ports, 8080 is often used by other containers, but then you should get a fault when starting the container.

 

Is your settings looking like this? (see attached screen shots)

 

Share this post


Link to post
Posted (edited)
12 minutes ago, Kru-x said:

So that was not the problem? I think you might get the "Error establishing a database connection" on a wrong password as it is trying to use the root user for the DB. If not mayby try other ports, 8080 is often used by other containers, but then you should get a fault when starting the container.

 

Is your settings looking like this? (see attached screen shots)

 

Ok, I just deleted the mariaDB passwords from the WP container setup and suddenly it works.  WP is installed and the dashboard is up now. 

 

Is that what you do with passwords for setup.  Ignore them?

Edited by tr0910

Share this post


Link to post
9 minutes ago, tr0910 said:

Ok, I just deleted the mariaDB passwords from the WP container setup and suddenly it works.  WP is installed and the dashboard is up now. 

 

Is that what you do with passwords for setup.  Ignore them?

The 0 in the MariaDB setting is telling the container to not use a password (blank) for the root user, WP is trying to login to the DB with the password 0 that you used as password in hence it didn't work. You can set a password, if other then 0, then you have to add the same password in the WP template.

 

Kru-x

Share this post


Link to post

Ah OK, thanks for pointing me in the right direction.  Once I can spin up a WP site repeatedly without error, I'll move on to getting NPM to work.

Share this post


Link to post
17 minutes ago, tr0910 said:

Ah OK, thanks for pointing me in the right direction.  Once I can spin up a WP site repeatedly without error, I'll move on to getting NPM to work.

No worries,

 

Just remember to start the installation of WP after you got the NPM to work and can connect to the site by your domain. Else WP is going to try to redirect to your internal IP, you gona get the same problem when you are moving your sites if you are not careful. Best is to use a plugin to migrate your whole site, ill use "Duplicator Pro" for moving my sites around when needed.


Kru-x

Share this post


Link to post

I don't know why but after each restart of Wordpress docker, database name in wp-config.php is set to wordpress.

Share this post


Link to post
3 hours ago, Alex.b said:

I don't know why but after each restart of Wordpress docker, database name in wp-config.php is set to wordpress.

Hi Alex,

 

Its most likely wordpress doing it or you have problems with your share folder. Docker compares the share folder To the one inside the container, if the file is missing he adds it else he wont. Docker wont overwrite any existing files. I would ask in a WP forum,

 

Kru-x

Share this post


Link to post
Posted (edited)

That’s weird because it replace only the variable database name. The rest of the file remains intact. I don’t understand why the docker try to create a database 

MySQL "CREATE DATABASE" Error: Access denied for user 'alex'@'%' to database 'wordpress'


WARNING: unable to establish a database connection to '192.168.1.9:3306'

continuing anyways (which might have unexpected results)

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.10. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.10. Set the 'ServerName' directive globally to suppress this message
[Fri Jul 17 00:49:36.149182 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.8 configured -- resuming normal operations
[Fri Jul 17 00:49:36.149222 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

 

Edited by Alex.b

Share this post


Link to post
5 hours ago, Alex.b said:

That’s weird because it replace only the variable database name. The rest of the file remains intact. I don’t understand why the docker try to create a database 


MySQL "CREATE DATABASE" Error: Access denied for user 'alex'@'%' to database 'wordpress'


WARNING: unable to establish a database connection to '192.168.1.9:3306'

continuing anyways (which might have unexpected results)

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.10. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.10. Set the 'ServerName' directive globally to suppress this message
[Fri Jul 17 00:49:36.149182 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.8 configured -- resuming normal operations
[Fri Jul 17 00:49:36.149222 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

 

Hi Alex.b

 

I think you are misunderstanding and I am not sure what you are trying to do. Change DB name? Why. The log you see is the log of WP not docker. During the first install WP is loging in to the MariaDB with the root privilege and creating a database inside with the name "wordpress" and user "alex" and setting up privileges for that user, then subsequent login WP is using "alex" as user and "alex" has no privileges to create a database only read and write into that DB, it is only "root" that has that privilege of "CREATE DATABASE".

 

The best way to understand it is to login to MariaDB with a database software and look at the database within, privileges & users, with that you could create a database logged in as root and then set privileges to alex, but still I don't know what you are trying to do and there is not any real reasons to change the database name I can think of.

 

Kru-x 

Share this post


Link to post
Posted (edited)
On 7/16/2020 at 12:56 AM, tr0910 said:

Ah OK, thanks for pointing me in the right direction.  Once I can spin up a WP site repeatedly without error, I'll move on to getting NPM to work.

@Kru-x NPM is installed and available.  But when I attempt to request a cert for a private domain already forwarded to my ip address, I get interenal error from NPM. 

 

I suspect that I may have port 80 and 443 being blocked by my no name ISP.  I have those ports forwarded in my router, and the NPM congratulations page is never displayed.  I can torrent (with unRaid Transmission docker) over this ISP, so not everything is blocked.

 

Is this likely my problem? 

Edited by tr0910

Share this post


Link to post
Posted (edited)
3 hours ago, tr0910 said:

@Kru-x NPM is installed and available.  But when I attempt to request a cert for a private domain already forwarded to my ip address, I get interenal error from NPM. 

 

I suspect that I may have port 80 and 443 being blocked by my no name ISP.  I have those ports forwarded in my router, and the NPM congratulations page is never displayed.  I can torrent (with unRaid Transmission docker) over this ISP, so not everything is blocked.

 

Is this likely my problem? 

Hi tr0910,

 

I'm not sure what you mean and I doubt that your ISP is blocking your ports, what happens if you go to your ip address in a browser? You said that you had a fixed one, didn't you? The same if you have forward your domain(s) to that ip address, what are you seeing? the same as when you are using your domain as with the ip?

Edited by Kru-x

Share this post


Link to post

From my cell phone with WiFi shut off, both my external IP address and my domain forwarded to this IP respond with the same thing.  Yes IP is fixed. 

 

This site cannot be reached. 

ERR_Connection_Refused

 

Router is forwarding 80 and 443 to unRaid 1880 and 18443 as per a default NPM recommended install.

Share this post


Link to post
47 minutes ago, tr0910 said:

From my cell phone with WiFi shut off, both my external IP address and my domain forwarded to this IP respond with the same thing.  Yes IP is fixed. 

 

This site cannot be reached. 

ERR_Connection_Refused

 

Router is forwarding 80 and 443 to unRaid 1880 and 18443 as per a default NPM recommended install.

It is for sure NPM, only worry about your IP address first of all, when you add that to any browser and when it is working you should be greeted with a welcome to NPM greeting. Not until then you can start to invoke your containers and certificates.

 

You say that you have forward the ports correctly, but I would double check the settings again. Did you forward too the right IP of your server? Is this the first time you connect to your server from internet?

 

Donno, but I suppose your ISP could potentially block those ports but I cant see why, ask them or find out googling, IF they do, tell them to bugger off and get another provider, you don't have to have a fixed IP, waste of money if you pay extra or the ISP provider charge extra for it.

 

Kru-x

Share this post


Link to post
Posted (edited)
23 minutes ago, Kru-x said:

You say that you have forward the ports correctly, but I would double check the settings again. Did you forward too the right IP of your server? Is this the first time you connect to your server from internet?

Here is the router page:

image.png.7946270fbbdab6a8b85d59bb98ea44af.png

 

Going to 192.168.13.142:1880 from inside the local lan brings me to the congratulations page for NPM.  Does it look ok to you for the normal suggested port forwarding logic for NPM?

 

Googling around led me to believe that ISP blocking of 80 and 443 was quite normal and to be expected.  Your response makes me question this.  You haven't had to deal with blocked ports? 

 

It does seem that others have had to deal with this.  There is even a SpaceInvaderOne unRaid video about port 80 blockage with Lets Encrypt setup.  And sorry, this particular area where I am testing at present does not have other ISP options.  If they are blocking, we will have to either ask nicely, or just work around it.  I'll dig some more and see what I find.   Thanks for the pointers...

Edited by tr0910

Share this post


Link to post
14 minutes ago, tr0910 said:

Here is the router page:

image.png.7946270fbbdab6a8b85d59bb98ea44af.png

 

Going to 192.168.13.142:1880 from inside the local lan brings me to the congratulations page for NPM.  Does it look ok to you for the normal suggested port forwarding logic for NPM?

 

Googling around led me to believe that ISP blocking of 80 and 443 was quite normal and to be expected.  Your response makes me question this.  You haven't had to deal with blocked ports? 

 

It does seem that others have had to deal with this.  There is even a SpaceInvaderOne unRaid video about port 80 blockage with Lets Encrypt setup.  And sorry, this particular area where I am testing at present does not have other ISP options.  If they are blocking, we will have to either ask nicely, or just work around it.  I'll dig some more and see what I find.   Thanks for the pointers...

Looks ok, but I believe the protocol should be UDP, don't know if that would make any difference.

 

Hope it works out and for sure ask your provider, if they are good they should take care of their costumers need.

Share this post


Link to post
10 hours ago, Kru-x said:

Looks ok, but I believe the protocol should be UDP, don't know if that would make any difference.

 

Hope it works out and for sure ask your provider, if they are good they should take care of their costumers need.

ISP admits to blocking these ports but for an additional fee they can give me a static IP (which I already have) and ports 80 and 443 will be unblocked.  The additional fee is not desirable, so now I need to find a different way around this blockage. 

Share this post


Link to post
5 hours ago, tr0910 said:

ISP admits to blocking these ports but for an additional fee they can give me a static IP (which I already have) and ports 80 and 443 will be unblocked.  The additional fee is not desirable, so now I need to find a different way around this blockage. 

Ohh that sucks,

 

You need the ports to divert the traffic thru, if you can't change provider I doubt that you can do anything else then pay up. You might be able to use a VPN but then you are on thin ice and are going to run in to problems all the time. Wouldn't do that in production. Why can't you change, sound strange to me? Shared cable in to units or?

Any how good luck and keep us posted,

 

Kru-x

Share this post


Link to post

Is there any way of giving the wordpress database name as an environment variable? Right now I can only modify wp-config.php manually if I have the database with different name.

Share this post


Link to post
22 hours ago, hkinks said:

Is there any way of giving the wordpress database name as an environment variable? Right now I can only modify wp-config.php manually if I have the database with different name.

Hi hkinks,

What are you trying to achieve? You say "if I have a database with different name".

 

On a new install you can name the database to whatever you want by adding the the parameters to the DB template see https://hub.docker.com/r/linuxserver/mariadb (heading "parameters"). If the WP container can't login to the mariaDB container you are presented with the WordPress install where you can add your DB name user and PW. You could also login as root to the mariaDB with a separate DB software and create whatever DB name you like then install WP the same as a above. Remember user and privileges thought.

 

Hope this answered your question
Kru-x

Share this post


Link to post
Posted (edited)

Thanks for answering!


I would simply like to name the database differently than the default 'wordpress' since I can have multiple wordpress sites using the same MariaDB server. Would be really convenient to set it as a docker env var when running it, e.g. WORDPRESS_DB_NAME.


Maybe if I explain my setup workflow it is better understood or maybe I am overlooking some easier solution. I want to set up a wordpress site for a blog let's say. I create database 'wp_blog' and user 'wp_blog' with access rights to that db. I configure the Wordpress docker, however I can only specify database host, user and a password at this point. When I start the container and visit the site I would get message "Error establishing a database connection". The reason is that it expects database name to be 'wordpress'. So what I do in this case is
1) go to mapped volume /mnt/user/appdata/wp_blog/wp-config.php
2) modify the line
define( 'DB_NAME', 'wordpress'); to use 'wp_blog' instead.
after that everything works as expected and can continue installing WordPress.

Edited by hkinks

Share this post


Link to post
1 hour ago, hkinks said:

Thanks for answering!


I would simply like to name the database differently than the default 'wordpress' since I can have multiple wordpress sites using the same MariaDB server. Would be really convenient to set it as a docker env var when running it, e.g. WORDPRESS_DB_NAME.


Maybe if I explain my setup workflow it is better understood or maybe I am overlooking some easier solution. I want to set up a wordpress site for a blog let's say. I create database 'wp_blog' and user 'wp_blog' with access rights to that db. I configure the Wordpress docker, however I can only specify database host, user and a password at this point. When I start the container and visit the site I would get message "Error establishing a database connection". The reason is that it expects database name to be 'wordpress'. So what I do in this case is
1) go to mapped volume /mnt/user/appdata/wp_blog/wp-config.php
2) modify the line
define( 'DB_NAME', 'wordpress'); to use 'wp_blog' instead.
after that everything works as expected and can continue installing WordPress.

No  worries,

 

Personally I can't see any benefit using the same DB to different sites more then in a multi-site setup. It is no disadvantage to run different DB's and it benefit separating each instance witch makes it easier should something go wrong. That's the main reason I have not added more variables to the template, I tried to make it as simple as possible.

 

But having said that, each person have it's own preferences and a more confident user can add any variables himself, you can add a WORDPRESS_DB_NAME  environment variable to your template.

 

But if I can give an advice I wouldn't bother as per above, still if you insist i would use a software to connect to my database and manually manage the DB's/users/ and passwords. You can leave the WORDPRESS_DB_HOST blank for a new instance then you get presented with the WP installation on startup where you can do it all manually, but with this the user needs to understand what the container and DB is about (thus use a software), in regards to username password and db names etc. 

 

The MariDB container is setting the user to root with full privileges and the WP container is using the same to use the DB, in a production environment this should be done manually and should not be using root.


Kru-x

 

 

Share this post


Link to post
On 8/17/2020 at 12:04 AM, Kru-x said:

No  worries,

 

Personally I can't see any benefit using the same DB to different sites more then in a multi-site setup. It is no disadvantage to run different DB's and it benefit separating each instance witch makes it easier should something go wrong. That's the main reason I have not added more variables to the template, I tried to make it as simple as possible.

 

But having said that, each person have it's own preferences and a more confident user can add any variables himself, you can add a WORDPRESS_DB_NAME  environment variable to your template.

 

But if I can give an advice I wouldn't bother as per above, still if you insist i would use a software to connect to my database and manually manage the DB's/users/ and passwords. You can leave the WORDPRESS_DB_HOST blank for a new instance then you get presented with the WP installation on startup where you can do it all manually, but with this the user needs to understand what the container and DB is about (thus use a software), in regards to username password and db names etc. 

 

The MariDB container is setting the user to root with full privileges and the WP container is using the same to use the DB, in a production environment this should be done manually and should not be using root.


Kru-x

 

 

Thanks, not specifying the WORDPRESS_DB_HOST was basically what I was looking for. I was somehow under assumption these env vars are obligatory. Without it I was presented with Wordpress installer's own database credentials view and could specify the database name there like you said.

 

Personally I just prefer to manage databases from one dbms instance, better overview and easier to remember what is going on.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.