Odoo Docker Pycharm 配置 - xiaohao0576/odoo-doc GitHub Wiki
安装Docker
推荐使用Docker Desktop, 点击下载
如果是Linux系统,对命令行比较熟悉,可以安装命令行的Docker,官方文档
使用Docker Compose
version: '3.1'
services:
web:
image: odoo:17.0
depends_on:
- db
ports:
- "8069:8069"
- "2202:22"
command: sleep infinity
db:
image: postgres:15
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
映射22端口,是为了让pycharm通过ssh远程连接到docker内远程开发和调试
command: sleep infinity
是让docker启动后一直保持运行
使用docker compose up -d
启动docker镜像
-D When this option is specified, sshd will not detach and does not become a daemon. This allows easy monitoring of sshd.
-f config_file
Specifies the name of the configuration file. The default is /etc/ssh/sshd_config. sshd refuses to start if there is no
configuration file.
安装openssh-server
- 使用命令
docker exec -uroot -it odoo-web bash
已root用户进入docker命令行 - 运行
apt update
- 执行
apt install -y openssh-server
安装ssh server /etc/init.d/ssh start
启动ssh server/etc/init.d/ssh status
查看ssh server运行状态sshd -D
启动sshd服务,并保持在前台运行
-D When this option is specified, sshd will not detach and does not become a daemon. This allows easy monitoring of sshd.
-f config_file
Specifies the name of the configuration file. The default is /etc/ssh/sshd_config. sshd refuses to start if there is no
configuration file.
更改ssh服务器参数
- ssh服务器配置文件
/etc/ssh/sshd_config
- 以下是几个可能会修改到的参数
PasswordAuthentication yes
PermitRootLogin yes
安装开发用的工具
apt install -y vim lsof git lsof iputils-ping
编辑Odoo配置文件
Odoo配置文件位置/etc/odoo/odoo.conf
[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
db_host = db
db_port = 5432
db_user = odoo
db_password = odoo
limit_memory_hard = 7247757312
limit_memory_soft = 6039797760
配置pycharm远程连接
项目根目录/usr/lib/python3/dist-packages/odoo
Odoo命令行启动
python3 -m odoo -c /etc/odoo/odoo.conf