How can I make odoo service run with certain flags? - odoo

I'm trying to set the configuration file of my odoo server to certain file, I know that running odoo with the -c <path> or --config <path> will do the work, but I'm running it in the server like a service so I can't do this, neither adding the configs to /etc/odoo/odoo.conf because I need 2 configuration files.
Does someone knows how can I can make odoo service run with certain flags(-c and --load)
Here's my config at /etc/odoo/odoo.conf
[options]
addons_path = /usr/lib/python2.7/distpackages/odoo/addons,/opt/odoo/addons/odoodoto
admin_passwd = XXXXXXXXXXXX
data_dir = /var/lib/odoo
db_host = False
db_name = False
db_password = False
db_port = 5432
db_user = False
demo = {}
log_level = warn
logfile = /var/log/odoo/odoo-server.log
logrotate = True
proxy_mode = False
And my second config:
[connector-options]
workers = 4
export ODOO_CONNECTOR_CHANNELS=root:5
export ODOO_CONNECTOR_PORT=8069
log-level = warn
And the --load=web,connector is the other flag I need

Without getting into many details of the init systems of Ubuntu, you should have a bash script inside /etc/init.d (probably /etc/init.d/odoo-server).
Inside that file insert a line:
DAEMON_OPTS="-c /etc/odoo/odoo.conf"
Use commas to pass more parameters

The file I was looking for is /etc/systemd/system/odoo.service there you can specify in the [Service] options something like this ExecStart=/usr/local/bin/odoo --load=web,connector -c /somedir/odoo-server.conf.
You can also configure some of the service settings in /etc/init.d/odoo like George Daramouskas sayed but I don't really know how and if you can add the flags I wanted

Related

Why my gitlab runner try to fetch repo with a different url other than which I configured?

I deployed a gitlab runner and a gitlab instance on the same server using docker, after that, I tried to run a few samples to test my runner, but in the first job it always tells me that it can't access my repository. The weird thing is that it try to access a totally different URL instaed of the one in config.toml.
Here is my config:
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "******"
url = "http://172.17.0.3:8010/"
token = "*********"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "ubuntu"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
The http://172.17.0.3:8010/ is exact the ip of my gitlab instance inside the docker network.
Here is where the runner try to get my code:
Running with gitlab-runner 13.12.0 (7a6612da)
on third runner 2ieTUrD1
Preparing the "docker" executor
Using Docker executor with image ubuntu:focal ...
Pulling docker image ubuntu:focal ...
Using docker image sha256:7e0aa2d69a153215c790488ed1fcec162015e973e49962d438e18249d16fa9bd for ubuntu:focal with digest ubuntu#sha256:adf73ca014822ad8237623d388cedf4d5346aa72c270c5acc01431cc93e18e2d ...
Preparing environment
00:01
Running on runner-2ieturd1-project-12-concurrent-0 via dfcd09965d50...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/zh****/e****/.git/
fatal: unable to access 'http://8.136.221.242:8010/zh****/e****.git/': Failed to connect to 8.136.221.242 port 8010: Operation timed out
ERROR: Job failed: exit code 1
Can anyone help me, thank you so much!
Update your /etc/gitlab/gitlab.rb file and set
external_url "http://172.17.0.3:8010/"
Once you've saved it run
sudo gitlab-ctl reconfigure

Odoo custom addon_path not found

I setup a clean Debian 10 vps, launch this setup script
https://raw.githubusercontent.com/Yenthe666/InstallScript/14.0/odoo_install_debian.sh
and all seems is correctly installed
I can't get the /odoo/custom/addons folder to work
Odoo Enterprise
This is the /etc/odoo-server.conf
[options]
; This is the password that allows database operations:
admin_passwd = xxxxxxxxxx
xmlrpc_port = 8069
logfile = /var/log/odoo/odoo-server.log
addons_path = /odoo/enterprise/addons,/odoo/odoo-server/addons,/odoo/custom/addons
proxy_mode = True
then
service odoo-server restart
checking on the log the directory is found
2020-11-18 09:32:46,144 4683 INFO ? odoo: addons paths: ['/odoo/odoo-server/odoo/addons',
'/odoo/.local/share/Odoo/addons/14.0', '/odoo/enterprise/addons', '/odoo/odoo-server/addons',
'/odoo/custom/addons']
All modules inside /odoo/custom/addons have correct permissions "odoo:odoo" and 755
Activated developer mode with assets
In apps menu clicked on update module list
New addon doesn't show in App list... :(
Same addon here /odoo/odoo-server/addons works
Before all things, change permissions using:
sudo chmod -R odoo:odoo /added_path_of_addons/
Stop server using:
sudo /etc/init.d/odoo-server stop
Then restart it again:
sudo /etc/init.d/odoo-server start
pic1:
enter image description here
pic1 stop and start servise odoo after check pic2
odoo---server---odoo.conf---addons_path:Give the address your module want
enter image description here

Problems with Odoo v12 installation

I need to install Odoo V12 in my laptop and I having some problems with it.
When I run the ./odoo-bin command for running the server this is the log.
It seems okey but when I run http://localhost:8069/ is not working.
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = False
logfile = /var/log/odoo/odoo-server.log
addons_path = /opt/odoo/core/addons,/opt/odoo/core/odoo/addons
xmlrpc_port = 8269
Postgres user list:
Anyone knows what's happening?
Thanks for reading!
Check if db is working and permission on config file.
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
actually problem is with process's pid.
You have to kill process which is running on localhost:8069 port.
fire this commands:-
ps aux|grep odoo
Their find your command like (ODOO_FOLDER_PATH/odoo-bin )
Kill this process with
sudo kill -9 pid(pid is the process id , find where you located the line : second column)

how to add a third party library as a package in Yocto build

I have a library that is not famous and there is no package available for this library https://github.com/dailab/libsml normally I install this library on my device by doing make install
How can I add this library as a package in my distribution of Linux. Just like i can add python or any other recipe in my local.conf
My local.conf looks like this
MACHINE ?= "phyboard-regor-am335x-1"
DISTRO ?= "yogurt"
# The following line disables the autostart of the phytec-qtdemo by
# default, but you can start the demo anytime using
# $ systemctl start phytec-qtdemo.service
#SYSTEMD_AUTO_ENABLE_pn-phytec-qtdemo = "disable"
# That are the default values of bitbake. Adapt these to your workspace and
# host preferences.
#DL_DIR = "${TOPDIR}/downloads"
#SSTATE_DIR = "${TOPDIR}/sstate-cache"
# License Handling
# - Uncomment for i.MX6 proprietary GPU libraries
#LICENSE_FLAGS_WHITELIST += "license-nxp_v14-june-2016_imx-gpu-viv"
# - Uncomment for Freescale i.MX6 legacy VPU firmware blobs
#LICENSE_FLAGS_WHITELIST += "license-freescale_v6-february-2015_firmware-imx"
# You can disable and enable FSTYPES as you wish. e.g. 'ext4'.
# This is ordering dependend. IMAGE_FSTYPES += "tar.gz" IMAGE_FSTYPES_append_mx6 = " sdcard ubifs" IMAGE_FSTYPES_append_ti33x
= " sdcard ubifs" IMAGE_FSTYPES_append_rk3288 = " sdcard"
#IMAGE_FSTYPES_append_ti33x = " emmc" DEPLOY_DIR = "${TOPDIR}/deploy"
# Select configuration UI for linux and barebox recipe. The openembedded
# default is 'menuconfig', 'nconfig' has more features.
#KCONFIG_CONFIG_COMMAND = "menuconfig" KCONFIG_CONFIG_COMMAND = "nconfig"
# Turn on debugging options of the kernel
# This is currently only supported for the TI kernel v4.4 DEBUG_BUILD_pn-linux-ti = "1"
# The default package class of the distro yogurt is 'package_ipk'. The first
# value is used as the package manager to build the image and sdk. To build
# also tar packages use
#PACKAGE_CLASSES = "package_ipk package_tar"
# Variable IMAGE_ROOTFS_EXTRA_SPACE from poky/meta/conf/documentation.conf:
# Defines additional free disk space created in the image in Kbytes. By
# default, this variable is set to '0'.
# This example line adds an additional 512 MiB of free space to the root
# filesystem:
#IMAGE_ROOTFS_EXTRA_SPACE = "524288"
# See http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#ref-features-image
# "Through these variables, you can add several different predefined
# packages such as development utilities or packages with debug information
# needed to investigate application problems or profile applications EXTRA_IMAGE_FEATURES = ""
# - "Makes an image suitable for development (e.g. allows root logins without
# passwords and enables post-installation logging)" EXTRA_IMAGE_FEATURES += "debug-tweaks"
# - "Installs debug symbol packages for all packages installed in a given
# image."
#EXTRA_IMAGE_FEATURES += "dbg-pkgs"
# - "Installs debugging tools such as strace and gdb."
#EXTRA_IMAGE_FEATURES += "tools-debug"
#python-netserver for python cgi IMAGE_INSTALL_append = "mc nano openvpn apache2 dhcp-server lora-gateway lora-pkt-fwd spitools python avro-c python-kafka ntp python-netserver iptables"
#SDKMACHINE ?= "x86_64"
OE_TERMINAL = "auto" PATCHRESOLVE = "noop" BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
CONF_VERSION = "1"
And my bblayers.conf looks like this:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
OEROOT := "/home/enilyser/sources/poky"
BBLAYERS ?= " \
${OEROOT}/meta \
${OEROOT}/meta-poky \
${OEROOT}/../meta-phytec \
${OEROOT}/../meta-yogurt \
${OEROOT}/../meta-cloud-services-master/meta-openstack \
${OEROOT}/../meta-openembedded/meta-oe \
${OEROOT}/../meta-openembedded/meta-networking \
${OEROOT}/../meta-openembedded/meta-python \
${OEROOT}/../meta-openembedded/meta-multimedia \
${OEROOT}/../meta-qt5 \
${OEROOT}/../meta-openembedded/meta-ruby \
${OEROOT}/../meta-openembedded/meta-webserver \
${OEROOT}/../meta-lora-net-master \
${OEROOT}/../meta-lorawan-master \
"
You can use devtool to add the recipe if you are no 2.4+ version of yocto release
devtool add libsml https://github.com/dailab/libsml
it will create a recipe template
workspace/recipes/libsml/libsml_git.bb
this is nearly what you need but sometimes you have to tweak it a bit to ensure cross compiling.
in this case it builds and runs the tests, obviously when cross building we can build the tests but we can run them on build machine, so you have to disable that. you can do so in recipe or via a patch. e.g. via recipe you will change do_configure function to something like this
do_configure () {
# Specify any needed configure commands here
sed -i -e "s##./test##g" ${S}/test/Makefile
}
may be change do_install as well so it can install the files you need on target
do_install () {
install -d ${D}${libdir} ${D}${includedir}
install -m 0644 ${B}/sml/lib/libsml.* ${D}${libdir}
rm -rf ${D}${libdir}/libsml.o
cp -R --no-dereference --preserve=mode,links ${S}/sml/include/* ${D}${includedir}
install -D -m 0644 sml.pc ${D}${libdir}/pkgconfig/sml.pc
}
to build and see if all is ok
devtool build libsml
if all builds you can then apply the recipe to a layer of your choice ( say meta-oe )
devtool finish libsml meta-oe -f
Thats it, now you should see the recipe in meta-oe layer, you can try to build it
bitbake libsml

Capistrano 3 runs every command twice (new install) - Configuration issue

I just completed my capistrano installation for the first time. Most of everything is left to default settings, I configured my server, its authentification, and the remote folder, as well as the access to my git repository.
I use capistrano to deploy php code to my server.
cap staging deploy and cap production deploy function, but they run every command twice. It sometimes causes problems when those tasks are executed too quickly on the server, returning error codes, which stops the deploying process.
an example of my output when running cap staging deploy
DEBUG[47ecea59] Running /usr/bin/env if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1>&2; false; fi on ftp.cluster013.ovh.net
DEBUG[47ecea59] Command: if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1>&2; false; fi
DEBUG[c450e730] Running /usr/bin/env if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1>&2; false; fi on ftp.cluster013.ovh.net
DEBUG[c450e730] Command: if test ! -d ~/www/test_server/repo; then echo "Directory does not exist '~/www/test_server/repo'" 1>&2; false; fi
It does the same with every single task, except the one I defined myself (in my deploy.rb, I defined a :set_distant_server task that moves around files with server info)
I am pretty sure I missed something during the initial configuration.
Here is my capfile, still to default settings :
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Includes tasks from other gems included in your Gemfile
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
#require 'capistrano/bundler'
#require 'capistrano/rails/assets'
#require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Followed by my deploy.rb file:
# config valid only for Capistrano 3.1
lock '3.2.1'
set :scm, :git
set :application, 'Application name'
# I use token authentification
set :repo_url, 'https://XXXXXXXXXXX:#XXXXXXX.git'
set :role, 'web'
# Default value for :log_level is :debug
set :log_level, :debug
set :tmp_dir, 'www/test_server/tmp'
set :keep_releases, 8
role :deploy_server, "XXXuser_name#XXXX_server"
task :set_distant do
on roles(:deploy_server) do
execute 'echo ------------******* STAGING *******------------'
execute 'cp ~/www/test_server/current/access_distant.php ~/www/test_server/current/access.php'
execute 'cp ~/www/test_server/current/session_distant.php ~/www/test_server/current/session.php'
end
end
after "deploy:finished", :set_distant
Here is my staging.rb, much shorter:
server 'XXX_server', user: 'XXXuser_name', roles: %w{web}, port: 22, password: 'XXXpassword'
set :deploy_to, '~/www/test_server'
set :branch, 'staging'
And my production.rb, very similar:
server 'XXX_server', user: 'XXXuser_name', roles: %w{web}, port: 22, password: 'XXXpassword'
set :deploy_to, '~/www/beta/'
I'm pretty sure I missed a step in all the prerequisites to make it run nicely. I am new to ruby, to gems, and didn't use shell for a very long time.
Does anyone see why those commands are run twice, and how I could fix it?
In advance, many many thanks.
Additional info:
Ruby version: ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
Capistrano version: cap -V
Capistrano Version: 3.2.1 (Rake Version: 10.1.0)
I did not create a Gemfile or set it up, I understood it was not needed in Capistrano 3. Anyway, I would not know how to do it.
I was having this same issue and realized I didn't need both
role :web
and
server '<server>'
I got rid of role :web and that got rid of the 2nd execution.