@dessant opened this Issue on June 26th 2016

If config.ini.php is present, the installation sequence is skipped entirely.

When the required fields are present in the config file (database host, name, password etc), the installation could happen in a headless way, otherwise the manual istallation page would be loaded on the first visit, and the entered data would be stored in config without overwiting the existing contents of the config file.

This would make it easy to provide a custom config during provisioning and fully set up Piwik, without the need for hacks like these: https://github.com/MarvAmBass/docker-piwik/blob/master/startup-piwik.sh.

I am aware of headless installation being available in the Pro version, please note that this issue was opened for the free version of Piwik.

@tsteur commented on June 29th 2016 Owner

The installation is skipped indeed if all needed fields are there in the config and if database tables exist. I'm not quite sure what the exact problem is? Did you want to install Piwik via command line by providing parameters like "--database-host"?

@dessant commented on June 29th 2016

Yeah, the main issue is that headless installation is not supported and one has to use the ui to provide the db connection and bootstrap the database. While this is ok for one-off installations, it becomes problematic when you're doing automated provisioning.

The config way was one idea, ideally the main outcome would be to have a way to install Piwik up to a state where the admin user is created, without requiring manual steps.

@tsteur commented on June 30th 2016 Owner

got it. I thought I created a similar issue a few years ago when I built a vagrant box for Piwik but cannot find it anymore. Possibly I didn't actually create the issue. It would be a useful feature to have nowadays.

Basically we would only need to create the config file from the input and validate the entered data. For validation and creation of config file everything is already here so it shouldn't be too complex

@mattab commented on July 8th 2016 Owner

Hi @dessant

we may in the future release such a tool as open source. If your company can support us in this area, please get in touch via https://piwik.org/contact/

@Toub commented on July 29th 2016

Let's say the automation can be run with a script named install-piwik.sh, we need 2 different ways to provide the configuration:

  • command lines args (e.g. install-piwik.sh --dbuser=myuser --dbpassword=pass ...) => drawback: the tool appears in the command history
  • install.ini file (running install-piwik.sh will then remove install.ini, so it can be more secure)
@tsteur commented on July 30th 2016 Owner

If someone is keen to work on this I'm happy to assist. Be good to have this

@nebev commented on October 6th 2016

I had a stab at this yesterday. It's not particularly brilliant, but gets the job done for me.
I'm running docker containers, so it's not really an option for me to use the CURL method.
For anyone interested: https://github.com/nebev/piwik-cli-setup

@gaumondp commented on October 7th 2016

Thanks @nebev , I'm no programmer but I can think of some more features or maybe it should be a different script?

  1. Option to upgrade instead of installing
  2. Option to fetch the source from http://builds.piwik.org/latest.tar.gz (or any version) or a local directory.
  3. Test download against *.asc PGP signature.

I'm also wondering if such script should be maintain by Piwik CoreTeam once interest grow?

All in all, thanks anyway for sharing the code. :)

@lorengordon commented on November 10th 2016

I'm also very interested in an automated mechanism to complete the initial configuration and creation/update of the db tables. 👍

@mattab commented on February 18th 2017 Owner

Please note we have this automation available but it's one of the rare things we haven't published as Open source. If you want to access this please contact InnoCraft here: https://www.innocraft.com/#contact

@pc-magas commented on February 18th 2017

As for me I wanted to have a cli installer in order to make a custom docker image.

@chriscroome commented on March 13th 2017

I have been looking at how to script Piwik installs and came across the Cauldron install script which adopts another approach to this problem from the examples above -- using a minimal MySQL dump to populate the database and then using the php console script to setup the config file.

@nebulade commented on March 14th 2017

Hi, I'm the author of that Cloudron package and I think it is a quite bad hack using the sql dump. Since I lack deeper knowledge of the piwik install process, this was just an option to get around the setup in our case, but I would not recommend that in the long run at all. The alternative solution I did first was to replay the requests to the setup webinterface via script, but that was even uglier.

@nebev commented on March 14th 2017

I agree. SQL dump is a bad idea as schemas change. Best to use API calls and existing functions where possible. I'm successfully running my CLI setup script in a docker image for brand new installs of Piwik 3.0.2.

Powered by GitHub Issue Mirror