odoo / docker

Other
932 stars 1.52k forks source link

"Page is not working" on localhost:8069 #380

Closed Stakdek closed 2 years ago

Stakdek commented 2 years ago

I have a naked PSQL and Odoo Docker with docker-compose configured. After I started the docker Odoo wants to serve on cece3aa227a5:8069, so localhost:8069 is also not working…

Response from Chrome: Page is not working.

System: Ubuntu 20.04 LTS

Command: docker-compose up

docker-compose.yml:

version: '2.0'
services:
  # Information needed set up an odoo web
  # application container.
  web:
    image: odoo:14.0
    container_name: odoo_14
    depends_on:
    - db
    # Port Mapping
    #We need to map the port on the host machine(left side) to the
    #Port inside the container on the right. By default Odoo
    #Runs on port 8069 and inside the container, it is running on 8069.
    #Locally we are going to access it via localhost:9000
    ports:
    - 8069:8069
    # Data Volumes
    # --------
    #
    # This defines files that we are sharing from the host machine
    # into the container.
    #
    #Here we are using to map the extra add ons or enterprise addons
    # as well as the configuration file. Also, we need to map the data
    #directory where Odoo will storesome attachments etc.
    volumes:
    - ./data/odoo:/var/lib/odoo
    - ./config:/etc/odoo
    - ./addons:/mnt/addons
    - ./enterprise:/mnt/enterprise
    #Username and password of the Host DB
    # Make sure to give the same credentials
    #inside the postgres service
    environment:
    - HOST=db
    - USER=odoo14
    - PASSWORD=odoo14
   # All of the information needed to start up a Postgresql
# Container.
  db:
    image: postgres:10
    container_name: postgres_10
    ports:
    - 5432:5432
    #Add this volume to map the Postgres data. It may be lost
    #if we execute docker-compose down where all the data
    #in the layered file system will be lost
    volumes:
    - ./data/postgres:/var/lib/postgresql/data
    #make sure to use the same which were given above.
    environment:
    - POSTGRES_PASSWORD=odoo14
    - POSTGRES_USER=odoo14
    - POSTGRES_DB=postgres

Docker Output:

docker-compose up
Starting postgres_10 ... done
Recreating odoo_14   ... done
Attaching to postgres_10, odoo_14
postgres_10 | 
postgres_10 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_10 | 
postgres_10 | 2021-07-23 11:20:41.534 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_10 | 2021-07-23 11:20:41.534 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_10 | 2021-07-23 11:20:41.545 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_10 | 2021-07-23 11:20:41.585 UTC [26] LOG:  database system was shut down at 2021-07-23 11:20:38 UTC
postgres_10 | 2021-07-23 11:20:41.595 UTC [1] LOG:  database system is ready to accept connections
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: Odoo version 14.0-20210720 
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf 
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/mnt/extra-addons', '/mnt/enterprise'] 
odoo_14 | 2021-07-23 11:20:42,481 1 INFO ? odoo: database: odoo14@db:5432 
odoo_14 | 2021-07-23 11:20:42,622 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf 
odoo_14 | 2021-07-23 11:20:42,707 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on cece3aa227a5:8069 
Stakdek commented 2 years ago

Also my folders in the docker are empty… I think I am doing something wrong… image

Stakdek commented 2 years ago

Help?

bymoxb commented 2 years ago

try this https://github.com/odoo/docker/issues/172#issuecomment-372021162

arabkhemar commented 2 years ago

@Stakdek it is related to mounted directory permissions (data). chown/chmod will help you.

Stakdek commented 2 years ago

@Stakdek it is related to mounted directory permissions (data). chown/chmod will help you.

So a chown or chmod? But to what user? The docker container has a cryptic user. There must be a general fix to that.

arabkhemar commented 2 years ago

Quick fix (local env only !) will be setting your data folder to chmod 777 so you don't have to mess with ownership (odoo container, postgres container & your host). I'll send you my docker-compose file when I get home.

arabkhemar commented 2 years ago

Sorry for delay @Stakdek ! There is my docker-compose file, you just have to change the UID & GID 1000 with your owns from your host. Run command: id to get them. Compose file:

version: '3'
services:

  odoo:
    image: odoo:14
    restart: unless-stopped
    user: 1000:1000
    environment:
      - HOST=postgresql
      - USER=odoo
      - PASSWORD=odoo
    ports:
      - 8069:8069
    volumes: 
      - ./data/odoo/config:/etc/odoo
      - ./data/odoo/filestore:/var/lib/odoo
      - ./data/odoo/addons/extra:/mnt/extra-addons
      - ./data/odoo/addons/enterprise:/mnt/enterprise-addons
    links: 
      - postgresql
    depends_on:
      - postgresql

  postgresql:
    image: postgres:13
    restart: unless-stopped
    user: 1000:1000
    environment:
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_DB=postgres
    volumes:
      - ./data/postgresql:/var/lib/postgresql/data

Don't forget to close the issue ;)