movim / movim_docker

Official Docker Compose stack for Movim, maintained by @kawaii and the @movim team
https://movim.eu/
GNU Affero General Public License v3.0
79 stars 29 forks source link

Movim failed to run #13

Closed obigroup closed 5 years ago

obigroup commented 6 years ago

When I run my «docker-compose up» it returns :

movim | Phinx by CakePHP - https://phinx.org. 0.9.2 movim | movim | using config file ./phinx.php movim | using config parser php movim | using migration paths movim | - /var/www/movim/database/migrations movim | using seed paths movim | - /var/www/movim/database/seeds movim | warning no environment specified, defaulting to: movim movim | using adapter pgsql movim | using database movim movim | movim |
movim | [InvalidArgumentException]
movim | There was a problem connecting to the database: SQLSTATE[08006] [7] could n
movim | ot connect to server: Connection refused
movim | Is the server running on host "postgres" (172.20.0.2) and accepting
movim | TCP/IP connections on port 5432?
movim |
movim | movim | migrate [-c|--configuration CONFIGURATION] [-p|--parser PARSER] [-e|--environment ENVIRONMENT] [-t|--target TARGET] [-d|--date DATE] [-x|--dry-run] movim | movim | movim | PHP Fatal error: Uncaught Exception: Unable to write to /var/www/movim/log/logger.log in /var/www/movim/src/Movim/Bootstrap.php:66 movim | Stack trace: movim | #0 /var/www/movim/src/Movim/Bootstrap.php(33): Movim\Bootstrap->checkSystem() movim | #1 /var/www/movim/daemon.php(13): Movim\Bootstrap->boot(false) movim | #2 {main} movim | thrown in /var/www/movim/src/Movim/Bootstrap.php on line 66 movim | Oops... something went wrong. movim | Uncaught Exception: Unable to write to /var/www/movim/log/logger.log in /var/www/movim/src/Movim/Bootstrap.php:66 movim | Stack trace: movim | #0 /var/www/movim/src/Movim/Bootstrap.php(33): Movim\Bootstrap->checkSystem() movim | #1 /var/www/movim/daemon.php(13): Movim\Bootstrap->boot(false) movim | #2 {main} movim | thrown movim | in /var/www/movim/src/Movim/Bootstrap.php (line 66) ... ...

My movim.env file :

NGINX_VHOST=localhost MOVIM_DOMAIN=http://localhost/ MOVIM_PORT=8080 MOVIM_INTERFACE=0.0.0.0 MOVIM_ADMIN=adminuser MOVIM_PASSWORD=adminpassword POSTGRES_USER=movim POSTGRES_PASSWORD=movimpassword POSTGRES_DB=movim

Why movim container can't access to postgre container ?

Regards.

Vertux commented 5 years ago

@obigroup Here is a working example. Create a new directory e.g. movim and put the following files in it.

docker-compose.yaml

version: '3.7'

services:
  movim:
    depends_on:
      - psql
    container_name: movim
    image: movim/movim:0.14.1rc5
    volumes:
      - ./movim:/var/www/html:rw
    restart: always
    environment:
      MOVIM_ADMIN: admin
      MOVIM_PASSWORD: admin
      MOVIM_DOMAIN: http://localhost
      MOVIM_PORT: 8080
      MOVIM_INTERFACE: 0.0.0.0
      POSTGRES_DB: movim
      POSTGRES_HOST: psql
      POSTGRES_PORT: 5432
      POSTGRES_USER: movim
      POSTGRES_PASSWORD: movim
  nginx:
    depends_on:
      - movim
    container_name: nginx
    image: nginx:latest
    volumes:
      - ./movim:/var/www/html:ro
      - ./default.conf:/etc/nginx/conf.d/default.conf
    ports:
      - "80:80"
    restart: always
  psql:
    container_name: psql
    image: postgres:11.2-alpine
    volumes:
      - ./postgresql/data:/var/lib/postgresql/data
    restart: always
    environment:
      POSTGRES_DB: movim
      POSTGRES_PASSWORD: movim
      POSTGRES_USER: movim

default.conf

server {
    listen       80;
    server_name  localhost;

    index index.php index.html;

    root /var/www/html;

    location / {
        try_files $uri /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass movim:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location /ws/ {
        proxy_pass http://movim:8080/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_redirect off;
    }
}

@kawaii feel free to add it as working example.