目录

更新Odoo源代码

阅读(4) 最后更新: 2019年1月17日 06:11

上一页 创建分期环境 | Summary 下一页

翻译进度 57%

自助翻译

为了从GitHub存储库获取最新的Odoo源代码,我们使用git拉命令,在此之前,我们可以使用git标记命令为当前的提交创建一个标记,这样可以更容易地还原代码更新,如下:$sudo su odoo$cd~/odoo-12$git标记-强制12-最后-推动$git拉以使代码更改生效,我们需要重新启动Odoo服务。要使数据文件更改生效,需要对模块进行升级。作为一般规则,对Odoo稳定版本的更改被认为是代码修复,如果您需要执行模块升级,则可以使用-u附加选项或-u基来升级所有模块。
To get the latest Odoo source code from the GitHub repository, we use the git pull command.Before doing that, we can use the git tag command to create a tag for the current commit in use, so that it's easier to revert the code update, as follows: $ sudo su odoo $ cd ~/odoo-12 $ git tag --force 12-last-prod $ git pull For code changes to take effect, we need to restart the Odoo service.For data file changes to take effect, an upgrade to the modules is needed.As a general rule, changes to Odoo stable versions are considered code fixes, and it's therefore not often worth the risk of performing module upgrades.If you need to perform a module upgrade, however, it can be achieved using the -u additional option, or -u base, which upgrades all modules.

现在是启动Odoo暂存服务器的时候了,它将在它的暂存数据库上使用更新代码,如下:$~/Odoo-12/Odoo-bin-d Odoo-Stage-http-port=8080\-c/etc/odoo/odoo.conf#可选添加:-u base$Exit此Odoo暂存服务器配置为在8080端口上侦听。我们可以使用我们的web浏览器在那里导航,使用地址(如http://localhost:8080,)检查升级后的代码是否正确工作。
Now it's time to start the Odoo staging server, which will use the update code on it staging database, as follows: $ ~/odoo-12/odoo-bin -d odoo-stage --http-port=8080 \ -c /etc/odoo/odoo.conf # optionally add: -u base $ exit This Odoo staging server was configured to listen on the 8080 port.We can navigate there with our web browser, using an address such as http://localhost:8080, to check whether the upgraded code works correctly.

如果出了问题,我们可以用下面的代码将代码恢复到早期版本:$sudo su odoo$cd~/odoo-12$git签出12-最后-如果一切按预期运行,那么在生产服务上执行升级应该是安全的,这通常是通过重新启动它来完成的。如果您想执行实际的模块升级,建议的方法是停止服务器,运行升级,然后重新启动服务,如下:$sudo服务Odoo停止$sudo su-c“~/odoo-12/odoo-bin-c/etc/odoo/odo.conf”-u base
If something goes wrong, we can revert the code to an earlier version with the following code: $ sudo su odoo $ cd ~/odoo-12 $ git checkout 12-last-prod $ exit If everything works as expected, it should be safe to perform an upgrade on the production service, which is usually done by restarting it.If you want to perform an actual module upgrade, the suggested approach is to stop the server, run the upgrade, and then restart the service, as follows: $ sudo service odoo stop $ sudo su -c "~/odoo-12/odoo-bin -c /etc/odoo/odoo.conf" \ " -u base --stop-after-init" odoo $ sudo service odoo start Remember to make a note of the Git reference in use by checking out the necessary version.

This will enable you to rollback any changes if necessary.Keeping a backup of the database before an upgrade is also highly advised.

完成后,我们可以使用Git将新版本拉到生产存储库中,并完成如下升级:$sudo su odoo$cd~/odoo-12$git标记-force 12-Last-prod$git拉$sudo$sudo service Odoo重新启动#或:Sudo system ctl重新启动Odoo没有必要太频繁地更新,但是,也不建议您在更新之间等待一年。每隔几个月执行一次更新通常是可以的。此外,请注意,重新启动服务器应该足够启用代码更新,而且模块升级并不总是必要的。
After this is complete, we can pull the new versions to the production repository using Git and complete the upgrade as follows: $ sudo su odoo $ cd ~/odoo-12 $ git tag --force 12-last-prod $ git pull $ exit $ sudo service odoo restart # or: sudo systemctl restart odoo There's no point in updating too frequently, but it's not advised that you wait a year between updates either.Performing an update every few months is usually fine.Also note that a server restart should be enough to enable code updates—and that module upgrades aren't always necessary.

If you need a specific bug fix, however, an earlier update should be considered.Remember to also watch out for security bug disclosures on public channels such as GitHub Issues for Odoo, in particular, ones displaying the Security tag, at https://github.com/odoo/odoo/ issues?q=is%3Aissue+label%3ASecurity, or the Odoo official mailing lists, which can be subscribed to at https://www.odoo.com/groups.

As part of the service, enterprise contract customers can expect early email notifications alerting them to this type of issue.

评论