# Odoo (Open ERP) Pages

# Install on docker compose

Configure your .yml file like this:

```bash
version: '3.1'
services:
  web:
    container_name: odoo
    image: odoo:16.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - /your/local/directory:/var/lib/odoo
      - /your/local/directory:/etc/odoo
      - //your/local/directory:/mnt/extra-addons
    environment:
      - HOST=db
      - PASSWORD=bitchodoo
      - USER=odoo
  db:
    container_name: odoodb
    image: postgres:15
    volumes:
      - /your/local/directory:/var/lib/postgresql/data/pgdata 
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=bitchodoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata

volumes:
  odoo-web-data:
  odoo-db-data:
```

# Troubleshooting Odoo | Docker permissions:

### Docker permissions:

FYI: On first setup, main/root directory is set to "root"

[![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-11/scaled-1680-/NliZWca8d8tkmabI-image.png)](https://wiki.danicus.net/uploads/images/gallery/2023-11/NliZWca8d8tkmabI-image.png)

Inside your root directory, Your main website directory well be set to root. Change it. Go into the docker container and get the user ID number. In my case it was 102. Exit the container and chown 102:102 your directory so that the container has its own permissions.

```bash
chown 102:102
```

 [![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-11/scaled-1680-/URXIGsPHe8krs9GN-image.png)](https://wiki.danicus.net/uploads/images/gallery/2023-11/URXIGsPHe8krs9GN-image.png)

#### Data Base:

The date base should be fine if it looks like:[![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-11/scaled-1680-/g0YZKRi7YbV9cmIT-image.png)](https://wiki.danicus.net/uploads/images/gallery/2023-11/g0YZKRi7YbV9cmIT-image.png)

#### Extra-Addons:  


[![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-11/scaled-1680-/AlPzUz19N5cHvYvI-image.png)](https://wiki.danicus.net/uploads/images/gallery/2023-11/AlPzUz19N5cHvYvI-image.png)

### Loosing connection to dashboard:

\*\*DO NOT RESTART THE ODOO CONTAINER\*\* After restarting the Odoo docker container, the Odoo dashboard will not connect. The site also looks messed up or, just wont load at all.   
Solution 1: Delete all volume folders and start over. Permission don't seem to have an affect on this.

# Install Odoo "Community" on local machine

 Odoo ‘deb’ package uses PostgreSQL. Install that first

```
sudo apt install postgresql -y
```

Repository:

```bash
wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
```

```bash
 echo 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/17.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.list
```

Use the usual `<span class="pre">apt-get</span> <span class="pre">upgrade</span>` command to keep the installation up-to-date:

```bash
sudo apt-get update && sudo apt-get install odoo
```

After its installed, you will need to start it up.

```bash
sudo service odoo start
```

# Odoo File Locations

/etc/odoo

/var/lib/odoo/.local/share/Odoo

# Odoo addons

#### To add modules:

first create a location of where the modules will be stored. Odoo does not make one by default. You will need to create your own path.

/home/some/location/you/want/extra-addons

##### Edit the files: 

/etc/odoo/odoo.conf

##### Add path in that file: Any spot in the file will do. 

```bash
addons_path = /home/some/location/you/want/extra-addons
```

#### Restart Odoo to make sure it is working  
  


```bash
sudo systemctl restart odoo
```

# Odoo | Nginx config file

This is my current version:

```bash
server {
        server_name mywebsite.com;
            location / {
                proxy_pass http://127.0.0.1:8069;
                proxy_connect_timeout   3600;
                proxy_read_timeout      3600;
                proxy_send_timeout      3600;
                send_timeout            3600;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
            }

  #certbot is maintaining ssl automatically
}

```

Another version is:

```bash
server {
    server_name testing.com 111.111.111.111; //replace ip and server name with your domain and ip
    listen 80;
    access_log /var/log/nginx/testing-access.log;
    error_log /var/log/nginx/testing-error.log;
    location /longpolling {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8072;
}
    location / {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8069/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    gzip on;
    gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
```

https://www.cybrosys.com/blog/how-to-configure-odoo-with-nginx-as-reverse-proxy