libresh / compose-matomo Goto Github PK
View Code? Open in Web Editor NEWMatomo docker-compose application for libre.sh-v1
License: GNU Affero General Public License v3.0
Matomo docker-compose application for libre.sh-v1
License: GNU Affero General Public License v3.0
Hi! am not a docker expert but it seems to me i got the containers running well however I can't start the piwik app on the browser:
Creating piwik_db_1
Creating piwik_app_1
Creating piwik_web_1
Creating piwik_cron_1
Attaching to piwik_db_1, piwik_app_1, piwik_cron_1, piwik_web_1
db_1 | 2016-11-13T11:41:56.115082Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2016-11-13T11:41:56.131563Z 0 [Note] mysqld (mysqld 5.7.16) starting as process 1 ...
db_1 | 2016-11-13T11:41:56.140354Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
db_1 | 2016-11-13T11:41:56.277973Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2016-11-13T11:41:56.278112Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2016-11-13T11:41:56.278146Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2016-11-13T11:41:56.278233Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2016-11-13T11:41:56.278259Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
db_1 | 2016-11-13T11:41:56.278344Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2016-11-13T11:41:56.403288Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2016-11-13T11:41:56.583450Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2016-11-13T11:41:57.239868Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2016-11-13T11:41:57.414770Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2016-11-13T11:41:57.623131Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2016-11-13T11:41:57.768953Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2016-11-13T11:41:58.315725Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2016-11-13T11:41:58.318084Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2016-11-13T11:41:58.413340Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2016-11-13T11:41:58.484683Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2016-11-13T11:41:58.484775Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2016-11-13T11:41:58.485882Z 0 [Note] InnoDB: Waiting for purge to start
db_1 | 2016-11-13T11:41:58.538510Z 0 [Note] InnoDB: 5.7.16 started; log sequence number 12138488
db_1 | 2016-11-13T11:41:58.539165Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2016-11-13T11:41:58.540884Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2016-11-13T11:41:58.807367Z 0 [Note] InnoDB: Buffer pool(s) load completed at 161113 11:41:58
db_1 | 2016-11-13T11:41:59.021203Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
db_1 | 2016-11-13T11:41:59.022274Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2016-11-13T11:41:59.022435Z 0 [Note] IPv6 is available.
db_1 | 2016-11-13T11:41:59.022628Z 0 [Note] - '::' resolves to '::';
db_1 | 2016-11-13T11:41:59.022744Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2016-11-13T11:41:59.858589Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-11-13T11:41:59.859501Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-11-13T11:42:00.071457Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-11-13T11:42:00.778208Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2016-11-13T11:42:00.778917Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.16' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
cron_1 | Could not open input file: /var/www/html/console
app_1 | [13-Nov-2016 11:42:14] NOTICE: fpm is running, pid 1
app_1 | [13-Nov-2016 11:42:14] NOTICE: ready to handle connections
Hi,
I've started with the minimal setup and exported the mysql root password (nothing else). docker-compose up fails with an error message. The db container is running, the app container is just 'created':
docker create_container <- (name=u'piwik_app_1', image='piwik', labels={u'com.docker.compose.service': u'app', 'com.docker.compose.config-hash': '21df068f9a5ec3387938e5253de82993e624298346a19daca3a734c2eb04b20a', u'com.docker.compose.project': u'piwik', 'com.docker.compose.version': u'1.3.3', u'com.docker.compose.oneoff': u'False', 'com.docker.compose.container-number': '1'}, host_config={'Links': ['piwik_db_1:db', 'piwik_db_1:db_1', 'piwik_db_1:piwik_db_1'], 'PortBindings': {}, 'Binds': [u'/home/user/piwik/revaliases:/etc/ssmtp/revaliases:rw', u'/home/user/piwik/config:/var/www/html/config:rw', u'/home/user/piwik/ssmtp.conf:/etc/ssmtp/ssmtp.conf:rw', u'/var/lib/docker/volumes/54d4a1e73025e4efbdb7ad7662a602fec2c2d647ae88695481a9736f92f5b0c2/_data:/var/www/html:rw'], 'ExtraHosts': [], 'LogConfig': {'Type': u'json-file', 'Config': {}}, 'VolumesFrom': []}, environment={u'affinity:container': u'=05a82032a59fcea55b77390901cbb9a60eae60edfa5fa493e4a41a58349f9b8c'}, volumes={u'/etc/ssmtp/revaliases': {}, u'/var/www/html/config': {}, u'/etc/ssmtp/ssmtp.conf': {}}, detach=True)
docker create_container -> {u'Id': u'18cdc44c64f0cb79c5c8202a325dc95e382baedbf3cf2c975ca5bd84ba9c7cec',
u'Warnings': None}
docker inspect_container <- (u'18cdc44c64f0cb79c5c8202a325dc95e382baedbf3cf2c975ca5bd84ba9c7cec')
docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'php-fpm'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'CpuShares': 0,
u'Cpuset': u'',
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
docker start <- (u'18cdc44c64f0cb79c5c8202a325dc95e382baedbf3cf2c975ca5bd84ba9c7cec')
Cannot start container 18cdc44c64f0cb79c5c8202a325dc95e382baedbf3cf2c975ca5bd84ba9c7cec: [8] System error: not a directory
I can't identify if the error is related to this setup or to the piwik container. I can enter the app container and execute 'php-fpm' with no error, btw. - no idea, WHAT is not a directory.
Docker version: 1.8.2
docker-compose version: 1.3.3
I am fairly new to docker, docker-compose, and piwik, but I did follow the instructions in the README to a T and I am getting this error at the Database setup page:
Error while trying to connect to the database server: SQLSTATE[HY000] [1045] Access denied for user 'root'@'172.24.0.3' (using password: YES)
The only modification I have made:
...(networks section)
- lb_web:
- external: true
+ #lb_web:
+ #external: true
...(web section)
+ ports:
- 8078:80
- - lb_web
+ #- lb_web
I believe I did the proper 'docker-compose down' and then 'MYSQL_ROOT_PASSWORD=mystrongpassword docker-compose up' after making these changes
Here the output I see from the logs:
Creating network "piwik_back" with driver "bridge"
Creating piwik_db_1 ...
Creating piwik_db_1 ... done
Creating piwik_app_1 ...
Creating piwik_app_1 ... done
Creating piwik_cron_1 ...
Creating piwik_web_1 ...
Creating piwik_web_1
Creating piwik_web_1 ... done
Attaching to piwik_db_1, piwik_app_1, piwik_cron_1, piwik_web_1
db_1 | 2017-12-12T15:50:00.529856Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2017-12-12T15:50:00.531066Z 0 [Note] mysqld (mysqld 5.7.20) starting as process 1 ...
db_1 | 2017-12-12T15:50:00.533981Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2017-12-12T15:50:00.533998Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2017-12-12T15:50:00.534004Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2017-12-12T15:50:00.534009Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2017-12-12T15:50:00.534013Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
db_1 | 2017-12-12T15:50:00.534017Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2017-12-12T15:50:00.534239Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2017-12-12T15:50:00.534322Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2017-12-12T15:50:00.536302Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2017-12-12T15:50:00.544706Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2017-12-12T15:50:00.546019Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2017-12-12T15:50:00.557518Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2017-12-12T15:50:00.558318Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 12156556
db_1 | 2017-12-12T15:50:00.558329Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12156565
db_1 | 2017-12-12T15:50:00.558332Z 0 [Note] InnoDB: Database was not shutdown normally!
db_1 | 2017-12-12T15:50:00.558335Z 0 [Note] InnoDB: Starting crash recovery.
db_1 | 2017-12-12T15:50:00.668125Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
db_1 | 2017-12-12T15:50:00.668142Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2017-12-12T15:50:00.668229Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2017-12-12T15:50:00.701466Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2017-12-12T15:50:00.702239Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2017-12-12T15:50:00.702268Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2017-12-12T15:50:00.702755Z 0 [Note] InnoDB: Waiting for purge to start
db_1 | 2017-12-12T15:50:00.752882Z 0 [Note] InnoDB: 5.7.20 started; log sequence number 12156565
db_1 | 2017-12-12T15:50:00.753016Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2017-12-12T15:50:00.753123Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2017-12-12T15:50:00.754936Z 0 [Note] InnoDB: Buffer pool(s) load completed at 171212 15:50:00
db_1 | 2017-12-12T15:50:00.756259Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1 | 2017-12-12T15:50:00.756434Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2017-12-12T15:50:00.757655Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2017-12-12T15:50:00.757690Z 0 [Note] IPv6 is available.
db_1 | 2017-12-12T15:50:00.757699Z 0 [Note] - '::' resolves to '::';
db_1 | 2017-12-12T15:50:00.757720Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2017-12-12T15:50:00.781301Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.781371Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.781383Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.781439Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.781444Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.781456Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.782919Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.782934Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-12-12T15:50:00.787724Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2017-12-12T15:50:00.787940Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
db_1 | 2017-12-12T15:50:00.787951Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
db_1 | 2017-12-12T15:50:00.787955Z 0 [Note] Beginning of list of non-natively partitioned tables
db_1 | 2017-12-12T15:50:00.799003Z 0 [Note] End of list of non-natively partitioned tables
app_1 | [12-Dec-2017 15:50:01] NOTICE: fpm is running, pid 1
cron_1 |
cron_1 | The configuration file {/var/www/html/config/config.ini.php} has not been found or could not be read.
cron_1 | » Please check that /var/www/html/config/config.ini.php is readable by the user 'www-data'.
cron_1 |
cron_1 |
app_1 | [12-Dec-2017 15:50:01] NOTICE: ready to handle connections
cron_1 |
cron_1 |
cron_1 |
cron_1 | [Zend_Db_Adapter_Exception]
cron_1 | SQLSTATE[HY000] [2002] No such file or directory
cron_1 |
cron_1 |
cron_1 |
cron_1 |
cron_1 |
cron_1 |
cron_1 | [PDOException]
cron_1 | SQLSTATE[HY000] [2002] No such file or directory
cron_1 |
cron_1 |
cron_1 |
cron_1 | core:archive [--url="..."] [--force-all-websites] [--force-all-periods[="..."]] [--force-timeout-for-periods[="..."]] [--skip-idsites[="..."]] [--skip-all-segments] [--force-idsites[="..."]] [--force-periods[="..."]] [--force-date-last-n="..."] [--force-date-range[="..."]] [--force-idsegments="..."] [--concurrent-requests-per-website[="..."]] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--php-cli-options[="..."]]
cron_1 |
cron_1 |
Any suggestions? I ssh'd to the piwik DB container, but I could not login to mysql with the root user and password I used. Maybe I am doing something wrong, or some modifications need to be made to the docker container. Thanks!
I'll work on deploying this soon and use https://github.com/bitnami/bitnami-docker-mariadb instead of MSQL.
http://piwik.org/blog/2015/11/piwik-analytics-database-migrating-from-mysql-to-mariadb/
Thanks for having put this together :)
Hey Pierre!
I just looked at your backup script. I'm definitely gonna use it :)
Wondering how to restaure the backup file? Any script or ressource to share ?
P.-S. I use PostgreSQL on other projects. The main commands is to restaure my backup is: psql -f $VAR_RESTFILE postgres
echo && echo -e "$PIK_BLUE Transfer the env_var into postgresql-master container"
docker exec -it postgresql-master sudo -u postgres bash -c \
"cd /var/lib/postgresql/backup \
&& ls -lh \
&& echo check 31 && sleep 1 \
&& echo 'Restaure via psql' \
&& psql -f $VAR_RESTFILE postgres \
&& echo \
&& echo Message within postgresql-master container... \
&& echo ... restauring $VAR_RESTFILE is completed \
&& echo"
hi,i install by composer,but docker-composer up error:
[root@MiWiFi-R1CM-srv piwik]# docker-compose up
Starting piwik_db_1
Starting piwik_app_1
ERROR: Cannot start container d6cdfd6e7cfe50494743908ab8b6c82660306cd201772c4c5719f40d0b8a6b02: [9] System error: not a directory
I set up using the instructions on the Readme (including setting the mysql password) and was able to access the Piwik interface. When I tried to enter the details I got "Error while trying to connect to the database server: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client"
Google suggests looking at length of the password and version of PHP, tried changing password but still no luck. Not sure what to do next?
Update docker-compose.yml to v2 specification.
Been constantly getting this error in one specific environment. Running it on another server seems to work fine, but locally I get this:
app_1 | [21-Oct-2016 12:54:00] WARNING: [pool www] child 9 said into stderr: "NOTICE:
PHP message: Error in Piwik: Cannot connect to the database:
SQLSTATE[HY000] [1049] Unknown database 'piwik' This may be a
temporary issue, try refreshing the page. If the problem persists please contact your Piwik administrator."
speculating I have some left over junk in mysql somehow? But I blow away my containers every time with docker-compose down
and docker-compose rm
Here's my docker-compose.yml
db:
image: mysql
volumes:
- ./mysql/runtime:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=piwikpass
app:
image: piwik
links:
- db
volumes:
- ./config:/var/www/html/config
- ./ssmtp.conf:/etc/ssmtp/ssmtp.conf
- ./revaliases:/etc/ssmtp/revaliases
- ./ssl:/etc/nginx/ssl
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "443:443"
- "80:80"
links:
- app
volumes_from:
- app
environment:
- VIRTUAL_HOST=127.0.0.1
cron:
image: piwik
links:
- db
volumes_from:
- app
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while /bin/true; do
su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive" www-data
sleep 3600
done
EOF'
Here's the logs from the DB container:
db_1 | 2016-10-21T12:53:57.488185Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
cron_1 |
db_1 | 2016-10-21T12:53:57.569015Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2016-10-21T12:53:57.571079Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2016-10-21T12:53:57.647617Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2016-10-21T12:53:57.667570Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2016-10-21T12:53:57.667597Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2016-10-21T12:53:57.667911Z 0 [Note] InnoDB: Waiting for purge to start
db_1 | 2016-10-21T12:53:57.720042Z 0 [Note] InnoDB: 5.7.16 started; log sequence number 12138175
db_1 | 2016-10-21T12:53:57.720542Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2016-10-21T12:53:57.721692Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2016-10-21T12:53:57.749677Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
db_1 | 2016-10-21T12:53:57.750384Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2016-10-21T12:53:57.750415Z 0 [Note] IPv6 is available.
db_1 | 2016-10-21T12:53:57.750438Z 0 [Note] - '::' resolves to '::';
db_1 | 2016-10-21T12:53:57.750484Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2016-10-21T12:53:57.770340Z 0 [Note] InnoDB: Buffer pool(s) load completed at 161021 12:53:57
db_1 | 2016-10-21T12:53:57.885873Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-10-21T12:53:57.886570Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-10-21T12:53:57.932624Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2016-10-21T12:53:58.185440Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2016-10-21T12:53:58.185903Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.16' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
Note the db_1 | 2016-10-21T12:53:57.749677Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
Thanks in advance!!
There is a new version out.
Shouldn't use https://hub.docker.com/_/matomo/ ?
This is a know issue. The current workaround is to use a wrapper script around mysql's entrypoint
Without this wrapper script, mysql does not have write access to the host volume:
Attaching to piwik_db_1, piwik_app_1, piwik_web_1, piwik_cron_1
db_1 | Initializing database
db_1 | 2016-05-17T08:40:43.947123Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
app_1 | [17-May-2016 08:39:56] NOTICE: fpm is running, pid 1
app_1 | [17-May-2016 08:39:56] NOTICE: ready to handle connections
db_1 | 2016-05-17T08:40:43.981323Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
db_1 | 2016-05-17T08:40:43.981347Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
db_1 | 2016-05-17T08:40:43.981351Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
db_1 | 2016-05-17T08:40:43.981353Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
db_1 | 2016-05-17T08:40:43.981355Z 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
db_1 | 2016-05-17T08:40:43.981358Z 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
db_1 | 2016-05-17T08:40:43.981361Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
db_1 | 2016-05-17T08:40:44.583103Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
db_1 | 2016-05-17T08:40:44.583129Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
db_1 | 2016-05-17T08:40:44.583135Z 0 [ERROR] Failed to initialize plugins.
db_1 | 2016-05-17T08:40:44.583137Z 0 [ERROR] Aborting
I cloned this repo directly onto the host machine (an Ubuntu 16.04 VM) and ran docker-compose up
:
root@docker-piwik:~/piwik# MYSQL_ROOT_PASSWORD=mystrongpassword docker-compose up
Recreating piwik_db_1
Recreating piwik_app_1
ERROR: for app Cannot start service app: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:53: mounting \\\\\\\"/root/piwik/revaliases\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/aufs/mnt/e7fd0d95cfac39d107ed922f1c152dc0e9f0dbcf2578197a40751f2d7c160967\\\\\\\" at \\\\\\\"/var/lib/docker/aufs/mnt/e7fd0d95cfac39d107ed922f1c152dc0e9f0dbcf2578197a40751f2d7c160967/etc/ssmtp/revaliases\\\\\\\" caused \\\\\\\"not a directory\\\\\\\"\\\"\"\n"
ERROR: Encountered errors while bringing up the project.
root@docker-piwik:~/piwik# docker --version
Docker version 1.12.2, build bb80604
root@docker-piwik:~/piwik# docker-compose --version
docker-compose version 1.8.1, build 878cff1
root@docker-piwik:~/piwik# uname -r
4.4.0-38-generic
I receive the following error on docker-compose up
error: database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
This was working a while ago, so there has been no code changes, it just won't run properly now:
I have the piwik server running with this docker-compose (note, updates to expose 80 for haproxy):
version: '2'
networks:
lb_web:
external: true
back:
driver: bridge
services:
db:
image: mysql
volumes:
- ./mysql/runtime:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD
networks:
- back
app:
image: piwik:fpm
links:
- db
volumes:
- ./config:/var/www/html/config
networks:
- back
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- app
volumes_from:
- app
environment:
- VIRTUAL_HOST
networks:
- back
- lb_web
expose:
- 80
cron:
image: piwik:fpm
links:
- db
volumes_from:
- app
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while /bin/true; do
su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive" www-data
sleep 3600
done
EOF'
networks:
- back
docker ps
:
ubuntu@ip-10-0-0-37:~/haproxy$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a20afa6bdee0 nginx "nginx -g 'daemon ..." 4 minutes ago Up About a minute 80/tcp dockerpiwik_web_1
75d981dd0344 indiehosters/ocsp "cron -f" 12 minutes ago Up 8 minutes haproxy_ocsp_1
e47547839d86 jwilder/docker-gen "/usr/local/bin/do..." 12 minutes ago Up 8 minutes haproxy_discovery_1
7b6fce04d70c nginx "nginx -g 'daemon ..." 12 minutes ago Up 8 minutes 80/tcp haproxy_letsencrypt-web_1
da0b94fdaf24 piwik:fpm "bash -c 'bash -s ..." 13 minutes ago Up About a minute 9000/tcp dockerpiwik_cron_1
b066571afa57 piwik:fpm "/entrypoint.sh ph..." 13 minutes ago Up About a minute 9000/tcp dockerpiwik_app_1
c9d078314cfa mysql "docker-entrypoint..." 13 minutes ago Up About a minute 3306/tcp dockerpiwik_db_1
Commands to run:
First run haproxy: VIRTUAL_HOST=special.rij.co docker-compose up -d
The run docker-piwik: MYSQL_ROOT_PASSWORD=mysqlpasswqord docker-compose up -d
Errors on haproxy:
haproxy_1 | ./certs/ MODIFY special.rij.co.pem
haproxy_1 | ++ cat /var/run/haproxy.pid
haproxy_1 | + haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid -sf 14
haproxy_1 | [ALERT] 317/172631 (17) : parsing [/etc/haproxy/haproxy.cfg:26] : 'bind *:443' : unable to load SSL private key from PEM file '/etc/haproxy/certs/special.rij.co.pem'.
haproxy_1 | [ALERT] 317/172631 (17) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
haproxy_1 | [ALERT] 317/172631 (17) : Fatal errors found in configuration.
letsencrypt_1 | [Tue Nov 14 17:26:31 UTC 2017] Reload success
letsencrypt_1 | [Tue Nov 14 17:26:31 UTC 2017] ===End cron===
letsencrypt_1 | + inotifywait .
discovery_1 | 2017/11/14 17:26:31 Received event die for container 756bec2566af
letsencrypt_1 | Setting up watches.
letsencrypt_1 | Watches established.
haproxy_haproxy_1 exited with code 1
Hi,
I set up this piwik docker version when 2.16.1 was current. Now 2.16.2 is current and I was wondering why my setup is still running 2.16.1. I'm running docker-compose pull && docker-compose up -d
regularly on my setups via a cron job. So the update should have happened.
So I inspected my piwik_app container and it actually shows the ENV variable "PIWIK_VERSION=2.16.2"
. But the webinterface is still nagging me to update.
The code that is in /var/www/html
actually is the old one.
In /usr/src/piwik
I find the current version. So my guess is that the https://github.com/piwik/docker-piwik/blob/master/docker-entrypoint.sh code is not executed. Actually there is this line that checks if there is already a piwik.php
in /var/www/html
.
So I'm guessing the problem is: The volume (which is defined by the Dockerfile) would be recreated when the container is re-setup on update. But as the web
container is also using it it is not destroyed and so is already populated when the update happens./var/www/html
is defined in the Dockerfile as volume. Volumes are persisted, so it's still there after the update and the new piwik code is not copied over the old code.
So my question boils down to: is updating piwik actually working for anyone and something in my setup is broken or is this a general problem of the image? And if it is working for you, how do you run your update?
Hello,
I have install piwik version 3.2 with docker-compose. Three different docker-compose have been use and always same result:
Nothing seems record...
I have use different example in local:
And all works fine but nothing is record. One simple example with :
version: '2'
services:
db:
image: mysql
volumes:
- /data/piwik/mysql:/var/lib/mysql
environment:
- MYSQL_DATABASE=piwik
- MYSQL_USER=piwik
- MYSQL_PASSWORD=piwik
- MYSQL_ALLOW_EMPTY_PASSWORD=no
- MYSQL_RANDOM_ROOT_PASSWORD=no
app:
image: piwik:fpm
links:
- db
volumes:
- ./config:/var/www/html/config
networks:
- default
- nginx-proxy
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- app
volumes_from:
- app
environment:
- VIRTUAL_HOST=piwik.dev
networks:
- default
- nginx-proxy
cron:
image: piwik:fpm
links:
- db
volumes_from:
- app
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while /bin/true; do
su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive" www-data
sleep 3600
done
EOF'
networks:
nginx-proxy:
external:
name: proxy-nginx # Network for DNS
Then I have add website (idSite is 2) and I use JavaScript and it's send data :
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//piwik.dev/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '2']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//piwik.dev/piwik.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
Data is send by browser and are receive on my container. For all test on docker compose I have the same behavior and logs which seems to works:
piwik_1 | 172.18.0.3 - - [13/Oct/2017:05:51:39 +0000] "GET /piwik.php?action_name=my_site&idsite=2&rec=1&r=887751&h=7&m=51&s=39&url=http%3A%2F%2Fmy_site.dev%2Fprofile%2F&urlref=http%3A%2F%2Fmy_site.dev%2Frecette%2Fnew&_id=d6c860d631d25a0e&_idts=1507873767&_idvc=1&_idn=0&_refts=0&_viewts=1507873767&send_image=1&pdf=0&qt=0&realp=0&wma=0&dir=0&fla=1&java=0&gears=0&ag=0&cookie=1&res=2560x1440>_ms=8101&pv_id=kNLa5M HTTP/1.1" 200 43
But nothing is record...
I have an old, almost unusable instance built from https://github.com/ecobytes/docker-piwik which I set up for @maxlath, who repeatingly tells its working fine.
Still I will have to migrate. How go I get my state into this setup?
Hi, I ran your command list from the README, i.e.:
git clone https://github.com/indiehosters/piwik.git
cd piwik
MYSQL_ROOT_PASSWORD=mystrongpassword docker-compose up
But there's no access through the web. I'm wondering if there are dependencies or other steps that haven't been listed in the README...
Hello and thanks for this image which seems to work perfectly.
Some suggestions to improve docker-compose.yml
db:
...
environment:
- MYSQL_ROOT_PASSWORD=pick_a_password
app:
A "config" directory should exist before starting docker-compose, same thing for directory "mysql" and for files nginx.conf, revaliases and ssmtp.conf.
David.
(virtualenv)[][16:24:43][/tmp/piwik][1] $[SUDO] sudo docker-compose down
Removing piwik_app_1 ... done
Removing piwik_db_1 ... done
(virtualenv)[][16:25:05][/tmp/piwik]$[SUDO] sudo MYSQL_ROOT_PASSWORD=mystrongpassword docker-compose up
Creating piwik_db_1
Creating piwik_app_1
ERROR: for app Cannot start service app: Cannot link to a non running container: /piwik_db_1 AS /piwik_app_1/db
ERROR: Encountered errors while bringing up the project.
First of all: I am quite new to docker and some basics may not be that clear to me.
When I run your docker-compose.yml
just like it is written in the How to use this image:
git clone https://github.com/indiehosters/piwik.git
cd docker-piwik
# edit variables in the docker-compose file or pass them from your comamnd line
docker-compose up
I see with docker ps
that the ports mapped by docker-compose.yml are:
[root@localhost piwik]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3975b32cd92c piwik "bash -c 'bash -s <<E" 6 minutes ago Up 6 minutes 9000/tcp piwik_cron_1
c64ceaa0eb4f nginx "nginx -g 'daemon off" 6 minutes ago Up 6 minutes 80/tcp, 443/tcp piwik_web_1
822381268f73 piwik "/entrypoint.sh php-f" 6 minutes ago Up 6 minutes 9000/tcp piwik_app_1
8bd7d007626c mysql "/entrypoint.sh mysql" 7 minutes ago Up 7 minutes 3306/tcp piwik_db_1
Basically 9000
, 80
, 3306
and 443
are the exposed ports. I tried to change them by supplying ports:
inside the docker-compose.yml
file:
[root@localhost ~]# cat /sdb1/repos/piwik/docker-compose.yml
db:
image: mysql
volumes:
- ./mysql/runtime:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=myrootpw
app:
image: piwik
ports:
- "9001"
links:
- db
volumes:
- ./config:/var/www/html/config
- ./ssmtp.conf:/etc/ssmtp/ssmtp.conf
- ./revaliases:/etc/ssmtp/revaliases
web:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
links:
- app
volumes_from:
- app
cron:
image: piwik
ports:
- "9001"
links:
- db
volumes_from:
- app
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
while /bin/true; do
su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive" www-data
sleep 3600
done
EOF'
But as it turns out this just creates additional ports, because docker inspect piwik_app_1
shows:
...
"NetworkSettings": {
"Bridge": "",
"SandboxID": "a68518308aaaeeee52848310637d45f8fd323e530c47074a7eacecca2156433d",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"9000/tcp": null,
"9001/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "32777"
}
]
},
...
And I can double check this again with docker ps
:
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7f0cbbc39c5f piwik "bash -c 'bash -s <<E" 12 minutes ago Up 12 minutes 9000/tcp, 0.0.0.0:32778->9001/tcp piwik_cron_1
c9ffd24c6a82 nginx "nginx -g 'daemon off" 12 minutes ago Up 12 minutes 80/tcp, 443/tcp piwik_web_1
0aecdb52d2c4 piwik "/entrypoint.sh php-f" 12 minutes ago Up 12 minutes 9000/tcp, 0.0.0.0:32777->9001/tcp piwik_app_1
bc39a2564166 mysql "/entrypoint.sh mysql" 12 minutes ago Up 12 minutes 3306/tcp piwik_db_1
So my question is:
How to change the default ports (9000
,3306
,443
, 80
) of the containers which are created by your docker-compose.yml
file, when calling docker-compose up
?
Piwik default table engine is InnoDB since Piwik 2.1.
In that case, mysqldump documentation recommends to use --single-transaction option instead of --lock-tables.
This avoids LOCKS conflicts with piwik application and has much better performances.
As --lock-tables is enabled by default (due to --opt shortcut option), you have to explicitly disable it:
mysqldump --skip-lock-tables --single-transaction ...
Hello,
I am testing this setup, and I am finding hard to configure nginx to host piwik in a subfolder.
The goal is to have a setup like this:
I tried to change both the nginx configuration file shipped in this project and adding a reverse proxy pointing to it, but failed both.
Any idea if this can be achieved?
Thanks
Followed the README...
docker-compose up -d
After pulling the images...
ERROR: for app oci runtime error: rootfs_linux.go:53: mounting "/var/lib/docker/aufs/mnt/b3b7caa43aa0cd01f25885d17d39f366e9dd2e5a583cc50bdc46fc3aa7be7f72/etc/ssmtp/revaliases" to rootfs "/var/lib/docker/aufs/mnt/b3b7caa43aa0cd01f25885d17d39f366e9dd2e5a583cc50bdc46fc3aa7be7f72" caused "not a directory"
ERROR: Encountered errors while bringing up the project.
From where should I get these files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.