services:
db:
image: postgres:15
environment:
- POSTGRES_USER=odoo
- POSTGRES_PASSWORD=odoo
- POSTGRES_DB=postgres
- PGDATA=/var/lib/postgresql/data/pgdataJika docker image yang kita pakai sudah bertahun-tahun mungkin OS yang dipakai image tersebut sudah tidak disupport, sehingga saat kita mau update (misal perlu install lib / package tambahan, namun harus update dulu) akan mengalami kendala sbb:
root@myawesomeimagedocker:/# apt update
Ign:1 http://security.debian.org/debian-security buster/updates InRelease
Ign:2 http://deb.debian.org/debian buster InRelease
Err:3 http://security.debian.org/debian-security buster/updates Release
404 Not Found [IP: 151.101.130.132 80]
Ign:4 http://deb.debian.org/debian buster-updates InRelease🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert and mkcert -install. Keep it simple!
This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.
sudo nano /etc/ssl/localhost/localhost.conf
Biasanya aplikasi kita yang di dalam docker (Mac) tidak bisa hit ke API server eksternal yang koneksinya menggunakan VPN (dari host/laptop kita bisa, namun dari dalam docker tidak bisa).
Selain ubah konfigurasi network (yg mungkin masih gagal), solusi alternatifnya kita bisa lewatkan semacam API Proxy.
Berikut sample-nya:
# api_proxy.py
import http.server
import socketserverSELECT
TABLE_NAME,
COLUMN_NAME,
CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,
REFERENCED_COLUMN_NAME
FROM
INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE| docker compose exec NAMA_SERVICE_ODOO odoo \ | |
| -d NAMA_DB \ | |
| --db_password PASSWORD_DB \ | |
| --db_host NAMA_SERVICE_DB \ | |
| --no-xmlrpc \ | |
| --stop-after-init \ | |
| --update NAMA_ADDON |
Jika kita mendapatkan error access right odoo yg mungkin tidak tahu detail kesalahan itu dibaris kode yg mana, kita bisa traceback lebih detail. Kita perlu edit model core nya odoo.
Ref https://www.odoo.com/forum/help-1/how-to-debug-access-permissions-121603
Berikut contoh pesan errornya:
Due to security restrictions, you are not allowed to access 'Sale Order' (sale.order) records.
example in postgresql old version:
-- login psql
-- makesure db exist
-- Disallow new connections
UPDATE pg_database SET datallowconn = false WHERE datname = "NAMA_DB";
-- ALTER DATABASE "NAMA_DB" CONNECTION LIMIT 1; -- (jika perlu)
-- teriminate existing connection
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = "NAMA_DB";SELECT tmp_tbl.asset_id,
MAX(CASE WHEN tmp_tbl.custom_sequence=1 THEN tmp_tbl.software_name ELSE NULL END) other_software_1,
MAX(CASE WHEN tmp_tbl.custom_sequence=2 THEN tmp_tbl.software_name ELSE NULL END) other_software_2,
MAX(CASE WHEN tmp_tbl.custom_sequence=3 THEN tmp_tbl.software_name ELSE NULL END) other_software_3,
MAX(CASE WHEN tmp_tbl.custom_sequence=4 THEN tmp_tbl.software_name ELSE NULL END) other_software_4,
MAX(CASE WHEN tmp_tbl.custom_sequence=5 THEN tmp_tbl.software_name ELSE NULL END) other_software_5,
MAX(CASE WHEN tmp_tbl.custom_sequence=6 THEN tmp_tbl.software_name ELSE NULL END) other_software_6,
MAX(CASE WHEN tmp_tbl.custom_sequence=7 THEN tmp_tbl.software_name ELSE NULL END) other_software_7,
MAX(CASE WHEN tmp_tbl.custom_sequence=8 THEN tmp_tbl.software_name ELSE NULL END) other_software_8reff : https://stackoverflow.com/a/59189173/23541428
brew install libpqsudo ln -s $(brew --prefix)/opt/libpq/bin/psql /usr/local/bin/psql