libresh / compose-matomo

Matomo docker-compose application for libre.sh-v1
GNU Affero General Public License v3.0
179 stars 67 forks source link

No access through web #23

Open ezmiller opened 7 years ago

ezmiller commented 7 years ago

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...

ezmiller commented 7 years ago

Here are some errors in the output:

Warning: require(/var/www/html/config/global.php): failed to open stream: No such file or directory in /var/www/html/vendor/php-di/php-di/src/DI/Definition/Source/Defi nitionFile.php on line 56 cron_1 | cron_1 | Fatal error: require(): Failed opening required '/var/www/html/config/global.php' (include_path='/var/www/html/vendor/pear/pear_exception:/var/www/html/vendor/pear/con sole_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/archive_tar:.:/usr/local/lib/php') in /var/www/html/vendor/php-di/php-di/src/DI/Definition/ Source/DefinitionFile.php on line 56

jimklo commented 7 years ago

This config is designed to work with another set of containers for load balancing. Basically by default there are no ports exposed to your host.

I was having the same issue as I don't need to do that, I'm hoping to use this setup to develop a PIWIK plugin.

I've tried modifying the docker-compose.yml to expose the host ports on the web service, and then commented out the lb_web network:

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
    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
    ports:
      - "8080:80"
      - "8443:443"
  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'
    networks:
      - back

Once saved, if when you docker-compose up -d you should be able to reach the PIWIK server on http://localhost:8080.

kvordf commented 7 years ago

I tryed following the step above, but am still getting the same errors. I also tried installing nginx, but that didn't make a huge difference. Is any body else have the same problems? It looks like /var/www/* is missing for me.

Thanks Khanh

jaymjax1 commented 7 years ago

@kvordf Had this problem too. When you add the port to the yml file and save, be sure you do a docker-compose down then docker-compose up. At first I was doing docker stop webserver, but that wasn't the solution.

loleg commented 7 years ago

I think it would be good to link to Docker Compose networking and give a quick example of the host config in the README.

madnight commented 6 years ago

the only problem, in order to get it working on localhost, is the missing port mapping

ports:
      - "80:80"
      - "443:443"

This is like the EXPOSE command inside of docker and necessary to expose the docker ports to localhost. https://github.com/indiehosters/piwik/pull/26/files

josmitc commented 6 years ago

To run this locally I had to change these things in the docker-compose file:

  1. lb_web network to external: false
  2. under the web service I added ports 8080:80
MuLoo commented 4 months ago

This config is designed to work with another set of containers for load balancing. Basically by default there are no ports exposed to your host.此配置旨在与另一组容器一起使用以实现负载均衡。基本上,默认情况下,没有端口暴露给您的主机。

I was having the same issue as I don't need to do that, I'm hoping to use this setup to develop a PIWIK plugin.我遇到了同样的问题,因为我不需要这样做,我希望使用此设置来开发 PIWIK 插件。

I've tried modifying the docker-compose.yml to expose the host ports on the web service, and then commented out the lb_web network:我尝试修改docker-compose.yml以公开 Web 服务上的主机端口,然后注释掉 lb_web 网络:

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
    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
    ports:
      - "8080:80"
      - "8443:443"
  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'
    networks:
      - back

Once saved, if when you docker-compose up -d you should be able to reach the PIWIK server on http://localhost:8080.保存后,如果当您能够 docker-compose up -d 访问 PIWIK 服务器时 http://localhost:8080

thank you ! it works!