MarvAmBass / docker-piwik

⚠️ DEPRECATED ::: A Docker Piwik Container
MIT License
29 stars 26 forks source link

Database setup #1

Closed soupdiver closed 9 years ago

soupdiver commented 9 years ago

I've stated the container and linked it against a mysql container. I've created the database named piwik manually.

When starting your container without providing PIWIK_MYSQL_USER and PIWIK_MYSQL_PASSWORD it gives SQLSTATE[28000] [1045] Access denied for user 'www-data'@'172.17.0.28' (using password: NO) That's ok I think.

When I provide these values I get SQLSTATE[42S02]: Base table or view not found: 1146 Table 'piwik.piwik_option' doesn't exist at Piwik setup step 1 Shouldn't this stuff be generated by startup-piwik.sh or did I forget something?

soupdiver commented 9 years ago

So it seems this is related to the headless installation. Putting the config file in place is one thing but installation step 4 Creating the Tables is not run I guess.

Edit: Yeah I tested it a bit more and your container works fine if the tables are already created in the database which is linked to the container. If not then the installation dies now work.

MarvAmBass commented 9 years ago

Hi Felix

Thanks for the feedback, unfortunaty there is no unit test framework or similar for Docker Containers. And I've rebuilded the container yesterday.

Well it seems like a Problem of the Pwiki Install visit. Could you paste your docker logs? You may see there on which step it got in trouble

Unfortunately something like a headless install is only available in Pwiki Pro (so it's a payed feature - with some bad luck they did it on purpose to crash my docker container)

I'll look into it this evening

If you use some BASH Symbols in your variables or some special chars (password ;) ) you could get this error too. Then it should be easy to fix

soupdiver commented 9 years ago

I do not have any special characters in variables or usernames. All normal ASCII chars. I did everything again from scratch

docker run --name docker-test-mysql -e MYSQL_ROOT_PASSWORD=test -d mysql:5.5
docker run -d -p 8888:80 -p 4444:443 --link docker-test-mysql:mysql --name piwik-test -e PIWIK_MYSQL_USER=root -e PIWIK_MYSQL_PASSWORD=test marvambass/piwik

Then I get Unknown database 'piwik' Maybe worth to mention that the database must be created manually.

docker inspect docker-test-mysql
mysql -h 172.17.0.58 -u root -p
CREATE DATABASE piwik;

the resulting logs:

Welcome to the marvambass/nginx-ssl-secure container

IMPORTANT:
  IF you use SSL inside your personal NGINX-config,
  you should add the Strict-Transport-Security header like:

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

  to your config.
  After this you should gain a A+ Grade on the Qualys SSL Test

>> seems like the first start of nginx
>> doing some preparations...

>> generating /etc/nginx/external/dh.pem with size: 512
>> generating self signed cert
>> copy /etc/nginx/external/*.conf files to /etc/nginx/conf.d/
>> set MYSQL Host: mysql
>> set MYSQL Port: 3306
>> set MYSQL User: <hidden>
>> set MYSQL Password: <hidden>
>> set MYSQL DB Name: piwik
>> set MYSQL Prefix: piwik_
>> making piwik available beneath: /piwik/
>> adding softlink from /roundcube to /piwik/
>> exec docker CMD
nginx
2014/12/11 08:38:30 [notice] 41#0: using the "epoll" event method
2014/12/11 08:38:30 [notice] 41#0: nginx/1.7.7
2014/12/11 08:38:30 [notice] 41#0: built by gcc 4.7.2 (Debian 4.7.2-5) 
2014/12/11 08:38:30 [notice] 41#0: OS: Linux 3.13.0-39-generic
2014/12/11 08:38:30 [notice] 41#0: getrlimit(RLIMIT_NOFILE): 524288:1048576
2014/12/11 08:38:30 [notice] 41#0: start worker processes
2014/12/11 08:38:30 [notice] 41#0: start worker process 42

I also don't see any point in your Dockerfile or so where the tables should be generated. Were you ever able to get this running from scratch with an empty mysql container?

MarvAmBass commented 9 years ago

Okay that was a good point, I've added a step, where the script tries to create the database on the mysql-Server if it doesn't allready exist. (You still need to specify a User with rights to do this - i wouldn't use a administrative user like this in production)

Currently i wonder, why the script doesn't enter the init mode. It only does that if you have a empty Piwik Database.

You could try it again. This time you shouldn't need to create the Database by yourself.

MarvAmBass commented 9 years ago

Can this Ticket closed right now?

soupdiver commented 9 years ago

You integrated the creation of the database but will the needed tabled also be created automatically?

MarvAmBass commented 9 years ago

normaly yes, thats the part with the curl script - my startup-piwik.sh uses the regular web-wizard for the basic configuration.

I'll test it this evening and fix it or close this issue

MarvAmBass commented 9 years ago

okay it's definitely an error, I'll fix the auto configuration

soupdiver commented 9 years ago

Which curl partdo you mean? I can't find a call to curl in startup-piwik.sh

Ah I guess you mean the wget stuff?

MarvAmBass commented 9 years ago

yeah I mean the wget stuff. Unfortunately I'm stuck now. It seems to me it never worked...

Its a bigger story with that headless stuff, normally the piwik wizard would create everything if you click yourself thru it.

Would be a great Job for HtmlUnit but that would be much to big with the whole java stuff...

I'll take a look at the piwik sources maybe I find the right parameters to post etc ;)

soupdiver commented 9 years ago

I also tried this... but the database setup is deeply put in some classes somewhere... Would be great if there would be just a SQL template somewhere.

MarvAmBass commented 9 years ago

okay I've tried to redo curl all index.php connections my chrome made... this sucks it won't work that way

MarvAmBass commented 9 years ago

i works now, it clean it up and push it back into this registry

soupdiver commented 9 years ago

perfect :+1:

MarvAmBass commented 9 years ago

it takes some time, I first need to figure out which headers etc are necessary

soupdiver commented 9 years ago

sure :) my installation is already running... just did the setup manually

MarvAmBass commented 9 years ago

fixed and implemented